PR: #668: feat(matters): representing_side dropdown at matter creation [Story-2631] by @ankitmaheshwari-com
View PR →

Files changed

43 file(s), +697 / -19 lines

Path Role + -
messages/en.jsonConfig+13-0
messages/hi.jsonConfig+13-0
openapi/app-api.jsonConfig+26-1
src/app/[locale]/(workspace)/matters/actions.tsApp route+5-0
src/components/add-matter/add-matter-drawer-types.tsComponent+14-0
src/components/add-matter/add-matter-drawer.stories.tsxComponent+22-1
src/components/add-matter/add-matter-drawer.tsxComponent+14-0
src/components/add-matter/representing-side-field.stories.tsxComponent+94-0
src/components/add-matter/representing-side-field.tsxComponent+270-0
src/components/add-matter/use-add-matter-drawer-form.tsComponent+31-3
src/components/agents/agent-chat-panel.render.test.tsxComponent+1-0
src/components/agents/agent-dock-mount.render.test.tsxComponent+1-0
src/components/agents/render-catalog/render-catalog.fixtures.tsComponent+2-0
src/components/matter-detail/brief/matter-brief-page.stories.tsxComponent+1-0
src/components/matters/add-matter-launcher.tsxComponent+2-1
src/components/matters/live-matters-wizard-payload.tsComponent+16-7
src/components/matters/matters-live-register-row.stories.tsxComponent+2-0
src/gen/index.tsGenerated contract+5-0
src/gen/schemas/matterCreateRequest.jsonGenerated contract+8-1
src/gen/schemas/matterDetailView.jsonGenerated contract+16-0
src/gen/schemas/matterListItem.jsonGenerated contract+8-0
src/gen/schemas/matterListResponse.jsonGenerated contract+8-0
src/gen/schemas/recordBootstrapResponse.jsonGenerated contract+16-0
src/gen/schemas/representingSide.jsonGenerated contract+7-0
src/gen/types/MatterCreateRequest.tsGenerated contract+6-0
src/gen/types/MatterDetailView.tsGenerated contract+6-0
src/gen/types/MatterListItem.tsGenerated contract+6-0
src/gen/types/RepresentingSide.tsGenerated contract+13-0
src/gen/types/index.tsGenerated contract+4-0
src/gen/zod/index.tsGenerated contract+1-0
src/gen/zod/matterCreateRequestSchema.tsGenerated contract+6-0
src/gen/zod/matterDetailViewSchema.tsGenerated contract+6-0
src/gen/zod/matterListItemSchema.tsGenerated contract+6-0
src/gen/zod/representingSideSchema.tsGenerated contract+17-0
src/lib/agents/__tests__/atlas-rail-store.test.tsLibrary+1-0
src/lib/agents/atlas-rail.test.tsLibrary+1-0
src/lib/agents/dock-render-bridge.test.tsLibrary+1-0
src/lib/matters/optimistic.test.tsLibrary+1-0
src/lib/matters/optimistic.tsLibrary+1-0
tests/unit/live-matters-wizard-payload.test.tsTest+23-5
tests/unit/matter-shell-chrome.test.tsxTest+1-0
tests/unit/matters-contract.test.tsTest+1-0
tests/unit/record-bootstrap-contract.test.tsTest+1-0

Story 2631: Capture who we represent at matter creation

The Add-Matter drawer now permanently captures who our counsel acts for — the durable representing_side orientation from Spike-2628 — as a required dropdown placed directly under Matter Type. It is the single source of truth for Matter Significance: the adversary is derived at render, never stored a second time.

The field

Add-Matter drawer order
  Client → Matter Type → Who we represent → Title

Who we represent (required dropdown)
  • the principal adversarial side   → representing_side = principal
  • the opposing side                → representing_side = opposing
  • Advisory — no single adverse side → representing_side = advisory
  • + Add new participant label       → type a label + pick its side

Single source of truth

On Create, the drawer sends { title, clientId, matterTypeId, representingSide, parties: [us] }. Only the closed enum principal | opposing | advisory is persisted. No adversary or duplicate participant-role is sent — the opposing label is computed at render from the stored side + forum via the existing forumAwareRoleLabel(). A regression test asserts the exact body shape and that parties stays [us].

Forum-aware wording

Forum principal opposing
arbitrationClaimantRespondent
civilPlaintiffDefendant
writPetitionerRespondent
criminal Complainant/Prosecution Accused/Defense
none captured (live drawer) The party bringing the case The responding party

The firm forum venue catalog (ForumView) carries a name, not the MatterForum kind (the ADR-090 split flagged in the design note §2.3), so there is no live source for the forum kind at creation. The field is forum-aware by prop — the Storybook story proves every forum's words — and the live drawer shows neutral wording, with "+ Add new participant label" letting counsel type their own term (Claimant, Petitioner, …) and set the side directly. Advisory is always offered so Matter Significance never manufactures a false for/against (pramaan-docs ADR-175).

Storybook proof

Contract sync

The vendored openapi/app-api.json was synced to pramaan-functions main (Story-2629, PR #729) and pnpm codegen regenerated src/gen. MatterCreateRequest, MatterDetailView, and MatterListItem now carry the required representingSide; fixtures and the optimistic pending row were updated to match.

Locale and tokens

Verification

pnpm lint
pnpm test          # 1418 passed
pnpm build
pnpm check:routes
pnpm check:css-tokens
pnpm storybook:build
git diff --check