feat(mobile): budgets screen #4426
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4426"
general
weight: 0.35
bhargavmehta01
feat(mobile): budgets screen
(Paste as the PR #4426 body, above the CodeRabbit summary block.)
---
Replaces #4324, which GitHub closed after an accidental force-push left its branch empty (a PR in that state can't be reopened). Earlier review history is on #4324; this description is self-contained.
Problem
The mobile app can't show budgets. To compare this month's spending with the plan, users have to open the web app, even though the read-only budgets API (
GET /api/v1/budgets,GET /api/v1/budget_categories) exists.What changed
A Budgets screen, opened from More, mirrors the web budgets page:
current(so families with a custom month start land on their real period), and Next goes up to two years ahead, likeBudget.latest_valid_budget_start_date. The header uses the budget's servername.budgeted?,over_budget?,near_limit?,visible_on_track?); a budget that isn't initialized lists every line, as on the web.GET /api/v1/transactionswithcategory_ids[],start_dateandend_date.TransactionsService.getTransactionsgains these three optional params (identical to the same change in #4428); existing callers are unchanged.Layers:
models/budget.dart,services/budgets_service.dart(injectablehttp.Client),providers/budgets_provider.dart(owned by the screen, so nothing survives a sign-out; stale and post-dispose responses are ignored),screens/budgets_screen.dart,screens/budget_category_transactions_screen.dart,widgets/budget_*, usingSureCard,SureSegmentedControl,SureChip,SureButtonandSureColorstokens.API notes (no backend changes in this PR):
budget_categories/:idrequest per line, six at a time; months are cached for the session. A line whose detail is gone (404) keeps its budgeted amount; any other failure fails the month so a partial month is never cached. Actuals in the index (or a bulk endpoint) would make this one request; happy to send that as a follow-up.Budget.find_or_bootstrap); other months show "No budget for {month}". Lines for categories created after a budget was bootstrapped also need the web (or an API-side bootstrap).budget_id(owner scope, excluded kinds) andexcluded=falseto the transactions index; the drilldown will use them once it merges.How it was tested
flutter analyze: only the 3 pre-existing infos inintro_screen_web.dart.flutter test: 243 passed, including:-
test/models/budget_test.dart: parsing, over/near-limit and visibility rules, rollover, shared pools (ring-fenced siblings and their rollover), grouping.-
test/services/budgets_service_test.dart: query params, show/index parsing, 401 and errors, transaction filters.-
test/providers/budgets_provider_test.dart: month assembly, session cache, server current period vs device date, custom month start, month change during a load, list reuse only for its own month, pagination safety stop, failed refresh keeps the month, dispose during a load, 404 vs network failure on a line, budget switching without refetching the list, 401, offline.-
test/screens/budgets_screen_test.dartandbudget_category_transactions_screen_test.dart: totals, nesting and badges, over-budget filter, privacy, Swedish month formatting, empty state, navigation, drilldown ids, refresh-failed banner, session-expired states, retry reloading page one.dart format; generated l10n keeps the repo's format.Screenshots: light, dark and light with privacy mode (attached on #4324).
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
- Added a Budgets screen with monthly navigation, budget selection, spending summaries, category progress and statuses, rollover details, and an over-budget filter.
- Added paginated transaction views for budget categories, with date ranges, refresh, and retry options.
- Added Budgets access from the More menu.
- Added cached budget access while offline, along with loading, authentication, empty, and error states.
- Amounts respect privacy settings in budget and transaction views.
- Added English and Swedish translations for budgets, categories, transactions, and related statuses.
- Added category and date filters to transaction loading.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->