Skip to content

feat(react-pdf): add exact Octane binding - #559

Closed
jonkwheeler wants to merge 28 commits into
octanejs:mainfrom
jonkwheeler:jon/react-pdf-binding
Closed

jonkwheeler wants to merge 28 commits into
octanejs:mainfrom
jonkwheeler:jon/react-pdf-binding

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Octane applications can now render PDFs through the published [email protected] contract without retaining React or a second renderer. The binding preserves the nine root runtime exports, ten root type exports, documented CSS paths, and PDF.js worker integration while adapting only renderer-owned node, ref, event, class, and style types.

The implementation uses PDF.js directly for real worker loading, canvas, selectable text, annotation links/forms, structure trees, outlines, thumbnails, navigation, cancellation, and cleanup. Browser evidence runs the same pinned PDF through pristine React and Octane, while SSR covers deterministic loading/no-data shells, streaming, and real-binding hydration. A packed outside-workspace consumer also proves client/server imports, CSS and worker paths, SSR execution, and the absence of a React runtime dependency.

Parity evidence is pinned and fail-closed: 144 upstream tag/npm artifacts, 182 source-test identities, declaration programs, and six negative controls detect missing files, stale checksums, renamed or remapped cases, and public-surface drift.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test
  • targeted tests:
    • pnpm --dir packages/react-pdf test (4 files, 9 tests; audit verifies 144 artifacts and 182 upstream cases)
    • pnpm --dir packages/react-pdf test:types
    • pnpm --dir packages/react-pdf test:ssr (3 tests, including streaming)
    • pnpm bindings:typecheck
    • pnpm react-parity:validate
    • pnpm exec vitest run --project octane-mcp-server (2 files, 37 tests)
    • pnpm --dir playground/octane build (8,449 modules transformed)
    • generated package, binding-status, parity-gap, CLI-data, changeset, formatting, and test-marker checks
    • the expanded Chromium/Firefox harness production-builds locally; local execution could not bind its loopback preview server because the Codex environment's approval quota was exhausted, so the draft PR's browser CI lane remains authoritative

Risk / follow-ups

  • Keep this PR in draft through CI and Cursor/Bugbot feedback. Only an Octane maintainer should mark it ready.
  • The browser lane must confirm the newly added pristine-React differential and real-binding hydration assertions in Chromium and Firefox.
  • Password callbacks are wired directly to the PDF.js loading task, but an encrypted-PDF browser fixture is not yet included; that evidence can be added in review if maintainers want it in this PR.

Provenance

  • An agent produced this diff (agent-authored)

Note

Medium Risk
Adds a new PDF.js-backed binding with worker, canvas, and SSR/hydration split behavior; scope is large though it is additive with pinned parity evidence and no changes to core auth or data paths.

Overview
Introduces @octanejs/pdf (packages/pdf) as an Octane port of the published [email protected] root API—Document, Page, Thumbnail, Outline, context hooks, PasswordResponses, pdfjs, root types, documented layer CSS, and PDF.js worker integration—with separate server and browser entry conditions for SSR-safe shells versus worker-backed rendering.

Repository wiring updates generated inventories and status docs (61 bindings), adds a changeset for @octanejs/pdf and @octanejs/mcp-server, registers react-pdf → @octanejs/pdf in CLI data and the MCP bridge, extends bindings:typecheck to packages/pdf, and documents the delivery plan in docs/plans/pdf-binding.md. React-parity lockfile hashes and eval manifest overlay hashes are refreshed for the new dependency graph.

Reviewed by Cursor Bugbot for commit 01431c0. Bugbot is set up for automated code reviews on this repo. Configure here.

Prove the PDF.js client/server architecture before broad parity work, then add the initial Document, Page, Thumbnail, and Outline contract with real worker, layer, SSR, hydration, React differential, and packaging evidence.
@vercel

vercel Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview Aug 4, 2026 6:00am
octane-website-mcp Ready Ready Preview Aug 4, 2026 6:00am

Request Review

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability labels Aug 4, 2026
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 4, 2026 05:59 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 4, 2026 06:00 Inactive
Comment thread packages/pdf/src/components.tsrx Resolved
Comment thread packages/pdf/src/components.tsrx Resolved
jonkwheeler and others added 8 commits August 7, 2026 15:31
Resolve inventory, eval manifest, hook-form parity lockfile, and root
package scripts while keeping react-pdf coverage.

Co-authored-by: Cursor <[email protected]>
Regenerate lockfile hashes and inventory for react-pdf.

Co-authored-by: Cursor <[email protected]>
Resolve inventory, eval manifest, hook-form parity lockfile, and root
package scripts while keeping react-pdf coverage.

Co-authored-by: Cursor <[email protected]>
Regenerate lockfile hashes and inventory for react-pdf.

