Skip to content

feat: add Scient PDF reader - #34

Merged
yaacovcorcos merged 2 commits into
mainfrom
feat/scient-pdf-reader-20260810
Aug 9, 2026
Merged

yaacovcorcos merged 2 commits into
mainfrom
feat/scient-pdf-reader-20260810

Conversation

@yaacovcorcos

Copy link
Copy Markdown
Contributor

User effect

Scient now opens PDFs directly in the side panel from the Files tree, file search, chat links, and other file-entry paths. The reader supports large files through byte-range loading, fast progressive search, selectable/copyable text, internal and safe external links, password-protected files, page navigation, 5% zoom controls, trackpad pinch zoom, thumbnails, outlines, and saving a copy.

This fixes the existing path where Files-tree selection treated PDFs as text and failed with WorkspaceBinaryFileError. The server's binary-file protection remains intact.

Architecture and upstream boundary

  • Keeps the PDF experience in Scient-owned code under apps/web/src/scient/pdf.
  • Uses narrow changes to T3-derived file-opening and preview seams; HTML and other browser-preview behavior remains unchanged.
  • Uses exact, short-lived asset capabilities with GET, HEAD, and byte-range responses rather than broad workspace access.
  • Pins PDF.js 6.2.108 and bundles its worker, support assets, and license locally.
  • Preserves document view state when an expired capability is renewed and rejects stale capabilities when the underlying PDF changes.
  • Restricts PDF-provided external links to HTTP(S) and routes them through the existing external-launch path.

Scope

  • Base: 79835d70eed47265db46c950d6d07f0b5fd0dad1
  • Head: d45a4e3dfdcab450c4921cd140e5f2969ff97cc5
  • One feature commit; 35 files changed, 2,697 additions, 78 deletions.
  • No OCR, Scient annotation system, cloud synchronization, or server binary-policy weakening.

Verification

  • pnpm --filter @t3tools/web test: 237 files / 2,116 tests passed.
  • Focused server asset/range suite: 3 files / 26 tests passed.
  • Web typecheck, full lint, formatting check, git diff --check, and production web build passed.
  • Production build contains the local PDF.js license and required support assets.
  • The repository's full server typecheck continues to report pre-existing unrelated Effect diagnostics; the touched server behavior is covered by the focused passing tests above.

Yaacov manually exercised the reader, including a very large PDF, and confirmed the general reader and improved search behavior. This remains a draft pending final manual acceptance of the last keyboard-search navigation and PDF-only browser-button removal. No browser automation, screenshot comparison, geometry testing, visual-regression testing, or automated manual acceptance was performed.

Overlap and dependencies

This PR is independently mergeable from main. Draft PR #30 also touches FilePreviewPanel.tsx and docs/README.md for Markdown/HTML preview policy; the features are independent, but the later branch may need a small conflict resolution depending on merge order.

Rollback

Revert the single feature commit. Existing non-PDF file-opening paths and the server's binary-file protection remain available independently.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL labels Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 11.3 KiB 11.3 KiB +1 B (+0.0%) 15.1 KiB ✅
Codex Thread snapshot wire 5.5 KiB 5.5 KiB +1 B (+0.0%) 7.3 KiB ✅
Codex Live turn WebSocket wire 5.9 KiB 5.9 KiB 0 B (0.0%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 49.7 KiB 49.7 KiB 0 B (0.0%) 66.4 KiB ✅
Codex Live turn messages 16 16 0 (0.0%) 21 ✅
Claude Total thread wire 11.4 KiB 11.3 KiB −15 B (−0.1%) 15.1 KiB ✅
Claude Thread snapshot wire 5.5 KiB 5.5 KiB −1 B (−0.0%) 7.3 KiB ✅
Claude Live turn WebSocket wire 5.9 KiB 5.8 KiB −14 B (−0.2%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 50.6 KiB 50.6 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 16 16 0 (0.0%) 21 ✅

Baseline: 79835d7 · PR result: 047a069 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 94.6 KiB
  • Claude decoded thread snapshot: 95.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@yaacovcorcos
yaacovcorcos marked this pull request as ready for review August 9, 2026 23:19
@yaacovcorcos
yaacovcorcos merged commit ebaa9f9 into main Aug 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant