fire-planner/tests
Viktor Barzin f43322e5ce
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
strategies: spending input is honoured + new "Custom" preset with guardrails
The user noticed the "Annual spending" field was a no-op for Trinity,
GK, VPW, VPW+floor — the strategies internally hardcoded the year-0
withdrawal as `initial_portfolio × initial_rate` (4% / 5.5%) and
ignored what the user typed. Two fixes:

(1) Trinity + GK now use state.initial_withdrawal (= the user's
    spending_target) as the year-0 draw. GK's guardrail anchor
    becomes the implied initial rate (initial_withdrawal /
    initial_portfolio), so the rule shape adapts to the user's
    chosen rate. Both strategies still fall back to their preset
    rate × initial_portfolio when initial_withdrawal isn't set
    (test paths). VPW and VPW+floor stay algorithmic — they're
    "withdraw-what's-sustainable" by design and don't take a
    spending input.

(2) New "custom" preset (SpendingPlanStrategy) exposing all the
    knobs:
    - initial_spend = "Annual spending" input
    - annual_real_adjust_pct = scale last year's withdrawal by N%
      each year (0 = constant real £, +0.02 = 2%/yr healthcare
      creep, -0.005 = -0.5%/yr slow-down with age)
    - guardrail_threshold_pct = if portfolio falls below X% of
      starting NW, trigger a cut (None = disabled)
    - guardrail_cut_pct = cut last year's withdrawal by Y% each
      triggered year

Adjust applies first, then guardrail cut — so a triggered year in
+2% adjust mode goes 40k → 40.8k → 36.7k.

UI: "custom" added to the strategy dropdown; when selected, three
extra fields appear (annual real adjustment %, guardrail trigger
threshold, guardrail cut size) with hints. The existing inputs
(spending, NW seed) drive year 0 across all strategies that use
them. About-the-model panel updated.

10 new tests on SpendingPlanStrategy + adjusted GK tests for the
new spending_target-aware behaviour. 209 backend tests + 7
frontend tests. mypy + ruff + tsc all pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 01:21:55 +00:00
..
__init__.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
conftest.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_api_life_events_goals.py api: expand FastAPI surface for scenarios, networth, life-events, goals, simulate 2026-05-09 21:48:36 +00:00
test_api_networth.py api: expand FastAPI surface for scenarios, networth, life-events, goals, simulate 2026-05-09 21:48:36 +00:00
test_api_scenarios.py api: expand FastAPI surface for scenarios, networth, life-events, goals, simulate 2026-05-09 21:48:36 +00:00
test_api_simulate.py engine+api: plumb life events into the simulator 2026-05-09 22:30:33 +00:00
test_cli.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_db_schema.py schema: add life_event, retirement_goal; extend scenario with kind/parent 2026-05-09 21:36:58 +00:00
test_e2e.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_ingest_wealthfolio_pg.py ingest: switch wealthfolio to pg-sync mirror reads 2026-05-09 21:33:48 +00:00
test_life_events.py engine+api: plumb life events into the simulator 2026-05-09 22:30:33 +00:00
test_reporters_pg.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_returns.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_returns_wealthfolio.py returns: 3 models — Shiller bootstrap (default), manual %, Wealthfolio history 2026-05-10 01:04:25 +00:00
test_scenarios.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_simulator.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_simulator_events.py engine+api: plumb life events into the simulator 2026-05-09 22:30:33 +00:00
test_spending_plan.py strategies: spending input is honoured + new "Custom" preset with guardrails 2026-05-10 01:21:55 +00:00
test_strategies.py strategies: spending input is honoured + new "Custom" preset with guardrails 2026-05-10 01:21:55 +00:00
test_tax_base.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_tax_other_regimes.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
test_tax_uk.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00