Repository navigation
fix(pi): return zero totals for empty reports - #1674
Conversation
Keep the JSON totals shape stable when a pi report has no usage rows. Add a regression test covering the shared zero-valued totals object. Refs ccusage#832 and ccusage#1480.
|
@coderabbitai review |
@Nicolas0315 I have started the AI code review. It will take a few minutes to complete. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesEmpty report totals
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to The Pi report now returns zero-valued totals for empty periods while preserving the response shape, with no actionable merge-blocking risk remaining after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Pullfrog could not complete the automated PR review. The PR was left open for maintainer review. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The review covers the single Pi adapter change and its regression test.
- Stable empty-report totals —
report_from_rowsnow delegates empty inputs to the sharedtotals_jsonimplementation, producing a zero-valued totals object for Pi reports, and the test verifies the token and cost fields.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Luna (free via Pullfrog for OSS) | 𝕏
|
|
Upstream through 8841f92: official Antigravity SQLite adapter (ccusage#1677), ZCode (ccusage#1675) and Grok Build CLI sources, Copilot session-state usage (ccusage#1676), Codex originator breakdowns and cache-write token accounting (ccusage#1663, ccusage#1674), date-window file skipping (ccusage#1665), session totals scoped to the date window (ccusage#1664), OpenCode v2 session usage (ccusage#1668), timestamp-aware DeepSeek V4 pricing (ccusage#1679), ETag-validated pricing cache refreshes (ccusage#1672), and numeric-column preservation in narrow tables (ccusage#1671). Conflict resolutions per the personal divergence ledger: - Antigravity: adopt the upstream native adapter wholesale; remove the personal heuristic adapter and the antigravity-analysis/ provenance directory. - Codex: keep counting copied parent history (replay.rs stays deleted), keep tier changes applying at the following turn_context, keep the pre-v0.144.0 fast windows and the 2x fast-multiplier fallback, and keep the append-aware grouped cache with serde'd parser state. Integrate upstream cache-write tokens, originator sources, session_meta line detection, and filter_codex_usage_files date-window skipping. Bump the group, per-file event, and all-agent row cache discriminators. - Claude: rewire the cached daily/session summary wrappers onto upstream's date-scoped loaders (ccusage#1664). - OpenCode: keep WAL-signature cache signatures, the summary cache wrapper, and --no-cost -> Display mapping; take upstream's v2 session usage loading and split directory loader. - Pricing: keep the explicit GLM-5.2 rates and 1,000,000-token context limit (now via put_builtin_entry for both GLM-5.1 and GLM-5.2); take upstream's DeepSeek V4 scheduled rates and catalog rules. - Terminal: keep full dates whenever the minimum full-date layout fits and attached breakdown rows; take upstream's content-aware fallback minimums and numeric-column floors, adapting the 80-column regression test to the personal full-date policy. - Presentation: keep the hidden-by-default Models column and the all-agent --with-models opt-in; regenerate zcode/copilot session snapshots under the wider first-column floor. - Ledger: audit baseline updated to 8841f92; heuristic Antigravity and replay suppression recorded as retired divergences.
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
commit: |

Keeps the Pi JSON report shape stable when a selected period has no rows by returning the shared zero-valued totals object instead of null. This branch is rebuilt from current main, so the PR contains exactly one adapter file.
Testing:
Summary by cubic
Fixes the Pi adapter report so a selected period with no usage rows returns a zero-valued totals object instead of
null, keeping the JSON response shape consistent for consumers. Adds a regression test covering that empty report shape.Written for commit 5c57e5d. Summary will update on new commits.
Summary by CodeRabbit