Skip to content

build(docs): escape NUL stash placeholders in docs site builder - #1001

Merged
steipete merged 1 commit into
mainfrom
build/docs-nul-escapes
Oct 7, 2026
Merged

steipete merged 1 commit into
mainfrom
build/docs-nul-escapes

Conversation

@steipete

@steipete steipete commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Why

scripts/build-docs-site.mjs carried four literal NUL bytes (0x00) in the inline() renderer's inline-code stash placeholder: one template literal and one regex literal. The first sits at byte 13289, past Git's 8000-byte binary sniff, so Git still diffed the file as text. The autoreview helper scans the whole file and refused every diff touching it as a binary change, which blocked reviews of the docs PRs #931, #939, #940 and #971.

What

  • Spell the NULs as \u0000 escapes. Runtime strings and regex semantics are unchanged.
  • Add tests/docs-site-source-bytes.test.mjs, a guard that the docs-site sources (build-docs-site.mjs, docs-site-assets.mjs, docs-site-toc.mjs) contain no literal NUL bytes.
  • Run test:docs-site over tests/docs-site-*.test.mjs, and have macOS CI call pnpm run test:docs-site so the new test runs there.

The two wiring edits are byte-identical to the same edits in #992 (same resulting blobs). Simulated both landing orders locally: either way the merge is conflict-free, the builder ends with zero NULs, and all 25 docs-site tests pass.

Proof

  • Built the docs site before and after the change: diff -r over all 79 generated files is identical (869 inline <code> spans exercise the placeholder path).
  • Guard test fails against the old source and passes against the new one.
  • pnpm run test:docs-site: 3/3 pass. node scripts/build-docs-site.mjs: OK.
  • git diff --numstat reports normal text lines; autoreview accepted the diff and returned scoped-clean.

No changelog entry: internal tooling, no user-visible behavior change.

scripts/build-docs-site.mjs carried four literal NUL bytes in the inline()
renderer's inline-code stash placeholder (one template literal, one regex
literal). The first sat at byte 13289, past Git's 8000-byte binary sniff, so
Git still diffed the file as text, but the autoreview helper scans the whole
file and refused every diff touching it as a binary change.

Spell them as \u0000 escapes instead. Runtime strings and regex semantics are
unchanged: the generated _site output is byte-identical across all 79 files.

Add a standalone guard test that the docs-site sources contain no literal NUL
bytes, run test:docs-site over tests/docs-site-*.test.mjs, and have macOS CI
call pnpm run test:docs-site. Those two wiring edits match open PR #992
byte-for-byte, so either PR can land first without conflicts.
@steipete
steipete requested a review from a team as a code owner October 7, 2026 05:42
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@cursor

cursor Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Internal docs build tooling and CI test wiring only; no user-facing or security-sensitive behavior change.

Overview
Replaces literal NUL bytes in scripts/build-docs-site.mjs’s inline() stash placeholders with \u0000 escapes so review tooling no longer treats docs-site diffs as binary. Runtime behavior and generated site output stay the same.

Adds tests/docs-site-source-bytes.test.mjs to fail if build-docs-site.mjs, docs-site-assets.mjs, or docs-site-toc.mjs contain raw 0x00 bytes again. test:docs-site now runs all tests/docs-site-*.test.mjs (not only the TOC test), and macOS CI’s docs lint step invokes that script instead of calling the TOC test directly.

Reviewed by Cursor Bugbot for commit bf49af9. Bugbot is set up for automated code reviews on this repo. Configure here.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 1:44 AM ET / 05:44 UTC.

ClawSweeper review

What this changes

The branch escapes literal NUL bytes in the documentation renderer, adds a source-byte regression guard, and includes all documentation-site tests in the shared command and macOS CI.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main and v4.8.0 retain the literal NUL bytes, and the related renderer PR does not replace this repair. No actionable correctness or security finding was identified.

Priority: P2
Reviewed head: bf49af9b08ba8de764e8af9e525a850d36e7c12f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, semantics-preserving tooling repair with appropriate regression coverage and no identified blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The collaborator author is exempt from the external proof gate. The captured body reports identical production-builder output before and after the placeholder escape repair; independent byte inspection supports semantic equivalence. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The collaborator author is exempt from the external proof gate. The captured body reports identical production-builder output before and after the placeholder escape repair; independent byte inspection supports semantic equivalence. No stored-data contract changes.
Evidence reviewed 7 items Pinned introduced change: The pinned delta changes two placeholder expressions, expands the existing test command, connects CI to that command, and adds a 13-line byte guard. No dependency, permission, publishing, or persistent-state contract changes are introduced.
Exact source-byte equivalence: Read-only byte inspection found four NUL bytes in the pinned main builder, beginning at offset 13289, and zero in the PR builder. Replacing each original NUL byte with the source spelling backslash-u0000 produces the exact head blob. JavaScript string and regex escapes preserve the original placeholder values.
Existing test and CI integration: The existing production-builder fixture exercises inline code in headings. The expanded wildcard includes that fixture and the new byte guard; macOS CI already configures Node and pnpm before invoking the shared command. No tests or builds were executed during this read-only review.
Findings None None.
Security None None.

