Skip to content

bug: buildReportData drops entries without EventType, causing 5 report tests to fail #431

@claude

Description

@claude

Problem

buildReportData in cmd/report.go skips all activitylog.Entry values where EventType is empty (the zero value), treating them as non-EventRun events and silently discarding them.

The check at cmd/report.go:149-152:

if e.EventType != activitylog.EventRun {
    continue
}

activitylog.EventRun = "run", so any entry with EventType == "" is discarded.

activitylog.ReadAll() already handles this correctly with a backward-compat rule at internal/activitylog/activitylog.go:141-144:

// Backward compatibility: old entries without event_type are EventRun.
if e.EventType == "" {
    e.EventType = EventRun
}

But buildReportData does not apply the same rule. In-memory entries constructed in tests (or any code that doesn't go through ReadAll) have empty EventType and are dropped.

Failing tests

Five tests in cmd/report_test.go create entries without EventType and will report wrong (zero) values:

  • TestBuildReportData_SnapshotCount (line 120) — expects SessionSnapshotsSaved = 2, gets 0
  • TestBuildReportData_TotalBytes (line 133) — expects TotalContextBombBytes = 12000, gets 0
  • TestBuildReportData_TokenEstimation (line 147) — expects TotalTokens = 1000, gets 0
  • TestBuildReportData_HoursEstimation (line 162) — expects EstimatedHoursSaved = 0.5, gets 0.0
  • TestBuildReportData_CompactionCount (line 178) — expects non-zero counts, gets 0

Fix

Apply the same backward-compat rule inside buildReportData:

eventType := e.EventType
if eventType == "" {
    eventType = activitylog.EventRun
}
if eventType != activitylog.EventRun {
    continue
}

Location

  • cmd/report.go:149-152 (missing backward-compat for empty EventType)
  • cmd/report_test.go:120-214 (5 failing tests)
  • Compare: internal/activitylog/activitylog.go:141-144 (ReadAll already handles this correctly)

@claude please implement this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions