fix(ssr): operation handlers read live step-params, not the stale snapshot (rewrite stage 1)

apply-new-account / apply-remove-account / apply-toggle-amount-mode rebuilt the account
rows from the decoded :snapshot, dropping any value the user typed but that had not yet
round-tripped into the snapshot (type 50%, click "New account" -> first row reverts,
giving a 66.67/33.33 split instead of 50/50). Read the live :step-params rows instead
(already schema-decoded by mm/wrap-wizard, so typed), falling back to snapshot only when
absent. First stage of removing the snapshot round-trip; fixes a real user-facing bug
(typed amounts lost on add/remove/$%-toggle).

Restore the percentage-split e2e to the realistic type-then-add ordering as a regression
guard. Modal stays green: swap 6/6, transaction-edit 8/8.
This commit is contained in:
2026-06-03 08:18:58 -07:00
parent 38ad665726
commit 0b5bfd9c84
3 changed files with 32 additions and 25 deletions

View File

@@ -108,13 +108,12 @@ should ride in the form, not a parallel snapshot). It bit the percentage-split e
50% then adding a row reverted the first row to its snapshot value, yielding a 66.67/33.33
split. Two ways it shows up and how to handle until the snapshot is gone:
- **In tests:** order interactions so no whole-form operation runs between typing and the
save (toggle/add/remove *first*, then pick accounts and type, then save). The
account→location and amount→totals swaps are *targeted* (don't rebuild rows), so they're
safe between typing and save.
- **The real fix** (deferred to the wizard→plain-form rewrite): operations read the live
`:step-params` rows (coercing string amounts/ids), or there is no snapshot at all and the
posted form *is* the state.
**Fixed (Stage 1 of the wizard→plain-form rewrite):** the operation handlers now read the
live `:step-params` rows (already schema-decoded by `mm/wrap-wizard`, so typed) and fall
back to the snapshot only when absent — typed values survive add/remove/toggle. The
percentage e2e was restored to the realistic type-then-add ordering as a regression guard.
The *full* removal (no snapshot at all; the posted form *is* the state) is the remaining
rewrite stages.
## Characterization tests rot against table order and removed wizard chrome