Repository navigation
fix(economics): use tracked monthly savings percentage - #3973
Raymondtaoo wants to merge 1 commit into
Conversation
Signed-off-by: Raymond Tao <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The change correctly aligns monthly savings percentage handling with day/week behavior and includes a targeted regression test covering the reported bug.
Pull request overview
This PR fixes monthly “economics” reporting by aligning PeriodEconomics::set_rtk_from_month with the existing day/week logic: it now uses the already-tracked MonthStats::savings_pct instead of recomputing the percentage with an incorrect denominator.
Changes:
- Replace the monthly
rtk_savings_pctrecomputation withstats.savings_pct. - Add a focused regression test ensuring monthly economics preserves a tracked 80% savings percentage for a representative record.
File summaries
| File | Description |
|---|---|
| src/analytics/cc_economics.rs | Uses tracked MonthStats::savings_pct for monthly economics and adds a regression test to prevent the prior under-reporting bug. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
📊 Automated PR Analysis
SummaryFixes monthly economics calculations to use the savings percentage already tracked by MonthStats instead of recomputing it incorrectly, aligning the monthly path with the existing day and week logic. Includes a regression test verifying a record with 100 input, 20 output, and 80 saved tokens correctly reports 80% savings instead of the previous incorrect 40%. Review Checklist
Linked issues: #3972 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Closes #3972
Summary
MonthStatswhen constructing monthly economicsRegression coverage