refactor(ssr): Phase 10 — migrate Client wizard onto the engine (7 steps + bank-account sub-editor)

The largest SSR modal, moved off the mm/* multi-step wizard protocol machinery
(ClientWizard/*Modal records, MultiStepFormState, fc/* form-cursors, EDN-snapshot
round-trip) onto the session-backed engine (wizard2 + wizard-state): flat de-cursored
field names, whole-form HTMX swaps, per-step session state combined by the done-fn.

Seven linear steps (info → matches → contact → bank-accounts → integrations → cash-flow
→ other-settings), each a data-driven {:decode :validate :render :next}. The grid, form
schemas, and the sales power-query export are preserved unchanged.

The parameterized [:bank-account which] mm sub-step (which the linear engine can't model)
becomes a sub-editor of the bank-accounts step: the list view and per-account editor are
whole-form swaps of #wizard-form, driven by dedicated routes (new/edit/accept/discard/
sort) that mutate the :bank-accounts step-data in the session directly and re-render via
the engine's render-wizard. The bank-accounts step's :decode is a pass-through that
re-affirms the session-managed list (read via a `wiz` hidden the engine doesn't strip),
so Next never wipes it.

Notable fixes carried over from prior phases:
- New vs edit is keyed off :db/id presence (the engine always POSTs, so the old PUT/POST
  split no longer distinguishes them).
- Client + bank-account dates are coerced to #inst for EDN-safe session storage
  (clj-time DateTime has no cookie-session reader).
- An empty Contact-step address posts blank fields → decodes to an all-nil, db/id-less
  map; blank-address? drops it before upsert (else datomic: "tempid used only as value").

Routes: drop ::navigate/::discard; add the four bank-account sub-editor routes.
Full e2e suite green (71/71); client-wizard acceptance spec rewritten for the engine
(flat field names, data-primary nav, bank-account open/accept/discard sub-flows).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 00:49:56 -07:00
parent b0fe7cc70d
commit 7b0e8bfd65
3 changed files with 833 additions and 1211 deletions

View File

@@ -4,9 +4,6 @@
:post ::save}
"/table" ::table
"/navigate" ::navigate
"/bank-accounts/sort" ::sort-bank-accounts
"/discard" ::discard
"/square-locations" ::refresh-square-locations
"/location/new" ::new-location
@@ -15,6 +12,13 @@
"/email-contact/new" ::new-email-contact
"/group/new" ::new-group
"/feature-flag/new" ::new-feature-flag
"/bank-account/new" ::new-bank-account
"/bank-account/edit" ::edit-bank-account
"/bank-account/accept" {:post ::accept-bank-account}
"/bank-account/discard" ::discard-bank-account
"/bank-accounts/sort" ::sort-bank-accounts
"/new" {:get ::new-dialog}
["/" [#"\d+" :db/id] "/sales-powerquery"] ::biweekly-sales-powerquery
["/" [#"\d+" :db/id] "/edit"] ::edit-dialog})