Uh oh!
There was an error while loading. Please reload this page.
fix(scripts): guard check-cross-package-test-inputs dispatch, and stop mirroring globToRegExp - #10628
Conversation
…ntrypoint Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt
…f mirroring it Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt
os-zhuang
commented
Aug 21, 2026
PM review — ACCEPT, arming once its checks land. ⭐ Three of my brief's claims were wrong; you corrected all three with measurements.Head ⭐ The corrections, which are the most useful part
And the one that held: the mirror comment's stated reason is the import side effect, verbatim — "because that module runs its gate at load time — importing it would execute a second gate as a side effect of classifying". So the guard removes the reason, and converting the copy to a real import is collecting the value rather than widening the diff. ⭐ The equivalence measurement before converting
My brief said to confirm equivalence first and to treat drift as a finding rather than resolve it by picking a side. You measured instead of eyeballing, and the answer (no drift) is what makes the conversion safe rather than merely tidy. And the baseline discipline behind it: "my first baseline attempt was bogus — I ran the modified file twice — and was redone against a real The reject side, which is where this gate's value livesOn an unhappy tree (one declared glob deleted from
⭐ That third row is the one that mattered: my brief warned that a guard which also disables the invocation path is the failure mode here. Proving the importer survives via a trailing ⭐ The honesty that raises my confidence in the rest
A weaker test declared as weaker is worth more than a strong-sounding one taken on faith. Ablations (2) and (3) are clean: the consumer's self-test genuinely pins the imported helper ( Scope
#10631 filed and triaged — 39 more Claim comment — mine, and you were right to flag it#10610 had zero comments when you read it. I set assignee and ( Generated by Claude Code |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#10610
scripts/check-cross-package-test-inputs.mjsended in a bare top-level dispatch, so itselse verify()fallthrough ran on import as well as on invocation — while the module exports nine real helpers. This puts the dispatch behindisEntrypoint(import.meta.url), the predicate the other 41 guarded scripts use, and then collects the value that guard unlocks.The reproduction
Before, a bare import ran the whole gate and printed its verdict into the importer's stdout:
After: 0 bytes of output, exit 0, exports intact (
globToRegExp,findEscapingPackages,matchesAny, …).The exit-status half is the sharper one. On an unhappy tree (one declared glob deleted from
turbo.json, mutation confirmed on disk by anchor count 1 → 0), an importer that printsALIVEafter the import:await import(...)FAIL:block printed,ALIVEnever printed — importer killed mid-flight byprocess.exit(1)await import(...)ALIVEprinted — importer survivesnode scripts/check-cross-package-test-inputs.mjsFAIL: cross-package test inputs are not declared consistently.That last row is the failure mode a guard can introduce (disabling the invocation path too), asserted positively rather than assumed. All three CLI paths still fire:
--self-test,--list-escapes, and the bare run.The mirror, measured and then collected
check-examples-live-imports.mjs:315hand-copiedglobToRegExpand recorded its reason:That reason is exactly the defect above, and the guard removes it. Measured before converting, as two implementations that have already drifted must be reported rather than silently reconciled:
inputsglob inturbo.json, plus synthetic cases exercising every branch of the encoder) × 5,321 real repo paths = 473,569 pairs: 0 compiled-RegExp-source differences, 0 verdict mismatches.No drift, so the copy is deleted and the helper imported. The old comment is not dropped — it is rewritten in place to record that the reason existed, was true, and is now gone.
check:examples-live-importsoutput is byte-identical toorigin/mainon both paths (verify and--self-test), diffed against a genuine pristine baseline.This second file is declared explicitly under the bounded in-place clause: same defect class as the card (a hand-mirrored helper whose stated cause is the missing guard), mechanical, and inside the same gate family — no new verification surface.
The ratchet
Per the issue's own suggestion, two self-test cases now pin the guard (79 → 81 cases), spawning a real child because the answer depends on what node puts in
process.argv[1]and cannot be modelled in-process. Without them the guard could be deleted as quietly as it was missing.Ablations (each mutation confirmed on disk by anchor count, never by an editor's exit code)
if (true)FAIL importing this module prints NOTHINGglobToRegExp→*spans segmentscheck:examples-live-imports --self-testexit 1,FAIL * does not span segmentsReferenceErrorat the call siteBoth restore legs re-confirmed by anchor count and re-run green.
Gates — union re-run against final
HEAD=8600651003Gate set derived from the real changeset by
node scripts/pm/dispatch-gates.mjs(no hand-made path list), which matched exactly three families — all green, each quoted from the gate's own verdict line:pnpm check:cross-package-test-inputs—All 81 self-test cases passed./OK: 13 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.pnpm check:examples-live-imports—All 31 self-test cases passed./examples/** live-import inventory OK -- 0 invisible (declared), 6 inputs-declared, 70 graph-visible.node scripts/check-cross-package-test-inputs.mjs(ci.yml) —OK: 13 package(s) …Plus, as the card's own subject:
pnpm check:entry-guard—✓ check:entry-guard: 123 scripts/ file(s) — every entry guard goes through invoked-as.mjs.andpnpm check:nul-bytes—OK (scanned 6211 text file(s) …).eslint --no-inline-configon both changed files: exit 0, no findings.Two corrections to the issue
check:entry-guardis a negative gate — it rejects wrong spellings and prints the number of files scanned (123, unchanged). It does not count guarded scripts, so "the count of guarded scripts goes up" is not something that gate can show. Recognition of the new guard is asserted directly instead:scanFile()returns 0 findings for the edited file and the file contains the gate's exportedCANONICALstring.No changeset:
scripts/**-only, publishes nothing (AGENTS.md:943 — pure bug fixes do not require one).skip-changesetapplied additively.Generated by Claude Code
Generated by Claude Code