Repository navigation
build: trim audited PDF.js server payload and measure #229 image - #235
Merged
Merged
Conversation
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.
Related to #229. Independent draft from main
c6c47bdd; no merge, production action or issue closure.Published-image measurements
For baseline
535873b9→ deployed-sourceac906946(sha256:6ac0d343...) on linux/amd64, complete OCI gzip layers are 207,402,312 → 206,838,733 bytes (−0.272%) and digest-verified expanded tar layers are 625,566,208 → 623,327,232 bytes (−0.358%). Both published SPA dist layers have 1,134 identical files and identical per-file gzip/Brotli totals. Production dependency layers differ only in.package-lock.jsonand the removedlingxiloopself-link. Exact-image product source, licenses, entry paths and Visualize Python export were inspected. The image still carries third-party test/fixture and source-map candidates; these were not globally removed.Bounded packaging change
The exact image's LingxiOS 3.5.6 imports only
pdfjs-dist/legacy/build/pdf.mjsand resolves its CMaps, fonts and WASM. A scan of 17,834 packaged code/JSON files found no other PDF.js runtime consumer. The separate SPA build imports the generic PDF worker from its own complete dependency install. This PR trims only server-depspdfjs-dist@6.3.289viewer directories and three unused generic-build maps. It retains generic and legacy JS/worker, active legacy maps, types, dynamic resources, package metadata and all licenses. Exact version, consumer, path and import guards fail builds on drift.Measured on a copy of the exact installed package: 554 → 379 files, 34,781,083 → 24,272,468 regular-content bytes (−10,508,615); deterministic package tar gzip 8,533,320 → 6,495,400 bytes (−2,037,920). These are package-copy measurements, not a built candidate OCI saving. The 379 retained files have identical hashes. The published image's Node 22 executed the trim successfully on a task-owned package copy.
No-network short checks against the exact published image with only the candidate PDF.js package mounted read-only: real LingxiOS PDF document-worker output is byte-identical before/after for the retained triangle PDF fixture (201 bytes, SHA-256
30ee46cd...); generic and legacygetDocumentimports pass; packaged Web/Worker entries link to the missing-DATABASE_URL guard. The unpruned image fails the new packaging guard as intended; a wrong package version fails before deletion. Actual BuildKit scratch COPY confirms the prune script is present under production ignore rules. Existing production packaging/release-smoke contracts pass 24/24 with 0 skip.Full report, failure model, inventories and reproduction.
Remaining: build and audit the actual candidate OCI on a suitable disk budget, controlled full-build time and peak disk, configured Web/Worker/DB and more PDF resource variants, combined runtime 3.5.8 compatibility and the sole integrator's final production acceptance. The default local Docker context fails the unchanged bubblewrap namespace preflight. The draft does not claim #229 completion.