Skip to content

[codex] Stream daily event aggregation#43

Merged
Miss-you merged 2 commits into
mainfrom
codex/eap-004-streaming-daily
Apr 17, 2026
Merged

[codex] Stream daily event aggregation#43
Miss-you merged 2 commits into
mainfrom
codex/eap-004-streaming-daily

Conversation

@Miss-you

Copy link
Copy Markdown
Owner

Summary

  • Stream daily aggregation provider-by-provider through a stats accumulator instead of building a full all-provider event slice and filtered slice.
  • Keep the materialized event collector as a compatibility adapter for existing callers.
  • Add parity coverage for stats aggregation, daily JSON/dashboard output, provider error context, and benchmem allocation evidence.
  • Close EAP-004 in the task board and include workspace artifacts.

Verification

  • make fmt
  • make test
  • make vet
  • make lint
  • make build
  • git diff --check origin/main...HEAD
  • branch secret scan over origin/main...HEAD

Notes

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.

Copilot AI review requested due to automatic review settings April 17, 2026 08:03

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

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.DailyEventAggregator and stats.EventInDateRange, and refactor materialized aggregation to reuse the accumulator.
  • Introduce a callback-based provider event iterator in cmd/collect.go and keep collectUsageEventsFromProvidersInRange as a materializing adapter.
  • Update daily to 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.

Comment thread stats/events.go
Comment thread stats/events.go
Comment thread cmd/daily.go
Comment thread cmd/collect.go
- 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
Miss-you force-pushed the codex/eap-004-streaming-daily branch from d177a2a to 22bff7e Compare April 17, 2026 08:20
@Miss-you
Miss-you merged commit 511bbe6 into main Apr 17, 2026
7 checks passed
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