Repository navigation
fix(routing): price refused-then-served rows in routing analytics - #7253
vadymhimself wants to merge 1 commit into
Conversation
successCostUsd passed the aggregate `unreported` status to estimateRequestCost, so a usage-less 429 before a measured send stayed unpriced in /api/routing-analytics while /api/usage priced it. It now reuses computeEntryCost, the same attempt-aware pricing. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Summary
/api/routing-analyticspriced a successful row withestimateRequestCoston the row's aggregate usage and status. A request with a usage-less refusal (e.g. 429) before a measured send aggregates tounreported, so analytics returned no cost and no price coverage, while/api/usagealready prices it via the attempt-awarecomputeEntryCost(fix: carry account recovery, server-tool buffer, and usage corrections #7236).successCostUsdnow usescomputeEntryCost, so both endpoints apply one pricing rule, including the new "measured attempt without a price stays unpriced" policy from fix: carry account recovery, server-tool buffer, and usage corrections #7236.Verification
bun test tests/routing/routing-analytics.test.tsgives 11 pass, 1 fail (a refused retry before a measured send is priced, matching /api/usage: price coverage 0, expected 1).bun x tsc --noEmit: clean.bun run structure:check: passed.tests/lab/core-lab-boundary.test.ts, the file-size ratchet and every test file that importsrouting/analytics: 46 pass, 0 fail.Checklist
🤖 Generated with Claude Code
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit