Skip to content

fix(pptx): initialize isolated embedded PDF renderer - #7661

Open
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
fix/platform-embedded-pdf
Open

fix(pptx): initialize isolated embedded PDF renderer#7661
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
fix/platform-embedded-pdf

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Load the matching PDF.js worker module inside the isolated embedded-PDF renderer so PDF-in-EMF PowerPoint images render instead of remaining blank.
  • Resolve bundled asset URLs to absolute URLs before importing them from the Blob worker. Preserve ordinary PDF preview configuration and existing rendering fallbacks.

Type of Change

  • Bug fix

Testing

  • 21 renderer tests across 8 suites, app type-check, repository lint, all 46 audits, API validation, docs-manifest check, and diff check passed.
  • Production-built Next.js harness imported the actual PowerPoint and PDF viewer modules. A synthetic PPTX containing an EMF-embedded PDF produced exact red/blue pixels; ordinary PDF preview rendered afterward and its worker configuration remained unchanged.
  • Compiled library and both worker assets returned HTTP 200. No final-run worker errors. This was a production-renderer harness check, not authenticated application E2E or Docker verification.
  • Full application CI passed. Turbopack still reports its existing external-ESM warning for the library asset and reports the same warning for the newly required worker asset; both assets load and render in the production-browser check. No externalization or warning-suppression changes.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced (matching worker asset also receives the existing Turbopack external-ESM warning described above)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 9, 2026 6:42pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness, security, or repository-rule findings.

Summary

  • Keeps the isolated renderer independent of the application’s ordinary PDF.js configuration.
  • Adds focused tests for absolute asset URLs, transferable PDF data, successful responses, errors, and unavailable rendering APIs.
  • The resolved testing-scope thread is not outstanding: BillLeoutsakosvl346 explicitly distinguished the unit-test contract coverage from production-built browser verification of the real Blob worker, and the thread was manually resolved.

Diagram

sequenceDiagram
  participant Main as PPTX renderer
  participant Blob as Isolated Blob worker
  participant PDFWorker as PDF.js worker module
  participant PDFLib as PDF.js library
  Main->>Main: Resolve library and worker URLs absolutely
  Main->>Blob: Post PDF data, dimensions, and asset URLs
  Blob->>PDFWorker: Import matching worker module
  Blob->>PDFLib: Import PDF.js library
  PDFLib->>Blob: Render page through in-context worker fallback
  Blob->>Main: Return rendered PNG Blob
Loading

Comment thread apps/sim/lib/pptx-renderer/utils/pdf-renderer.test.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile Please reassess the resolved testing-scope thread using the documented production-built browser verification. No code changes were necessary; automated unit coverage and manual real-worker coverage are explicitly distinguished.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@BillLeoutsakosvl346 I have started the AI code review. It will take a few minutes to complete.

Restore the resolve-once memoization for the pdfjs asset URLs so the
failure path is not retried per embedded PDF, matching the documented
intent of the cache.

Execute WORKER_SRC in-process against a stand-in pdfjs so the fix itself
is covered rather than only the message it posts. The worker template was
previously an untested string, which is how the falsy workerSrc assignment
shipped green. Asserts that the worker module is imported before the
library and that GlobalWorkerOptions is never written to.

Also fixes the canvas-guard test, which passed because window was
undefined rather than because the guard fired, and adds the missing
Worker guard case.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTTSjsX7CBMfXrdmq4PL85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants