PR: #659: [Story-2596] Gate Insights until Deep Read is ready by @pramaan-board-bot[bot]
View PR →

Files changed

14 file(s), +329 / -43 lines

Path Role + -
messages/en.jsonConfig+2-0
messages/hi.jsonConfig+2-0
src/app/[locale]/(workspace)/matters/[matterId]/record/doc/[documentId]/insights/page.test.tsxApp route+99-0
src/app/[locale]/(workspace)/matters/[matterId]/record/doc/[documentId]/insights/page.tsxApp route+8-7
src/app/[locale]/(workspace)/matters/[matterId]/record/doc/[documentId]/layout.tsxApp route+28-3
src/components/documents/viewer/document-insights-dossier.stories.tsxComponent+1-1
src/components/documents/viewer/document-permalink-shell.test.tsxComponent+2-7
src/components/documents/viewer/document-permalink-shell.tsxComponent+9-1
src/components/documents/viewer/document-strip.stories.tsxComponent+21-1
src/components/documents/viewer/document-strip.test.tsxComponent+75-0
src/components/documents/viewer/document-strip.tsxComponent+51-9
src/lib/documents/deep-read-errors.test.tsLibrary+16-7
src/lib/documents/deep-read-errors.tsLibrary+4-7
src/lib/documents/get-anchor-view.tsLibrary+11-0

Story 2596: Gate Insights until Deep Read is ready

Insights remains discoverable in the document lens strip, but it is not a destination until the document's current extraction has a completed Deep Read envelope.

Availability path

document route layout
  → current Anchor view supplies extractionVersion
  → exact-version Deep Read envelope succeeds
  → Insights renders as a link

no extraction or no envelope
  → Insights stays visible, greyed, and non-navigable
  → “Available after Deep Read” explains why

availability check fails unexpectedly
  → Original and Text stay usable
  → Insights says it is temporarily unavailable

Visible behaviour

State Result
Completed Deep Read envelope Insights is enabled and navigates to the routed Insights lens.
No completed envelope Insights is a token-coloured disabled element with no href, a not-allowed cursor, and the translated readiness hint.
Defensive direct visit Typed no-extraction and no-envelope 404s render THE DEEP READ — Not yet read. Authentication, transport, and server failures remain real errors.
Availability service failure Insights remains disabled but uses the truthful temporary-unavailable hint instead of claiming that no Deep Read exists.
Original and Text Their routes and existing availability behaviour are unchanged.

Regression evidence

Digest 552518606 was traced to typed 404 pramaan.document.view_not_found before the envelope request. The route now treats that exact no-extraction result, and only the existing pramaan.deep_read.envelope_not_found result, as not ready.

Storybook proof

Locale, tokens, and routes

Verification

pnpm lint
pnpm test
pnpm build
pnpm check:routes
pnpm storybook:build
git diff --check