-
Notifications
You must be signed in to change notification settings - Fork 0
Description
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) — expectsSessionSnapshotsSaved = 2, gets0TestBuildReportData_TotalBytes(line 133) — expectsTotalContextBombBytes = 12000, gets0TestBuildReportData_TokenEstimation(line 147) — expectsTotalTokens = 1000, gets0TestBuildReportData_HoursEstimation(line 162) — expectsEstimatedHoursSaved = 0.5, gets0.0TestBuildReportData_CompactionCount(line 178) — expects non-zero counts, gets0
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