PR: #352: [Story-1380] Finish Add-Matter stepper: editable Step-5 frame drives create [Bug-1379] by @ankitmaheshwari-com
View PR →
Story 1380 · also Closes Bug 1379

Finish the Add-Matter stepper: the editable Step-5 frame drives matter create

At Step 5, Atlas drafts a Matter Frame; counsel reviews and edits it, then commits. The editable substrate had been built and "verified" — but only in the dev harness. The live wizard still rendered the read-only path and created the matter from the raw Step-2 draft, so Atlas's proposal and every Step-5 edit were silently discarded. This finishes the stepper: the editable frame's "Save & Next" is the single commit, and it creates the matter from what counsel actually sees and edits.

Bug-1379 first: why the frame never even appeared

Wiring the editable frame is moot if it never settles. Step 5 hung in the skeleton because of a wire contract mismatch, not StrictMode (the rail was healthy). The brain (runtime.py::_turn_event → _wrap_proposal) puts the proposal on the wire as a nested object — turn.proposal.{description, core_dispute, prayers, value_amount_minor} plus the truth-boundary envelope. But the app's proposalFromWire (src/lib/agents/atlas-rail.ts) read them flat (turn.proposal_description). The #85 flatten only flattened the brain's generation DTO; the wire AtlasTurn still nests.

Fix: proposalFromWire reads the nested proposal. The rail tests were rewritten to the real nested wire shape — they were green before only because they mirrored the app's wrong assumption ("fixtures lie in your favor").

The gap: done at the component boundary, not the system boundary

SurfaceBeforeAfter
Step 5 renderread-only (live wizard never passed editableSnapshot)editable substrate once Atlas settles
Commitchrome footer "Save & create" on raw Step-2 framesubstrate "Save & Next" on the edited frame (one button)
What gets createdAtlas's proposal + edits discardededited narrative / value / type / forum reach create

The wiring

Edit-now, persist-later decided

prayers, proceeding / filing types, the separate coreDispute, and party renames are editable but NOT sent to create — WizardMatterInput has no field for them yet (same precedent as the Team step, which already isn't persisted). A backend follow-up.

The proof: the full chain, tested two ways

wire turn.completed (nested proposal) → turnFromWire (Bug-1379 hop) → toEditableMatterFrame → counsel EDITS description + value → commitPayloadFromEditableFrame → wizardCreateInputFromPayload → WizardMatterInput (coreDisputeText = the EDITED text)

Files

FileChange
src/lib/agents/atlas-rail.tsBug-1379: read the nested wire proposal
src/components/add-matter/editable-frame-commit.tsnew — edited frame → create payload
src/components/add-matter/add-matter-wizard.tsxwire editableSnapshot + options + onCommit; showNext
src/components/add-matter/add-matter-chrome.tsxshowNext flag (one commit button)
*.test.ts (rail, mapper, chain)nested wire fixtures + mapper + full-chain integration

Files changed

8 file(s), +427 / -48 lines

Path Role + -
src/components/add-matter/add-matter-chrome.tsxComponent+14-8
src/components/add-matter/add-matter-wizard.tsxComponent+47-6
src/components/add-matter/edit-to-create-chain.test.tsComponent+121-0
src/components/add-matter/editable-frame-commit.test.tsComponent+107-0
src/components/add-matter/editable-frame-commit.tsComponent+82-0
src/lib/agents/__tests__/atlas-rail-store.test.tsLibrary+4-4
src/lib/agents/__tests__/atlas-rail.test.tsLibrary+21-11
src/lib/agents/atlas-rail.tsLibrary+31-19