fix: salvage verified docs, PDF, and design fixes#6
Open
time-attack wants to merge 9 commits into
Open
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.
What it does
Makes design-image errors honest and keeps PDF output intact and safe. Invalid variant counts now fail, timeout messages match the real timer, invisible preambles no longer create blank first pages, CJK links and quotes render correctly, and executable HTML/SVG content is removed before Chromium sees it.
How it works
The design CLI validates the requested count before credentials, file reads, or directory writes, while preserving the existing maximum of seven. Variant timeout text is derived from the configured duration. The PDF renderer carries non-visible opening markup into the first chapter, protects smartypants placeholders from URL matching, and recognizes CJK opening punctuation. Document HTML and generated diagram SVG pass through separate parser-backed allowlists suited to each format.
What was broken
Invalid counts such as
abc,0, and negative values exited successfully after generating nothing. The image timeout waited 240 seconds but reported 120. A leading style block produced a blank first page. Bare URLs could expose internal placeholder text and swallow following markup, while CJK opening quotes pointed the wrong way. Entity-obfuscated JavaScript links survived regex filtering and executed when clicked in Chromium.How it was fixed
Reconstructed only the focused fixes from the rejected docs/PDF/design consolidation wave. Invalid counts are rejected instead of silently coerced; timeout duration is injected and reported from one value; invisible preambles are folded without deleting markdown that merely resembles frontmatter; URL and CJK quote handling is corrected; and
sanitize-htmlnow parses document HTML and generated SVG with explicit allowlists. SVG scripts, events, links, animation, foreign objects, and external references are rejected while safe diagram geometry is retained.Evidence
The local
pr-test-envgate used immutableorigin/mainbaseline snapshots and isolated candidate environments with separate HOME roots.loperanger7/gstack-autobrowserbase/stagehandStored command SHA-256:
1d8d193306f53077e2ebedede950a24afbe087e20ebf27fb2ddefb314bf5d960.The probe exercised the production design CLI, markdown renderer, smartypants transform, sanitizer, real Chromium click behavior, and request abort path. Both baselines reproduced all six symptoms; both candidates passed.
Secondary checks:
bun test make-pdf/test/diagram-prepass.test.ts make-pdf/test/coverage-gaps.test.ts make-pdf/test/render.test.ts— 131 passedbun run build— passedgit diff --check origin/main..HEAD— passedScope
This intentionally excludes new image providers, broad timeout configuration, the race-prone design-round manifest, an obsolete image-model downgrade, frontmatter deletion, and global Chinese-first font ordering.
No VERSION, package version, CHANGELOG, ETHOS, or workflow changes.