[codex] add event aggregation foundation#26
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds the core foundation for event-based token aggregation by introducing a shared UsageEvent model in provider and new timezone-aware event filtering/aggregation helpers in stats, along with focused tests and supporting OpenSpec/workspace artifacts.
Changes:
- Introduce
provider.UsageEventand optionalprovider.UsageEventProviderfor timestamped usage deltas. - Add
stats.AggregateEventsByDayWithDimensionandstats.FilterEventsByDateRangefor localized daily aggregation + inclusive date filtering. - Add focused unit tests and supporting OpenSpec/task-board/workspace documentation for EBTA-001.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| workspace/EBTA-001/test_strategy.md | Documents the focused test plan for EBTA-001. |
| workspace/EBTA-001/review.md | Records EBTA-001 review scope and findings. |
| workspace/EBTA-001/original_impl.md | Captures limitations of the pre-event model approach. |
| workspace/EBTA-001/new_impl.md | Describes the candidate event-based implementation approach. |
| workspace/EBTA-001/final_impl_v1.md | Implementation plan iteration notes. |
| workspace/EBTA-001/final_impl.md | Final implementation plan and semantics summary. |
| stats/events.go | Implements event-based daily aggregation + localized date filtering helpers. |
| stats/events_test.go | Adds tests for cross-day attribution, timezone grouping, distinct session counting, and filtering. |
| provider/provider.go | Adds new event model and optional provider interface. |
| openspec/changes/event-based-token-aggregation-core/.openspec.yaml | Registers the OpenSpec change metadata. |
| openspec/changes/event-based-token-aggregation-core/design.md | Design rationale/decisions for EBTA-001. |
| openspec/changes/event-based-token-aggregation-core/proposal.md | Proposal overview and impact statement. |
| openspec/changes/event-based-token-aggregation-core/specs/event-based-token-aggregation-core/spec.md | Requirements/spec for event model + stats behavior. |
| openspec/changes/event-based-token-aggregation-core/tasks.md | Tracks implementation tasks for the OpenSpec change. |
| docs/plans/2026-04-16-event-based-token-aggregation-task.md | Marks EBTA-001 done and appends change-log entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
provider.UsageEventand optionalprovider.UsageEventProvideras the foundation for event-based token aggregation.stats.EBTA-001done in the event aggregation task board and add supporting OpenSpec/workspace artifacts.Validation
make fmtmake testmake vetmake buildmake lintmain...HEADNotes
This PR only lands the shared event model and stats foundation. Command integration and native provider event collectors remain split into follow-up task-board items (
EBTA-002throughEBTA-010).