[codex] Stream daily event aggregation#43
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the daily command to aggregate usage events in a streaming, provider-by-provider manner using a stats accumulator, avoiding command-level materialization of an all-provider event slice while preserving existing outputs and compatibility collectors.
Changes:
- Add
stats.DailyEventAggregatorandstats.EventInDateRange, and refactor materialized aggregation to reuse the accumulator. - Introduce a callback-based provider event iterator in
cmd/collect.goand keepcollectUsageEventsFromProvidersInRangeas a materializing adapter. - Update
dailyto aggregate directly via the iterator + accumulator; add parity tests/benchmarks and workspace/docs artifacts.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
cmd/collect.go |
Adds iterator-style event collection and rewires the materializing collector as an adapter. |
cmd/daily.go |
Switches daily aggregation to streaming (iterator → date predicate → accumulator). |
cmd/daily_test.go |
Adds parity tests for streaming vs materialized behavior and a benchmem benchmark. |
stats/events.go |
Introduces DailyEventAggregator + EventInDateRange; refactors aggregation/filtering to reuse helpers. |
stats/events_test.go |
Adds accumulator/materialized comparison coverage for stats aggregation. |
docs/plans/2026-04-17-event-aggregation-performance-optimization-task.md |
Marks EAP-004 as done and records timeline/evidence notes. |
workspace/EAP-004/verification.md |
Records verification commands and allocation benchmark evidence. |
workspace/EAP-004/test_strategy.md |
Documents test strategy for RED→GREEN and parity goals. |
workspace/EAP-004/review.md |
Captures review notes and residual risk statement. |
workspace/EAP-004/original_impl.md |
Describes pre-change materialization points and constraints. |
workspace/EAP-004/new_impl.md |
Describes the proposed streaming design at a high level. |
workspace/EAP-004/final_impl_v1.md |
Draft implementation plan and validation checklist. |
workspace/EAP-004/final_impl.md |
Final implementation summary and expected behavior guarantees. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- aggregate daily events provider-by-provider with an incremental stats accumulator\n- keep materialized collectors for compatibility and preserve provider error context\n- add parity tests, benchmem evidence, and EAP-004 workspace artifacts
- normalize daily aggregator state before each add\n- reuse event date range filters in hot paths\n- restore bulk append for materialized event collectors
Miss-you
force-pushed
the
codex/eap-004-streaming-daily
branch
from
April 17, 2026 08:20
d177a2a to
22bff7e
Compare
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
dailyaggregation provider-by-provider through a stats accumulator instead of building a full all-provider event slice and filtered slice.Verification
make fmtmake testmake vetmake lintmake buildgit diff --check origin/main...HEADorigin/main...HEADNotes
The streaming scope is intentionally shallow: provider parsers still return slices. EAP-004 removes command-level daily materialization only; provider parser allocation work remains separate.