← Back to Pull requests

Let the planner's spending and income streams be edited #975

Open
unknown opened this pull request with 529 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 24, 2026 09:34 UTC
Author

Upstream PR: we-promise/sure#5754 (same commits)

Part of jaysbeekay/sure#127

Stacked on up/retirement-plan-ui-card.

Upstream pre-flight for the planner's spending and income streams, one of five UI slices on the retirement planner model stack (jaysbeekay/sure#364, jaysbeekay/sure#365, jaysbeekay/sure#369, jaysbeekay/sure#370). The full description, validation and screenshots are on the upstream PR.

Review round, 2026-11-26 (head 1a5df189d)

  • A seeded stream changed to another type becomes manual (Codex P2). StreamsController#update sets source = "manual" when kind changes. Before, a seeded living-costs or loan stream turned into income kept its seeded source, so the simulation ignored it before retirement: a 12,000 pension starting next year added 0.0 to that year's paid-in figure. Now it adds 12,000 or more. An edit that keeps the type leaves a seeded stream seeded.

  • The planner says the FI number and the streams are separate (Gatekeeper review 7186365685, F1). The FI number is built from the last 12 months' spending, while the streams drive the year-by-year path, so editing the living-costs stream moves the path but not the FI number. A line above the streams table now says so, and the simulation_inputs comment no longer calls the stream the FI figure. The model is unchanged.
  • Tests (test/controllers/retirement_plans/streams_controller_test.rb), red on adb3fe841 and green on 1a5df189d:

  • "a seeded stream whose type is changed becomes manual, and counts before retirement": the source was seeded_living_costs instead of manual, and the paid-in delta was Expected 0.0 to be >= 12000.

  • "an edit that keeps the type leaves a seeded stream seeded": the guard against flipping the source on every edit.

  • "the planner explains the FI number is from recent spending, not the streams": the copy was missing (Translation missing).
  • Mutations, each caught: dropping the source line; dropping it with the source assertion removed (the simulation delta alone goes red); making the flip unconditional; removing the copy.

    Verification: rubocop and erb_lint clean. Full unit suite on 1a5df189d: 18,705 runs, 0 failures, 8 errors (ReleaseNotesWorkflowTest, needs node, missing from the test image), 9 skips. Full unit suite on the stack top (7893d6fbc): 18,725 runs, 0 failures, 8 errors (the same ReleaseNotesWorkflowTest ones), 9 skips.

    | | Light | Dark |
    |---|---|---|
    | Before | !before light | !before dark |
    | After | !after light | !after dark |

    <!-- This is an auto-generated description by cubic. -->
    <a href="https://cubic.dev/pr/jaysbeekay/sure/pull/975?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/jaysbeekay/sure/975?returnTo=https%3A%2F%2Fgithub.com%2Fjaysbeekay%2Fsure%2Fpull%2F975&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
    <!-- End of auto-generated description by cubic. -->

    Diff: 529 lines (+396 / -133) across 6 files Reviewer: jaysbeekay Review duration: 9111m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.48) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 529 lines diff across 6 files
    0.48
    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%
    46%
    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.375
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #975"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 47.9% (MEDIUM) · Higher = larger blast radius
    47.9%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 25.5% · Safe to merge
    25.5%