PR: #349: [Story-1360] Mirror flat Atlas contract — prayers[] + approximate value
by @ankitmaheshwari-com
View PR →
Story 1360
Mirror the flat Atlas contract in app — prayers[] + approximate value
pramaan-agents #85 (Story-1359) flattened the Atlas generation
contract. The brain now emits a flat AtlasFrameOutput: no
proposal.refined.* nesting,
reliefSought{principal,interest,costs} collapsed into a
flat prayers: list[str], and value reduced to an
approximate value_amount_minor + value_currency
(the basis tag is gone). The Step-5 editable Matter Frame
still read the old nested shape, so live staging Atlas review was broken.
This change brings the app's hand-owned mirror in line (no
src/gen codegen — these Atlas wire types are hand-owned per
the TODO in step5-review-form.tsx).
The wire + UI types went flat
-
atlas-types.ts—MatterFrameProposaldropped itsrefined{}envelope. It now carriescoreDispute,proceedingType,prayers: string[], and a flatvalue: { currency, amountMinor } | null. TheValueBasisunion andreliefSought/valueAtStake.basisare deleted.understanding/summarystay (UI-derived fromproposal_description). -
atlas-rail.ts— the broker wire shape collapsed to one flatWireTurn(theAtlasFrameOutputfields live directly on the turn payload).proposalFromWireis a flat pass-through: it returnsnulluntil Atlas authors aproposal_description, then maps the flat fields straight across — filtering null/blank prayers and pairingvalue_currency+value_amount_minor.
The editable draft + its controls
-
matter-frame-draft-store.ts—EditableReliefis gone; the frame holdsprayers: string[].EditableValuedroppedbasis. The persisted store bumped toversion: 2with amigratethat flattens an oldrelief{…}draft intoprayersand stripsvalue.basis— so a stale localStorage draft never reads a missing field (HR-23). -
editable-matter-frame.tsx— the structured principal/interest/costs/ancillary grid became a singleEditableChipsfor prayers (add 1..n, remove each). The value row lost the basis pen-select; it is now currency + amount only. TheEditableFrameLabelsshrank to match. -
to-editable-matter-frame.ts+ theeditable-review-substrate.tsxlabel map were rewritten to the flat shape (theVALUE_BASESoption list andbasisOptionsprop are removed).
Read-only review + i18n
-
step5-review-form.tsx— the read paths moved fromrefined?.xto flatproposal.x. Prayers now render as a bulleted list inside the sharedReviewFieldCard;ValueAtStakeCardrenders amount only (no basis pill). The supersededrelief-sought-card.tsx(a principal/interest/costs grid) and its story were deleted — no other importers. -
i18n —
reliefSoughtLabel→prayersLabel("Prayers" / "प्रार्थनाएँ"). The now-unusedreliefPrincipal/reliefInterest/reliefCosts/reliefAncillary,valueBasisLabel, and thevalueBasis{}map were removed from bothmessages/en.jsonandmessages/hi.json.
Old shape → new shape
| Old (nested) | New (flat) |
|---|---|
proposal.refined.coreDispute |
proposal.coreDispute |
proposal.refined.reliefSought{principal,interest,costs} |
proposal.prayers: string[] |
proposal.refined.valueAtStake{currency,amountMinor,basis} |
proposal.value{currency,amountMinor} (no basis) |
proposal.refined.proceedingType |
proposal.proceedingType |
Acceptance criteria
-
MatterFrameProposalflat;reliefSought/refined/valueAtStake.basisremoved. met -
proposalFromWireflat pass-through. met -
Store:
relief{…}→prayers: string[]; value dropsbasis. met -
Editable frame: prayers via
EditableChips; value = amount + currency only. met -
to-editable-matter-frame.ts+step5-review-form.tsxread flat. met -
i18n relief* → prayers;
valueBasis*dropped in en + hi. met - Live staging end-to-end needs the sibling broker flatten (pramaan-functions #1361) deployed too — this PR ships + verifies the app layer (types compile, render correct, Storybook). app layer verified
Verification
-
pnpm exec tsc --noEmitclean against the flat types. -
pnpm lint0 errors (3 pre-existing add-matter warnings, untouched files). -
pnpm test533 passed — including the rewrittenatlas-rail.test.tsasserting the flatprayers+valuemapping. pnpm buildpassed.git diff --checkclean.-
Storybook:
AddMatter/Step5/EditableMatterFrameandStep5ReviewFormrender the prayers chips + amount-only value against flat fixtures.
Files changed
15 file(s), +146 / -319 lines
| Path | Role | + | - |
|---|---|---|---|
| messages/en.json | Config | +1 | -12 |
| messages/hi.json | Config | +1 | -12 |
| src/components/add-matter/step5-review/__mocks__/atlas-turns.ts | Component | +9 | -15 |
| src/components/add-matter/step5-review/atlas-types.ts | Component | +14 | -13 |
| src/components/add-matter/step5-review/build-stub-turn.ts | Component | +6 | -9 |
| src/components/add-matter/step5-review/editable-matter-frame.stories.tsx | Component | +7 | -13 |
| src/components/add-matter/step5-review/editable-matter-frame.tsx | Component | +9 | -49 |
| src/components/add-matter/step5-review/editable-review-substrate.tsx | Component | +2 | -20 |
| src/components/add-matter/step5-review/relief-sought-card.stories.tsx | Component | +0 | -24 |
| src/components/add-matter/step5-review/relief-sought-card.tsx | Component | +0 | -34 |
| src/components/add-matter/step5-review/step5-review-form.tsx | Component | +15 | -21 |
| src/components/add-matter/step5-review/to-editable-matter-frame.ts | Component | +11 | -18 |
| src/lib/agents/__tests__/atlas-rail.test.ts | Library | +22 | -17 |
| src/lib/agents/atlas-rail.ts | Library | +27 | -49 |
| src/stores/matter-frame-draft-store.ts | Source | +22 | -13 |