diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b01285..8db6f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ This file records what changes **in the product** – process and session state ## [Unreleased] +### Added +- The review page shows the original PDF page beside the values, with the place the AI read a value from + highlighted; selecting another value (mouse or keyboard) moves the highlight. Uncertain, missing and + unverified values say why in plain language (e.g. "Kalenderwoche ohne Datum"). The page is rendered in the + browser with pdf.js from the protected document download – no third-party request (#74, ADR-0002). The + review sample now comes with its position list as a PDF. + ### Changed - Request list leads with the next work decision: customer, need for review (the same count as the detail page) and the next action ("Prüfen", "Duplikat entscheiden", "Fehler ansehen", "Export läuft"); attempts, last diff --git a/docs/decisions/ADR-0002-pdf-page-view.md b/docs/decisions/ADR-0002-pdf-page-view.md new file mode 100644 index 0000000..0655758 --- /dev/null +++ b/docs/decisions/ADR-0002-pdf-page-view.md @@ -0,0 +1,52 @@ +# ADR-0002 · Original PDF page in the review screen: pdf.js in the browser + +- **Status:** Accepted – decided by the orchestrator on 2026-09-28 in #74 +- **Date:** 2026-09-28 +- **Context issue:** #74 (showcase review 2026-09-27, P1 item 2; epic #19) +- **Relates to:** ADR-0001 D5 (originals only through the tenant-checked route), D8 (grounding, stored bounding boxes) + +## Context + +The review screen shows a value's source as text in reading order with the cited segment marked +(#8, #25). For PDFs the AI service already stores the cited segment's page and bounding box +(`PdfLocator.bbox`, PDF points, origin top-left); #8 left the rendered view as "decision needed". +The showcase review asked for the original page beside the values so a visitor sees within a minute +that every value can be checked against the original. + +Constraints: originals are read only through `GET /api/documents/:id` (tenant-checked, private +bucket, no public URLs); no third-party requests from the review screen; the AI service stays +stateless and never gets storage credentials (D8); the web app runs on Vercel Hobby (D11). + +## Options + +| Option | + | − | +|---|---|---| +| **A · pdf.js (`pdfjs-dist`) in the browser** | renders the exact original from the existing route; bbox → overlay is a percentage of the page; no server cost; Apache-2.0; widely used, maintained by Mozilla | new dependency (~35 MB unpacked in `node_modules`, the page loads it lazily); a worker file must be served by the app | +| B · server-side page image (pdfium in the AI service or a Node renderer) | no PDF code in the browser | the AI service would need the original bytes again per view or storage access (breaks D8 statelessness) or the web runtime needs a native renderer; extra CPU per page view; images must be cached and tenant-scoped | +| C · the browser's own PDF viewer (`