fire-planner: UX review pass 1 — fix sidebar/route/PATCH/badges issues
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Round-1 fixes from the headless UI review:

Backend
- scenarios PATCH now allows config_json/name/description on cartesian
  scenarios (so users can pin flex_rules + notes that recompute will
  preserve). Core fields (jurisdiction/strategy/etc.) still blocked
  because they're rebuilt on recompute. Existing test updated.

Frontend
- Sidebar Plans switcher: drop the kind=user filter so the switcher
  surfaces all 120 cartesian scenarios that ship out of the box.
- Settings → Milestones now reachable at both /settings (index) and
  /settings/milestones (explicit) — the agent navigated to the latter
  and got a blank page.
- EventGantt background click capture: explicit pointerEvents="all" +
  fillOpacity=0 so click-to-add reliably fires on empty regions
  between bars.
- Plan tab stat badges moved out of the chart card into a dedicated
  row above the fan — previously they overlapped the chart's title,
  legend caption ("p10/p50/p..."), and right-side withdrawal axis.
- Stub tabs (Tax Analytics / Compare / Reports / Estate) and stub
  Settings sub-pages (Dividends / Bonds / Tax / Metrics / Other) get
  a "soon" badge + slate-300 styling so they're clearly placeholders.
- New "Portfolio depleted at this year" pill renders in the badge
  row when the scrubbed year's NW is 0 — previously the badges
  silently went to £0 with no UI cue.
- Test life-event from the smoke run cleaned up from prod DB.

246 pytest pass; mypy/ruff clean; frontend typecheck/test/build green.
This commit is contained in:
Viktor Barzin 2026-05-10 17:17:55 +00:00
parent 2f95c891fa
commit cd1fc37f25
10 changed files with 133 additions and 56 deletions

View file

@ -153,11 +153,30 @@ async def test_patch_user_scenario(client: AsyncClient) -> None:
assert body["leave_uk_year"] == 2
async def test_patch_cartesian_blocked(client: AsyncClient, session: AsyncSession) -> None:
async def test_patch_cartesian_core_fields_blocked(
client: AsyncClient, session: AsyncSession,
) -> None:
"""Cartesian scenarios reject edits to fields that get rebuilt by
recompute (jurisdiction/strategy/etc), but allow free-form metadata
(config_json/name/description) so users can pin notes + flex_rules."""
cart = await _seed(session)
resp = await client.patch(f"/scenarios/{cart.id}", json={"name": "Renamed"})
assert resp.status_code == 400
assert "cartesian" in resp.json()["detail"]
# Core field — still blocked.
bad = await client.patch(f"/scenarios/{cart.id}",
json={"jurisdiction": "uae"})
assert bad.status_code == 400
assert "cartesian" in bad.json()["detail"]
# config_json and name — allowed (preserves user edits).
ok = await client.patch(
f"/scenarios/{cart.id}",
json={"config_json": {"flex_rules": [{"from_ath_pct": 0.2,
"cut_discretionary_pct": 0.5}]},
"name": "Renamed"},
)
assert ok.status_code == 200, ok.text
assert ok.json()["name"] == "Renamed"
assert ok.json()["config_json"]["flex_rules"][0]["from_ath_pct"] == 0.2
async def test_delete_user_scenario(client: AsyncClient) -> None: