PR: #467: feat(documents): Record view real columns + unreadable status + import completeness [Story-1859] by @ankitmaheshwari-com
View PR →
Story-1859

The Record view: real columns, readability status & privilege-off-Record

The matter's evidentiary Record already rendered a rich, sortable register (real columns, saved views, slicer). This story reconciles it to the rest of the document-import substrate: it teaches the status column the new terminal unreadable state, adds the import-completeness honesty line so nothing is silently missing, and reflects that privileged documents live off the Record — they appear only as a completeness drop reason, never as rows.

What changed

New unreadable status

The processing/readability pill learns unreadable (stored, but no extractable text — OCR/encrypted/corrupt). A terminal state needing human action (re-upload a readable copy), so it shares the amber attention palette with needs_review, distinct from the red system failed. Localized in en + hi; the pill keeps its raw-token fallback for any future status.

Import completeness (wired)

ImportCompletenessSummary renders the matter's falsifiable import ledger (functions Story-1855, MatterImportCompletenessResponse): accounted / in-flight / dropped against expected. Green when the V-LEDGER identity holds (isComplete), amber while imports settle, red on a true residual (silent loss). Live via the generated useAppGetMatterImportCompleteness hook.

Privilege off the Record

Privileged documents (privilege_flag) are gated out server-side (consistent with the privilege-marking story #1854), so they never arrive as rows. The Record reflects that by surfacing the excluded count as a privileged drop reason in the completeness ledger — visible, not silent.

ONE list pattern

The completeness ledger follows the canonical pattern: record/page.tsx best-effort prefetches it server-side and seeds the query cache; HydrationBoundary hydrates it warm; the client reads via the generated useAppGetMatterImportCompleteness hook through a new /api/internal/…/imports/completeness BFF proxy (HR-21/HR-22). A ledger blip never 404s the Record.

Contract status (verified against merged main)

Where it lives

Observability

No new instrumentation (pramaan-docs ADR-104 / ADR-065). The summary is presentational and the bootstrap read already traverses src/lib/gateway.ts, which mints/forwards traceparent + x-pramaan-correlation-id — the trace propagates for free. No OTel SDK, spans, or ad-hoc headers added on this surface.

Verify

pnpm lint
pnpm test
pnpm build

Files changed

16 file(s), +523 / -5 lines

Path Role + -
messages/en.jsonConfig+19-0
messages/hi.jsonConfig+19-0
src/app/[locale]/(workspace)/matters/[matterId]/record/page.tsxApp route+23-2
src/app/api/internal/matters/[matterId]/documents/imports/completeness/route.tsApp route+20-0
src/components/documents/register/document-status-pill.stories.tsxComponent+2-0
src/components/documents/register/import-completeness-container.tsxComponent+31-0
src/components/documents/register/import-completeness-summary.stories.tsxComponent+59-0
src/components/documents/register/import-completeness-summary.tsxComponent+101-0
src/components/documents/register/presentation.tsComponent+44-0
src/components/documents/register/register-view.stories.tsxComponent+16-1
src/components/matters/live-matter-documents-page.tsxComponent+2-0
src/lib/documents/gateway.tsLibrary+23-0
src/lib/documents/register/fixtures.tsLibrary+76-0
src/lib/kubb-client.tsLibrary+12-0
src/lib/surface-registry/route-registry.tsLibrary+2-2
tests/unit/import-completeness-contract.test.tsTest+74-0