← Back to Pull requests

feat(api): budget and report filters for the transactions index #4423

Open
unknown opened this pull request with 331 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 22, 2026 00:42 UTC
Author

Budget clients need transaction drill-downs that reconcile with the budget line they opened. This adds budget/report filters to GET /api/v1/transactions and makes the web budget category list and API budget list use the same eligibility rules as the income statement totals.

Behavior

| Parameter | Behavior |
|---|---|
| budget_id | Lists the visible budget's reportable transactions using its income statement's period scope, account IDs and shared row conditions. Pending, future-dated, excluded, tax-advantaged and internal investment-movement rows are omitted. Investment contributions follow the family's spending setting. |
| exclude_split_parents | Applies Entry.excluding_split_parents. |
| excluded | Filters the entry's excluded flag on ordinary transaction lists. Budget lists already exclude flagged entries. |

Budget visibility is enforced before listing rows. Results are additionally restricted to accounts the caller can access: a personal-budget share alone does not grant access to its underlying accounts, so a viewer with partial account access can see a smaller sum than the owner's budget total.

IncomeStatement::Totals and the drill-down share the normal budget row conditions; the legacy include_trades: false totals behavior is preserved. BudgetCategoriesController#show uses the same reportable rows, so the web list receives the fix too.

BaseController#boolean_filter_param(key, required:) serves transactions, rules and security filters. It accepts true/false/1/0 with case/space normalization and rejects invalid or empty values with 422. Budget IDs and dates are parsed before the index's broad rescue so invalid filters produce 404/422. API documentation and OpenAPI are updated.

Validation

  • Full Rails suite: 19,025 tests, 115,540 assertions, 0 failures, 0 errors, 9 skips.

  • Executable API documentation and OpenAPI regeneration: 487 examples, 0 failures, 89 existing documentation-only pending examples.

  • The reviewer reproduction returns 40, matching the budget actual, while omitting pending 11, HSA 22, transfer-labelled 33 and a finance-excluded shared-account 44. Another regression covers future-dated rows in the current month.

  • Totals equivalence tests cover the legacy option matrix; account visibility and boolean parsing regressions pass.

  • Changed Ruby lint passes. Brakeman reports 0 errors and 0 security warnings.
  • The final base-only update includes main ac19725d8 (the merged mobile splits feature and carried-forward security-price fixes). Another 380 importer/price/transaction regressions and all 487 API documentation examples pass on that integration.

    Diff: 331 lines (+248 / -83) across 4 files Reviewer: bhargavmehta01 Review duration: 57166m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.49) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.49 · 331 lines diff across 4 files
    0.49
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.347
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #4423"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 40.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.1% (MEDIUM) · Higher = larger blast radius
    49.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.9% · Lower = rushed or shallow review
    40.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29% · Safe to merge
    29%