test(pdf-engine): pin the F-245 PDF-teardown fix#121
Merged
Conversation
F-245 — opening a PDF in Books/Preview crashed with "doc.destroy is not a function" because pdf.js v6 removed PDFDocumentProxy.destroy() (teardown moved to the loading task), and callers await doc.destroy(). The fix (openPdfDocument overrides doc.destroy → task.destroy) shipped but was never verified — the seeded vault has no PDFs, so nothing exercised the close path. This locks it: a test simulating the exact v6 shape (a resolved proxy with NO destroy + a task whose destroy returns a Promise) asserts openPdfDocument still exposes a Promise-returning destroy that delegates to the task. Without the override, doc.destroy would be undefined and the test fails — reproducing the crash. Follow-up (heavier, separate): seed a real PDF book so the dogfood/e2e path opens + tears one down end-to-end (no book/asset seeding exists yet). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0.2.2 anchor. F-245 — opening a PDF in Books/Preview crashed with "doc.destroy is not a function" because pdf.js v6 removed
PDFDocumentProxy.destroy()(teardown moved to the loading task), and callersawait doc.destroy(). The fix (openPdfDocumentoverridesdoc.destroy→task.destroy) shipped but was never verified — the seeded vault has no PDFs, so nothing exercised the close path (that's how it shipped unnoticed).This locks it: a regression test simulating the exact v6 shape (a resolved proxy with no
destroy+ a task whosedestroyreturns a Promise) assertsopenPdfDocumentstill exposes a Promise-returningdestroythat delegates to the task. Without the override,doc.destroyis undefined and the test fails — reproducing the crash. pdfjs-dist is confirmed^6.0.227.Also verified the fix is correctly consumed: Books calls
doc.destroy().catch()through the SDK engine.Follow-up (separate, heavier): seed a real PDF book so the dogfood/e2e path opens + tears one down end-to-end — no book/asset seeding exists yet.
🤖 Generated with Claude Code