Files
citation-evidence/docs/decisions/ADR-0004-pdf-viewer-library.md
tegwick 2f25f99cae Implement CE-WP-0001 Foundations: TS scaffold, lint boundaries, normalize v1, fixtures
T01 Toolchain — vite + pnpm 9.15 + React 18 + strict TS (ADR-0001).
T02 Folder layout — src/{shared,engine,anchor,source,binder,work,app}/
    mirroring the future subsystem split, with path aliases.
T03 Boundary lint — eslint-plugin-boundaries enforcing the dependency
    edges from wiki/DependencyMap.md §4; verified by a violating fixture.
T04 Canonical normalization v1 — src/shared/text/normalize.ts with
    NORMALIZE_VERSION=1; 10/10 vitest covering ligatures, CRLF, soft
    hyphens (including line-break reassembly), mixed whitespace.
T05 PDF fixture corpus — 7 user-supplied German PDFs in fixtures/pdfs/
    (gitignored binaries) plus a manifest with verbatim known-good
    quotes and page counts, ready for CE-WP-0002 selector tests.
T06 README upgrade — umbrella README points at wiki/docs/workplans
    and documents the dev workflow.
T07 ADR-0002..0006 stubs in docs/decisions/.

Toolchain end-to-end: pnpm install + lint + typecheck + test all green.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 00:13:03 +02:00

48 lines
1.7 KiB
Markdown

# ADR-0004 — PDF viewer library for the reference workspace
- Status: proposed
- Date: 2026-05-24
- Workplan: CE-WP-0001-T07 (stub); validated in CE-WP-0002-T02
## Context
The PDF round-trip (select text → store selectors → reload → resolve →
scroll → highlight) is the riskiest architectural assumption in the MVP
(see `history/2026-05-24-initial-assessment.md`). The viewer library must:
- Render PDF.js-backed pages in a React shell.
- Expose stable APIs for programmatic text selection and highlight overlay.
- Not leak its types into `src/shared/` or `src/engine/` (enforced by the
T03 boundary lint rules).
- Survive across versions of PDF.js without trapping us in old versions.
CE-WP-0002-T02 is the spike that validates whichever library we pick. If
the spike fails the success criteria, this ADR is the place to record the
failure and propose an alternative.
## Options
- **A. `react-pdf-highlighter-plus`** *(current assumption)*
- Pros: React-native, opinionated overlay layer, well-tested fixture
coverage in the community.
- Cons: bundles a particular PDF.js version; risk of needing to fork to
get clean adapter boundaries.
- **B. `react-pdf` (the official PDF.js React binding) + custom overlay**
- Pros: thinnest abstraction; we own the overlay layer.
- Cons: significantly more code to write and maintain for selection/
highlight; reinventing PDF.js text-layer interaction.
- **C. PDF.js directly (no React wrapper)**
- Pros: maximum control.
- Cons: highest implementation cost; harder to integrate into the React
composition root.
## Decision
(blank — to be filled by the outcome of CE-WP-0002-T02.)
## Consequences
(blank)