Repository navigation
fix(claude): dedupe requestless Anthropic message IDs across timestamps - #1838
Conversation
Co-authored-by: RakshithBhat03 <[email protected]>
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | 166a813 | Commit Preview URL Branch Preview URL |
Oct 09 2026, 10:28 PM |
Document that the msg_ prefix is a heuristic and keep the same-timestamp test on a gateway ID so it still exercises the timestamp-scoped path.
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
commit: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
Requestless Claude entries with real Anthropic message IDs (
msg_prefix) now dedupe by(message.id, session)across timestamps in both the entry loader (rust/adapters/claude/src/lib.rs) and the daily loader (rust/adapters/claude/src/daily.rs), keeping the most complete record via the existing replacement logic. Gateway placeholder IDs keep the timestamp-scoped key, preserving the #1635/#1799 behavior. Docs updated inrust/adapters/claude/src/README.md.Tests: new unit tests for both loaders covering same-session
msg_collapse across timestamps; split the old same-session requestless test into Anthropic-collapse vs gateway-keep cases; newclaude_clitest asserting daily/weekly/monthly/session all count two content-block lines once (102 tokens) while theocgogateway fixture still counts 3x (306). Rancargo test -p ccusage-adapter-claude,cargo test -p ccusage --test claude_cli, andcargo test -p ccusage --bin ccusage(all green), pluscargo fmt --checkand clippy on the Claude adapter.Closes #1837
Summary by cubic
Fixes requestless Claude entries with real Anthropic message IDs (
msg_prefix) being counted multiple times when Claude Code writes one line per content block with distinct timestamps for a single response.(message.id, session)across timestamps in both the entry loader and daily loader; gateway placeholder IDs keep the timestamp-scoped key.msg_prefix is treated as a heuristic since only a request ID proves two lines belong to one response.claude_clitests asserting content-block lines are counted once in daily, weekly, monthly, and session reports, including a case where a streamed response straddles midnight.Written for commit 166a813. Summary will update on new commits.