PR: #513: feat(matter): Brief becomes its own route + bare matter redirects [Story-2029] by @ankitmaheshwari-com
View PR →

Files changed

8 file(s), +184 / -129 lines

Path Role + -
src/app/[locale]/(workspace)/matters/[matterId]/brief/page.test.tsxApp route+72-0
src/app/[locale]/(workspace)/matters/[matterId]/brief/page.tsxApp route+70-0
src/app/[locale]/(workspace)/matters/[matterId]/page.test.tsxApp route+9-59
src/app/[locale]/(workspace)/matters/[matterId]/page.tsxApp route+11-59
src/lib/agents/__tests__/client-tool-dispatcher.test.tsLibrary+1-1
src/lib/surface-registry/navigation.test.tsLibrary+2-2
src/lib/surface-registry/route-registry.tsLibrary+1-1
tests/unit/matter-detail-route.test.tsxTest+18-7

Story-2029: Brief becomes its own route + bare matter redirects to Brief

The Brief now has its own real URL — /matters/[matterId]/brief — and the bare matter URL (/matters/[matterId]) never renders naked: it redirects to the Brief route. This continues EPIC-2018 (route-per-mode) on top of the fat layout landed in S1 (Story-2019). The Brief body itself is unchanged.

What moved

Why the redirect resolves through the surface key, not "./brief"

A literal redirect("./brief") resolves relative to the request URL — against /en/matters/42 the browser would land on /en/matters/brief (the last segment is replaced), which is wrong. Instead the page builds the target from the durable surface key: redirect(localizeHref(locale, buildSurfacePath("matter.brief", { matterId }))). That yields /en/matters/42/brief, keeps the locale prefix, and survives any future route change to matter.brief — and obeys the repo rule to navigate by surface_key, never a string-built raw URL.

Tests

Deliberately deferred (not this story)

Verification

pnpm gen:routes + pnpm check:routes (30 surfaces, fresh), pnpm lint (0 errors), pnpm test (1001 passed), and pnpm build are green. The build output shows both /[locale]/matters/[matterId] and /[locale]/matters/[matterId]/brief.