Skip to content

fix: render check regex escapes; ship the ./testing subpath - #127

Merged
Madraka merged 2 commits into
mainfrom
fix/render-whitespace-and-testing-exports
Oct 25, 2026
Merged

Madraka merged 2 commits into
mainfrom
fix/render-whitespace-and-testing-exports

Conversation

@Madraka

@Madraka Madraka commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

What

Two bugs found while fixing #116 (PR #124).

1. render_page checks lost their regex escapes (@cloudhal/mcp-server)

The in-page check parts were plain template literals, so backslashes never reached the page:

  • long-line: the loop got /s/ instead of /\s/. The letter "s" counted as blank, and every real space and indentation run counted as text.
  • input-label: aria-labelledby was split on /s+/, so labelled inputs were reported as unlabelled.

Biome's noUselessEscapeInString safe fix had already deleted one of these backslashes, and pnpm lint:fix would have deleted the other.

Fix:

  • Every check part is now String.raw.
  • The Biome rule is an error with fix: "none".
  • Tests assert the guard, the evaluated whitespace regex, and the checks' behaviour in happy-dom and in real Chrome. They fail on the old code and pass now.

A repo-wide Babel scan of every embedded script found no other lost escapes.

Measured: on cloudhal.com the 91–95 characters per line flagged by long-line were real; the 736 px column holds about 92 characters a line either way. The bug changes the count for text with indentation, inline elements or "ss".

2. The published ./testing subpath was missing (@cloudhal/storage, analytics, comments, schedules)

Problem: these four packages export ./testing. Their READMEs, the released storage changelog and RFC-0004/0006/0007/0008 present it as public. But build-packages skipped every testing.ts, so importing it from npm failed with ERR_MODULE_NOT_FOUND.

Fix:

  • A testing.ts now ships where exports names it. Other packages' testing.ts and every *.test.* file stay out.
  • vitest (>=3) and, for storage, miniflare (*) are optional peers. The ranges are wide on purpose: npm hard-fails with ERESOLVE on a mismatched optional peer of a direct dependency, and no range matches wrangler's prerelease miniflare.
  • The build now checks that every published exports/bin target exists (scripts/verify-exports.ts, also available as --verify).
  • Packaging tests cover the ship rule.
  • smoke-pack installs the four packages next to vitest 4 and miniflare 3.

Verification (local, one command at a time)

  • Red/green:
    • With HEAD's check files, the new tests fail 5 of 6; with the fix, 6 of 6 pass.
    • With HEAD's build, --verify reports 8 missing targets; with the fix, 0.
  • Real Chrome: render-chrome and render-chrome-text pass, none skipped.
  • Packages: mcp-server 174, storage 82, analytics 372 (+1 live-only skip), comments 111 and schedules 119 tests pass. build-packages --check passes.
  • Tarballs: smoke-pack passes, and all 13 tarballs have 0 missing exports.
  • Full serial pnpm check: biome, size, typecheck 20/20, test 19/19, 4,855 tests.
  • Lockfile: unchanged; the new peers are optional.

The work was reviewed by three independent reviewers, and each finding went through a separate refutation round. The peer ranges were widened as a result.

Checklist

  • pnpm check passes locally (serial). cargo test --workspace: no Rust or contract changes.
  • Contract change? None.
  • User-visible change in a published package? .changeset/render-check-escapes.md, .changeset/testing-subpath-ships.md
  • Commits are signed off (git commit -s, DCO)
  • Docs / AGENTS.md updated: storage and analytics READMEs (peer note), build script header

🤖 Generated with Claude Code

Madraka and others added 2 commits October 25, 2026 18:22
The in-page check parts were plain template literals, so a backslash in the
page's code never reached the page: content.ts's long-line loop got /s/ for
/\s/ (the letter s counted as blank, every real space as text), and
input-label split aria-labelledby on /s+/ and called labelled inputs
unlabelled. Biome's noUselessEscapeInString safe fix had deleted one of them.

Every part is now a String.raw template; the rule is an error with its fix
off; tests assert the guard, the evaluated whitespace regex, and the checks'
behaviour in happy-dom and real Chrome (red on the old code).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Madraka <[email protected]>
storage, analytics, comments and schedules export ./testing (documented in
their READMEs, the released storage changelog and RFC-0004/0006/0007/0008),
but build-packages skipped every testing.ts, so the published import failed
with ERR_MODULE_NOT_FOUND. A testing.ts now ships where exports name it;
other packages' testing.ts and all *.test.* files stay out. vitest (>=3) and,
for storage, miniflare (*) are optional peers, wide on purpose: npm stops with
ERESOLVE on a mismatched optional peer of a direct dependency, and no range
matches wrangler's prerelease miniflare.

build-packages now verifies every published exports/bin target exists
(scripts/verify-exports.ts, also --verify), packaging tests cover the ship
rule, and smoke-pack installs the four packages next to vitest 4 and
miniflare 3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Madraka <[email protected]>
@Madraka
Madraka enabled auto-merge October 25, 2026 15:23
@Madraka
Madraka merged commit 6c3bf81 into main Oct 25, 2026
5 checks passed
@Madraka
Madraka deleted the fix/render-whitespace-and-testing-exports branch October 25, 2026 15:42
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.

1 participant