Skip to content

Count underlying requests in synced rollups - #38

Merged
starkdmi merged 1 commit into
mainfrom
fix-rollup-request-counts
Sep 22, 2026
Merged

starkdmi merged 1 commit into
mainfrom
fix-rollup-request-counts

Conversation

@starkdmi

@starkdmi starkdmi commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Count the underlying requests recorded in each usage event when building synced provider and model rollups. One stored event may aggregate multiple API requests.
  • Use the same request count in the local today/week snapshot.
  • Advance the sync rollup version so existing rollups are rebuilt and sent again on the next sync.

Cause

The rollup incremented requests once per stored event, even when event.usage.requests recorded multiple requests. The regression test uses synthetic fixtures to cover this case and the one-request fallback.

Verification

  • Regression tests pass with synthetic fixtures.
  • cargo test -p statsai-store
  • cargo clippy -p statsai-store --all-targets -- -D warnings
  • cargo clippy -p statsai-daemon --features watch --all-targets -- -D warnings
  • ./scripts/rust-ci.sh full
  • GitHub CI checks passed.

@starkdmi
starkdmi merged commit 63ae486 into main Sep 22, 2026
5 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.

1 participant