How this fits together

Peekaboo’s documentation builder converts Markdown into the published HTML site. Its inline renderer temporarily replaces code spans with placeholders before restoring escaped code; CI checks the builder and its supporting sources.

flowchart LR
  A[Markdown documentation] --> B[Inline code placeholders]
  B --> C[Text formatting and escaping]
  C --> D[Restored code spans]
  D --> E[Generated HTML site]
  F[Source byte guard] --> G[Shared documentation tests]
  G --> H[macOS CI]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Source-byte repair 4 literal NUL bytes removed; 0 remain The exact byte transformation preserves placeholder semantics while removing the reported review-tool obstruction.
Production and test delta production +2/-2; tests +13/-0; wiring +2/-2 Production code has no net growth, and added lines provide the focused regression guard.

Technical review

Best possible solution:

Keep the renderer’s output unchanged while representing its placeholders as text escapes and guarding the source files against literal NUL bytes.

Do we have a high-confidence way to reproduce the issue?

Yes, source inspection establishes the byte-level defect: pinned main contains four literal NUL bytes and the branch contains none. The reported autoreview rejection was not independently executed.

Is this the best way to solve the issue?

Yes, escaping the existing values is a narrow semantics-preserving repair, and the guard integrates with the existing shared test command.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a0df5621dcdc.

Labels

Label changes:

  • add P2: This is a bounded build-tooling repair that restores documentation-review compatibility without changing published content.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The collaborator author is exempt from the external proof gate. The captured body reports identical production-builder output before and after the placeholder escape repair; independent byte inspection supports semantic equivalence. No stored-data contract changes.

Label justifications:

  • P2: This is a bounded build-tooling repair that restores documentation-review compatibility without changing published content.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The collaborator author is exempt from the external proof gate. The captured body reports identical production-builder output before and after the placeholder escape repair; independent byte inspection supports semantic equivalence. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The pinned delta changes two placeholder expressions, expands the existing test command, connects CI to that command, and adds a 13-line byte guard. No dependency, permission, publishing, or persistent-state contract changes are introduced. (scripts/build-docs-site.mjs:451, bf49af9b08ba)
  • Exact source-byte equivalence: Read-only byte inspection found four NUL bytes in the pinned main builder, beginning at offset 13289, and zero in the PR builder. Replacing each original NUL byte with the source spelling backslash-u0000 produces the exact head blob. JavaScript string and regex escapes preserve the original placeholder values. (scripts/build-docs-site.mjs:451, bf49af9b08ba)
  • Existing test and CI integration: The existing production-builder fixture exercises inline code in headings. The expanded wildcard includes that fixture and the new byte guard; macOS CI already configures Node and pnpm before invoking the shared command. No tests or builds were executed during this read-only review. (.github/workflows/macos-ci.yml:52, bf49af9b08ba)
  • Release still contains original builder: v4.8.0 points to builder blob 3b49b5b112721eca65fe11cba929e84cae80c130, the same builder blob as the pinned main parent. The requested escape repair is therefore absent from both inspected revisions. (scripts/build-docs-site.mjs, 4d43dc9d80cd)
  • Related renderer work remains distinct: fix(docs): preserve rendered source text and navigation #992 remains open and addresses rendered source fidelity and navigation. Its shared test wiring overlaps this PR, but its supplied scope does not include the literal-NUL repair or byte guard. The prepared screenshots were inspected and demonstrate that separate renderer work. (3cfafcb08100)
  • Production verification reported in captured body: The captured PR body reports before/after production site builds with identical output across 79 files, including 869 inline code spans, and a guard that fails on old source and passes on new source. The collaborator author is exempt from the external-contributor proof gate; these reported observations supplement the independently inspected byte transformation. (scripts/build-docs-site.mjs:446, bf49af9b08ba)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • williamclay8: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 8f34646 into main Oct 7, 2026
17 checks passed
@steipete
steipete deleted the build/docs-nul-escapes branch October 7, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant