SSR modernization: ssr-form-migration skill + Transaction Edit plain-form/Selmer migration #14

Open
notid wants to merge 21 commits from integreat-execute-refactor into staging
2 changed files with 23 additions and 4 deletions
Showing only changes of commit a7ccdb12f3 - Show all commits

View File

@@ -83,6 +83,19 @@ validation re-render; a `#error {…}` stack means a 500. Then serialize the for
before save (`new FormData(document.querySelector('#wizard-form'))`) to see exactly what
posts. This is how the `:mode` 500 and the empty-account bugs above were isolated.
## De-faking a cursor is not a drop-in — `with-field-default` mutates
Tempting fix for a faked deep cursor (`with-cursor` + synthetic `MapCursor` at index 0):
replace it with `(fc/with-field-default 0 {})` to advance naturally. **It broke the
simple-mode swap** (`transaction-edit-swap` test 1 threw). `with-field-default` calls
`cursor/transact!` — it *mutates the form cursor* (assoc-ing the default row) as a render
side effect, which changes simple-mode behavior. The read-only synthetic `MapCursor` did
not. Lesson: removing a faked cursor on these modals is **not** a one-liner — it's part of
the larger render-fn extraction (render the row from explicit data, construct field names
directly, look up errors explicitly), done when the simple/advanced rows are reworked into
pure render fns / Selmer. Don't swap one cursor primitive for another and assume parity;
verify against the swap spec, and expect the de-fake to come with the render-fn rewrite.
## Scorecard exceptions (ratchet violations with a reason)
_None yet._ Append here if a migration must let a metric regress for a documented reason.

View File

@@ -39,8 +39,14 @@ Each migration appends one row (after-numbers), referencing the before in the di
| Phase | Modal | LOC | Routes | no-cursor twins | faked roots | snapshot merges | OOB | mixed hx- | cookbook reused / added |
|-------|-------|-----|--------|-----------------|-------------|-----------------|-----|-----------|-------------------------|
| 1 (baseline) | Transaction Edit `transaction/edit.clj` | 1608 | ~12 | 1 | 2 | ~75 | 0 | 8 | — / seeded 7 entries |
| 2 (in progress) | Transaction Edit `transaction/edit.clj` | 1555 | ~12 | **0** | 2 | ~75 | 0 | 8 | — / 0 |
> Phase 1 is distillation only — no app code changed. The Transaction Edit row is the
> **before** baseline that Phase 2 must beat (target: routes → ~3, no-cursor → 0, faked
> roots → 0, snapshot merges → 0, LOC ↓, mixed hx- → 0). The `0` OOB is already achieved
> by the merged reference and must not regress.
> **Phase 2 progress (partial).** Achieved with parity held (swap spec 6/6 + Shared
> Location green): deleted the dead `*-no-cursor*` twin (no-cursor 1→0, 53 LOC) and fixed
> a real production bug (`:mode` leaking into the upsert → 500 on every advanced manual
> save). **Still open** for this modal — and intentionally *not* forced under parity risk:
> faked cursor roots (2 — de-faking needs the render-fn rewrite, see `gotchas.md`), the
> snapshot round-trip (~75 — removed by the wizard→plain-form reclassification), Selmer
> conversion of the render fns, and route collapse (~12 → ~3). These are the bulk of the
> modal migration and require restructuring the modal's rendering wholesale rather than
> isolated edits; track as the continuation of Phase 2.