The app no longer asks the legacy page-block endpoint to serve either document-reading lens. Text reads the Text view; shared paragraph anchors and Original geometry read the Anchor view. There is no dual read or fallback.
| Surface | Generated client | Browser proxy | Upstream |
|---|---|---|---|
| Text lens | useAppGetDocumentTextView |
/api/internal/documents/:id/views/text |
/app/documents/:id/views/text |
| Original geometry and paragraph anchors | useAppGetDocumentAnchorView |
/api/internal/documents/:id/views/anchors |
/app/documents/:id/views/anchors |
Both server gateway methods fetch unknown JSON and validate it with
generated schemas before the browser receives it. The existing
document-wide
toBrowserRoute mapping covers both new paths.
Text View is the full current text projection. Anchor View carries the
block boundaries, bounding boxes, confidence, character offsets, and
opaque
anchorId values needed to preserve the structured reading
surface. The app combines them only when document id, extraction version,
page count, exact ordered block bytes, and anchor uniqueness agree.
Rendered row text is sliced from Text View; Anchor View supplies only
structure and metadata. A mismatch shows the existing load error and never
falls back to the old endpoint.
?page=N still scrolls and clamps against PDFJS page count.
Anchor View supplies only the overlay geometry on the landed page, so a
sparse extraction cannot incorrectly shorten the Original.
60 file(s), +3918 / -70 lines
| Path | Role | + | - |
|---|---|---|---|
| openapi/app-api.json | Config | +594 | -0 |
| openapi/permission-map.json | Config | +27 | -0 |
| src/app/[locale]/(workspace)/matters/[matterId]/record/doc/[documentId]/layout.tsx | App route | +15 | -9 |
| src/app/[locale]/(workspace)/matters/[matterId]/record/doc/[documentId]/text/page.tsx | App route | +18 | -3 |
| src/app/api/internal/documents/[docId]/views/anchors/route.ts | App route | +7 | -0 |
| src/app/api/internal/documents/[docId]/views/text/route.ts | App route | +7 | -0 |
| src/components/documents/viewer/document-machine-copy-view.stories.tsx | Component | +128 | -0 |
| src/components/documents/viewer/document-machine-copy-view.tsx | Component | +26 | -9 |
| src/components/documents/viewer/document-machine-copy.stories.tsx | Component | +25 | -14 |
| src/components/documents/viewer/document-machine-copy.tsx | Component | +7 | -2 |
| src/components/documents/viewer/machine-copy-presentation.test.ts | Component | +27 | -0 |
| src/components/documents/viewer/machine-copy-presentation.ts | Component | +18 | -4 |
| src/components/documents/viewer/section-fixtures.ts | Component | +51 | -17 |
| src/components/documents/viewer/use-document-gutters.ts | Component | +17 | -9 |
| src/gen/client/appGetDocumentAnchorView.ts | Generated contract | +63 | -0 |
| src/gen/client/appGetDocumentModelView.ts | Generated contract | +66 | -0 |
| src/gen/client/appGetDocumentTextView.ts | Generated contract | +63 | -0 |
| src/gen/client/index.ts | Generated contract | +3 | -0 |
| src/gen/hooks/index.ts | Generated contract | +24 | -0 |
| src/gen/hooks/useAppGetDocumentAnchorView.ts | Generated contract | +127 | -0 |
| src/gen/hooks/useAppGetDocumentAnchorViewSuspense.ts | Generated contract | +126 | -0 |
| src/gen/hooks/useAppGetDocumentModelView.ts | Generated contract | +133 | -0 |
| src/gen/hooks/useAppGetDocumentModelViewSuspense.ts | Generated contract | +136 | -0 |
| src/gen/hooks/useAppGetDocumentTextView.ts | Generated contract | +127 | -0 |
| src/gen/hooks/useAppGetDocumentTextViewSuspense.ts | Generated contract | +125 | -0 |
| src/gen/index.ts | Generated contract | +117 | -0 |
| src/gen/schemas/anchorBlockView.json | Generated contract | +90 | -0 |
| src/gen/schemas/anchorBoundingBoxView.json | Generated contract | +37 | -0 |
| src/gen/schemas/anchorPageView.json | Generated contract | +110 | -0 |
| src/gen/schemas/anchorViewResponse.json | Generated contract | +136 | -0 |
| src/gen/schemas/modelViewBudgetProfile.json | Generated contract | +7 | -0 |
| src/gen/schemas/modelViewResponse.json | Generated contract | +45 | -0 |
| src/gen/schemas/textViewResponse.json | Generated contract | +32 | -0 |
| src/gen/types/AnchorBlockView.ts | Generated contract | +55 | -0 |
| src/gen/types/AnchorBoundingBoxView.ts | Generated contract | +40 | -0 |
| src/gen/types/AnchorPageView.ts | Generated contract | +25 | -0 |
| src/gen/types/AnchorViewResponse.ts | Generated contract | +29 | -0 |
| src/gen/types/AppGetDocumentAnchorView.ts | Generated contract | +75 | -0 |
| src/gen/types/AppGetDocumentModelView.ts | Generated contract | +80 | -0 |
| src/gen/types/AppGetDocumentTextView.ts | Generated contract | +69 | -0 |
| src/gen/types/ModelViewBudgetProfile.ts | Generated contract | +13 | -0 |
| src/gen/types/ModelViewResponse.ts | Generated contract | +39 | -0 |
| src/gen/types/TextViewResponse.ts | Generated contract | +33 | -0 |
| src/gen/types/index.ts | Generated contract | +48 | -0 |
| src/gen/zod/anchorBlockViewSchema.ts | Generated contract | +46 | -0 |
| src/gen/zod/anchorBoundingBoxViewSchema.ts | Generated contract | +38 | -0 |
| src/gen/zod/anchorPageViewSchema.ts | Generated contract | +29 | -0 |
| src/gen/zod/anchorViewResponseSchema.ts | Generated contract | +32 | -0 |
| src/gen/zod/appGetDocumentAnchorViewSchema.ts | Generated contract | +96 | -0 |
| src/gen/zod/appGetDocumentModelViewSchema.ts | Generated contract | +100 | -0 |
| src/gen/zod/appGetDocumentTextViewSchema.ts | Generated contract | +88 | -0 |
| src/gen/zod/index.ts | Generated contract | +42 | -0 |
| src/gen/zod/modelViewBudgetProfileSchema.ts | Generated contract | +17 | -0 |
| src/gen/zod/modelViewResponseSchema.ts | Generated contract | +34 | -0 |
| src/gen/zod/textViewResponseSchema.ts | Generated contract | +29 | -0 |
| src/lib/documents/gateway-views.test.ts | Library | +76 | -0 |
| src/lib/documents/gateway.ts | Library | +50 | -3 |
| src/lib/documents/view-adapter.test.ts | Library | +95 | -0 |
| src/lib/documents/view-adapter.ts | Library | +79 | -0 |
| tests/unit/lib/kubb-client.test.ts | Test | +27 | -0 |
The two HTTP routes reuse the existing instrumented document proxy/gateway boundary (automatic HTTP tracing). The view adapter is a pure in-process helper and is instrumentation-exempt under pramaan-docs ADR-124.