Skip to content

fix: salvage verified docs, PDF, and design fixes#6

Open
time-attack wants to merge 9 commits into
mainfrom
time-attack/wave-docs-pdf-design-isolated-review
Open

fix: salvage verified docs, PDF, and design fixes#6
time-attack wants to merge 9 commits into
mainfrom
time-attack/wave-docs-pdf-design-isolated-review

Conversation

@time-attack

Copy link
Copy Markdown
Owner

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-html now 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-env gate used immutable origin/main baseline snapshots and isolated candidate environments with separate HOME roots.

Repository Cohort Baseline Candidate Identical probe
loperanger7/gstack-auto existing gstack consumer 1 0 yes
browserbase/stagehand clean-install control 1 0 yes

Stored 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 passed
  • focused design count/timeout tests — passed
  • bun run build — passed
  • real CJK + Mermaid PDF generation — passed, 37 KB artifact
  • git diff --check origin/main..HEAD — passed

Scope

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.

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