Skip to content

feat: aggregate daily usage by event date#32

Merged
Miss-you merged 2 commits into
mainfrom
codex/ebta-007-daily-events
Apr 16, 2026
Merged

feat: aggregate daily usage by event date#32
Miss-you merged 2 commits into
mainfrom
codex/ebta-007-daily-events

Conversation

@Miss-you

Copy link
Copy Markdown
Owner

Summary

  • Switch codetok daily from session-start aggregation to provider.UsageEvent timestamp aggregation.
  • Apply --timezone, explicit date filters, and default rolling windows to localized event dates.
  • Preserve daily JSON grouping semantics for CLI and model grouping.
  • Record EBTA-007 OpenSpec/workspace artifacts and close the task board row.

Validation

  • make fmt
  • go clean -testcache && make test
  • make vet
  • make build
  • make lint

Notes

  • Updated the Claude subagent daily e2e expectation to the new distinct-session-ID daily semantics.
  • Cross-command e2e fixtures remain deferred to EBTA-009 as recorded in workspace/EBTA-007/todo.md.

- Switch daily to collect and aggregate UsageEvent records in the selected timezone

- Add command tests for event-date splits, timezone filtering, default windows, and JSON grouping

- Record EBTA-007 OpenSpec/workspace artifacts and update stale Claude subagent daily e2e semantics
Copilot AI review requested due to automatic review settings April 16, 2026 12:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates codetok daily to aggregate/filter by provider.UsageEvent.Timestamp (localized by --timezone) instead of session start time, and records EBTA-007 workspace/OpenSpec artifacts.

Changes:

  • Switch daily command pipeline to collect/filter/aggregate UsageEvents (with injected provider/clock seam for deterministic tests).
  • Add command-level tests covering cross-midnight splits, timezone date keys, explicit/localized date windows, and model grouping across providers.
  • Update the Claude subagent daily e2e expectation to match distinct-session-per-day semantics; add EBTA-007 OpenSpec/workspace documentation.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
cmd/daily.go Replace session-based daily aggregation with usage-event pipeline; add provider/clock seam and date-bound conversion helper.
cmd/daily_test.go Add focused command tests for event-date aggregation, timezone behavior, and localized date filtering; add JSON decode helper.
e2e/e2e_test.go Update daily session-count expectation for Claude subagent fixture under event aggregation semantics.
docs/plans/2026-04-16-event-based-token-aggregation-task.md Mark EBTA-007 as done and record verification/review notes in the task board.
workspace/EBTA-007/todo.md Record deferred follow-ups (cross-day e2e fixtures; flag-validation ordering note).
workspace/EBTA-007/test_strategy.md Document EBTA-007 testing gates and focused test cases.
workspace/EBTA-007/review.md Record review result and residual risks.
workspace/EBTA-007/original_impl.md Capture pre-change daily command flow and caveats.
workspace/EBTA-007/new_impl.md Describe proposed event-based daily approach and scope control.
workspace/EBTA-007/final_impl_v1.md Summarize final implementation decisions and review notes (v1).
workspace/EBTA-007/final_impl.md Summarize implemented behavior and verification targets.
openspec/changes/event-based-token-aggregation-daily-command/.openspec.yaml Register new OpenSpec change artifact.
openspec/changes/event-based-token-aggregation-daily-command/proposal.md Motivate and scope the daily event-aggregation change.
openspec/changes/event-based-token-aggregation-daily-command/design.md Document design decisions, risks, and mitigations.
openspec/changes/event-based-token-aggregation-daily-command/tasks.md Track implementation and validation tasks as completed.
openspec/changes/event-based-token-aggregation-daily-command/specs/daily-event-aggregation/spec.md Add formal requirements/scenarios for event-date aggregation and localized filtering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/daily_test.go
Comment thread cmd/daily_test.go
Comment thread cmd/daily_test.go
Comment thread cmd/daily_test.go
Comment thread cmd/daily_test.go
- Defer stdout restoration and pipe cleanup in captureStdout

- Address Copilot review feedback about FailNow inside capture callbacks
@Miss-you
Miss-you merged commit e069a28 into main Apr 16, 2026
7 checks passed
@Miss-you
Miss-you deleted the codex/ebta-007-daily-events branch April 16, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants