[Story-1006] Redesign Matter Configuration around Matter Templates

Story 1006Epic 995๐Ÿ“œ The Evidentiary RecordMatter Intelligence55 files ยท +952/โˆ’319

PR #214 ยท pramaan-io/pramaan-app ยท merged 2026-06-03

How it flows

sequenceDiagram
  autonumber
  participant browser as Browser
  participant router as App Router
  participant gateway as Gateway
  participant storybook as Storybook
  browser->>router: open settings
  router->>router: matter-types โ†’ matter-templates redirect
  router->>gateway: fetch MatterTemplate contracts
  gateway->>router: validate contract schema
  router->>browser: render detail page
  storybook->>storybook: fixtures use new vocabulary

Kya nahi tootega

Old matter-types URLs redirect cleanly to matter-templates
Templates are snapshots โ€” no live mutation can corrupt them
Gateway rejects malformed contracts before they reach the page
System vs firm-owned boundary is explicit in types and mocks
Storybook and tests share the new vocabulary โ€” no stale fixtures
Matters created before the rename keep their original type metadata โ€” they don't retro-template

Files changed (55)

Fileยฑ
docs/visual-verification/story-1006/README.md+15
docs/visual-verification/story-1006/matter-templates-storybook.png+0
docs/walkthroughs/story-1006-walkthrough.html+226
src/app/[locale]/(app)/settings/catalogs/procedure-templates/page.tsx+3 โˆ’1
src/app/[locale]/(app)/settings/matter-configuration/matter-templates/[matterTemplateId]/page.tsx โ˜…+76
src/app/[locale]/(app)/settings/matter-configuration/matter-templates/page.tsx+64
src/app/[locale]/(app)/settings/matter-configuration/matter-types/[matterTypeId]/page.tsx+5 โˆ’55
src/app/[locale]/(app)/settings/matter-configuration/matter-types/page.tsx+5 โˆ’51
src/app/api/internal/matter-templates/route.ts+24
src/components/settings/matter-types/filing-type-attach-sheet-header.tsx+1 โˆ’1
src/components/settings/matter-types/filing-type-attaches-page.stories.tsx+2 โˆ’2
src/components/settings/matter-types/filing-type-attaches-story-header.tsx+4 โˆ’5
src/components/settings/matter-types/filing-type-attaches-story-surface.tsx+1 โˆ’1
src/components/settings/matter-types/filing-type-detach-dialog.tsx+2 โˆ’3
src/components/settings/matter-types/matter-type-add-sheet.tsx+1 โˆ’1
src/components/settings/matter-types/matter-type-clone-sheet.tsx+3 โˆ’3
src/components/settings/matter-types/matter-type-detail-content.tsx โ˜…+98 โˆ’21
src/components/settings/matter-types/matter-type-form-model.ts+1 โˆ’1
src/components/settings/matter-types/matter-type-overview.tsx+37 โˆ’14
src/components/settings/matter-types/matter-type-sheet-header.tsx+4 โˆ’4
src/components/settings/matter-types/matter-type-sheet-parts.tsx+1 โˆ’1
src/components/settings/matter-types/matter-type-source-pill.tsx+6 โˆ’2
src/components/settings/matter-types/matter-types-error.tsx+1 โˆ’1
src/components/settings/matter-types/matter-types-list-content.tsx+6 โˆ’6
src/components/settings/matter-types/matter-types-list-parts.tsx+4 โˆ’4
src/components/settings/matter-types/matter-types-list-row.tsx+14 โˆ’15
src/components/settings/matter-types/matter-types-list-table.tsx+5 โˆ’5
src/components/settings/matter-types/matter-types-page.stories.tsx+1 โˆ’1
src/components/settings/matter-types/matter-types-story-surface.tsx+1 โˆ’1
src/components/settings/matter-types/participant-label-form-model.ts+1 โˆ’1
src/components/settings/matter-types/participant-label-sheet-header.tsx+1 โˆ’1
src/components/settings/matter-types/participant-labels-page.stories.tsx+2 โˆ’2
src/components/settings/matter-types/participant-labels-story-header.tsx+4 โˆ’4
src/components/settings/matter-types/participant-labels-story-surface.tsx+1 โˆ’1
src/components/settings/matter-types/presentation.ts+52 โˆ’19
src/components/settings/matter-types/proceeding-remove-dialog.tsx+1 โˆ’1
src/components/settings/matter-types/proceeding-sheet-header.tsx+1 โˆ’1
src/components/settings/matter-types/proceedings-page.stories.tsx+2 โˆ’2
src/components/settings/matter-types/proceedings-presentation.ts+1 โˆ’1
src/components/settings/matter-types/proceedings-story-content.tsx+1 โˆ’1
src/components/settings/matter-types/proceedings-story-header.tsx+1 โˆ’1
src/components/settings/matter-types/proceedings-story-surface.tsx+1 โˆ’1
src/components/settings/matter-types/proceedings-table-parts.tsx+1 โˆ’1
src/components/settings/matter-types/story-fixtures.ts+15 โˆ’9
src/components/settings/settings-shell.stories.tsx+3 โˆ’3
src/components/settings/settings-sidebar.tsx+2 โˆ’2
src/lib/kubb-client.ts+1
src/lib/matter-templates/gateway.ts+65
src/lib/matter-templates/mocks.ts โ˜…+100
src/lib/matter-templates/types.ts+7
tests/e2e/matter-types.spec.ts+9 โˆ’9
tests/unit/lib/kubb-client.test.ts+2 โˆ’2
tests/unit/matter-types-content.test.tsx+23 โˆ’18
tests/unit/matter-types-contract.test.ts+40 โˆ’36
tests/unit/matter-types-internal-route.test.ts+4 โˆ’4