Show budget performance for past months in Reports #6106
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 257 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.332
Real PR Conversation Timeline
1 comments
"Review active on #6106"
general
weight: 0.35
jjmata
Problem
Pick any past month in Reports and the budget performance tile says "No budget data", even when that month has a budget.
ReportsController#calculate_budget_performancereturnsnilfor every month except the current one.The current month has the opposite bug. A budget with no category allocations shows 0%, as if you'd spent nothing.
Why it was current-month only
#276 added the guard back when "Monthly" always meant this month, so it hid nothing. Then #5298 linked month names to their own reports. Since then every past month hides its budget. I couldn't find an issue for it. I noticed when my September, October and November budgets vanished from Reports.
Changes
Notes
Budget.find_or_bootstrapcreates an empty budget for a past month the first time you open its report. The Budgets page already does this when you navigate to a month, so I kept the same call.Quarterly, YTD, custom and all-time reports still have no budget tile. A budget covers one month and I didn't want to invent a multi-month rule here.
Verification
All 154 tests in
test/controllers/reports_controller_test.rbpass in the devcontainer image. Without the controller change, the past-month test fails. Rubocop is clean on both files.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Monthly reports now show budget performance for the month being viewed, including past months.
* Reports show no budget data when the selected month has no budget or its budget allocations are zero.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->