Co-authored-by: Cursor <[email protected]>
Resolve inventory, eval manifest, hook-form parity lockfile, and root
package scripts while keeping react-pdf coverage.
Regenerate lockfile hashes and inventory for react-pdf.
Resolve inventory and root scripts while keeping react-pdf coverage.
Regenerate lockfile hashes and Vitest evidence for react-pdf.
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

@trueadm
trueadm marked this pull request as ready for review August 8, 2026 19:42
@jonkwheeler
jonkwheeler marked this pull request as draft August 9, 2026 02:50
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

REVIEW WITHDRAWN

Branch is DIRTY vs main; withdrawing readiness before merging origin/main.

jonkwheeler and others added 2 commits August 8, 2026 22:51
Resolve inventory, workspace, playground catalog, and lockfile while keeping react-pdf coverage.

Co-authored-by: Cursor <[email protected]>
Regenerate lockfile hashes and Vitest evidence for react-pdf.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

Comment thread packages/pdf/audit/react-parity.json Resolved
Comment thread vitest.config.js Resolved
Comment thread vitest.config.js Resolved
jonkwheeler and others added 2 commits August 9, 2026 03:43
Add a pristine Vitest browser lane for the full upstream suite, replace
collapsed case-map claims with one-for-one or pending dispositions, point
type lanes at the upstream and Octane package compile programs, and keep
SSR/feasibility/hydration/packed coverage outside parity accounting.

Co-authored-by: Cursor <[email protected]>
Resolve currency conflicts with animejs landing on main and refresh
parity lockfile evidence hashes.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

@leonidaz leonidaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React parity audit review only; no tests were run.

Comment thread packages/pdf/UPSTREAM.md Resolved
Record structural adapted-evidence digests and exhaustive authored-test provenance so parity claims fail closed when the evidence drifts.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Addressed the five parity-audit review threads in 544a28f: adapted evidence digests and negative controls, honest repo-authored type lanes, exhaustive test classifications, immutable React oracle documentation, and structured divergences. Validation passed locally; the PR remains draft.

…nejs#559)

Bugbot found selective expect/string digests could miss hollowed-out adapted cases. Digest the full normalized callback body and add negative controls for call-subject and numeric rewrites.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Addressed Cursor Bugbot finding on adapted evidence digests: caseStructuralDigest now hashes the full normalized case body (not a selective expect/string projection), with negative controls for call-subject and numeric rewrites.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit d8e9d36. Configure here.

…js#559)

Only strip statement terminators outside quotes so data-URI `;base64` / `;filename=` fixture drift still fails the adapted evidence crosswalk.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Addressed Cursor Bugbot finding on digest semicolon stripping: statement terminators are removed only outside quotes, preserving data-URI fixture separators.

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

REVIEW WITHDRAWN

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

"environment": "workspace-node",
"project": "react-pdf",
"evidenceOrigin": "upstream-suite",
"notes": "Runs the one-for-one adapted private upstream helpers; remaining upstream identities are explicit pending-adaptation dispositions in audit/case-map.json.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This required adapted lane still covers only 8 of 182 upstream identities; the other 174 are recorded as pending-adaptation. A pending marker is not verified adapted evidence or a genuine not-applicable disposition, so this leaves almost the entire upstream runtime suite unported while the manifest presents the lane as required parity evidence. Please adapt and execute those identities, or give each genuinely inapplicable case a specific allowed disposition and reason before treating this port as review-complete.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This required adapted lane still covers only 8 of 182 upstream identities; the other 174 are recorded as pending-adaptation.

Acknowledged and still open. The 8 adapted cases remain the private utility/Ref evidence; the other 174 are still pending-adaptation because one-for-one Octane adaptations of the Vitest browser suite are not landed yet.

Options:

  1. Adapt and execute all 174 identities under the required adapted-octane lane (large parity scope).
  2. Give each genuinely inapplicable case a specific allowed disposition + reason (not pending-adaptation), and adapt the rest.
  3. Keep the port draft until that inventory is complete.

Lean: (1)/(2) — do not treat the port as review-complete while required adapted coverage is mostly pending. Leaving this thread unresolved on purpose.

Comment thread packages/react-pdf/UPSTREAM.md Resolved
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

REVIEW WITHDRAWN

Withdrawing readiness before merge-currency repair, package rename to @octanejs/pdf, and unresolved leonidaz parity threads.

jonkwheeler and others added 2 commits August 10, 2026 12:49
…js#559

Rename `@octanejs/react-pdf` to `@octanejs/pdf`, wire paired typetest lanes and
exhaustive test classifications, and pin a dedicated React oracle catalog.

Co-authored-by: Cursor <[email protected]>
@leonidaz

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! This pull request was incorporated into main as commit 87394b4e5116 through consolidated PR #699.

@leonidaz leonidaz closed this Aug 12, 2026
kotarotaniguchi0523 pushed a commit to kotarotaniguchi0523/octane that referenced this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants