PR: #660: fix(documents): show honest extraction states [Story-2600] by @pramaan-board-bot[bot]
View PR →

Files changed

18 file(s), +723 / -75 lines

Path Role + -
messages/en.jsonConfig+11-0
messages/hi.jsonConfig+11-0
src/app/[locale]/(workspace)/matters/[matterId]/record/doc/[documentId]/page.tsxApp route+1-0
src/app/[locale]/(workspace)/matters/[matterId]/record/doc/[documentId]/text/page.tsxApp route+8-4
src/components/documents/viewer/document-insights-dossier.tsxComponent+8-16
src/components/documents/viewer/document-machine-copy-view.stories.tsxComponent+35-9
src/components/documents/viewer/document-machine-copy-view.test.tsxComponent+124-0
src/components/documents/viewer/document-machine-copy-view.tsxComponent+74-27
src/components/documents/viewer/document-original-pane.stories.tsxComponent+87-0
src/components/documents/viewer/document-original-pane.test.tsxComponent+95-0
src/components/documents/viewer/document-original-pane.tsxComponent+57-13
src/components/documents/viewer/document-permalink-shell.test.tsxComponent+29-2
src/components/documents/viewer/document-permalink-shell.tsxComponent+3-3
src/components/documents/viewer/document-viewer-state.stories.tsxComponent+48-0
src/components/documents/viewer/document-viewer-state.test.tsxComponent+39-0
src/components/documents/viewer/document-viewer-state.tsxComponent+56-0
src/components/documents/viewer/strip-presentation.test.tsComponent+21-1
src/components/documents/viewer/strip-presentation.tsComponent+16-0

Story 2600: Honest Text and Original extraction states

A document still moving through extraction now asks for patience instead of claiming failure. Terminal failures remain visually distinct.

Readiness path

registered / queued / extracting
  → neutral “Still extracting” card
  → current document status shown in the explanation
  → no text-view request while pages do not exist

indexed
  → Text and Anchor views load
  → ready machine copy renders

failed / unreadable / needs review
  → error-toned “Extraction failed” card
  → never presented as ordinary loading

Visible behaviour

State Text lens Original lens
Extraction in progress Shows Still extracting and explains that text appears when the machine finishes reading. The status remains visible. Uses the same neutral readiness pattern while the original is being prepared. No indefinite error-like loading panel is shown.
Terminal failure Shows the error-toned extraction failure card with the terminal status. This is the only error-toned readiness branch.
Ready The existing structured machine copy renders. The PDF renders and supplies its real page total. The strip does not show a pager or / 1 before that total is known.

Reused pattern

The neutral card used by Insights for Not yet read is now the shared DocumentViewerState. Insights, Text, and Original therefore use the same viewer canvas, reading measure, card shape, type, and token-backed tones.

Storybook proof

Locale, tokens, generated code, and routes

Verification

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