Filed unassigned from the #10452 dev seat (session session_01DdCnBGcHeufjrq7drTD3wt, PR #10607). Observed while probing the collector, not a card I acted on. No live consumer is broken today.
The shape
scripts/check-cross-package-test-inputs.mjs ends with a bare top-level dispatch:
constargv=process.argv.slice(2);if(argv.includes('--self-test'))selfTest();elseif(argv.includes('--list-escapes')){ ... }elseif(argv.includes('--union-into')){ ... }elseverify();There is no isEntrypoint() guard, so the else verify() branch fires on import, not only on invocation. The file also exports real helpers (escapingBindings, importSpecifiers, coversDirectory, matchesAny, repoRelativeLiterals, findEscapingPackages, serializePackageList, unionInto).
Measured on 505e9dd905:
$ node --input-type=module -e "await import('./scripts/check-cross-package-test-inputs.mjs')"
OK: 13 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.
That line is printed by the import alone. On a tree where the gate is unhappy the same import calls process.exit(1) instead, so any consumer of the exports inherits the gate's verdict as its own exit status, plus its stdout.
Why it is a finding rather than a bug report
Nothing imports the module today — the nine files that mention it, mention it in prose. So there is no present breakage, and this is about the absence of a guard rather than a live defect.
Two things make it worth recording anyway:
- The repo has the idiom and uses it widely.
scripts/invoked-as.mjs exports isEntrypoint, and 35 scripts under scripts/ already call it. This file is one of the ones that does not. - The cost may already have been paid once.
scripts/check-examples-live-imports.mjs:315 documents that its globToRegExp is "Mirrored from globToRegExp in check-cross-package-test-inputs.mjs rather than" imported. A hand-mirrored copy of a helper is exactly the sort of duplication an unguarded entry point encourages, and duplicated glob semantics between two gates that must agree is its own hazard.
Not claimed
- I have not checked whether the mirroring in
check-examples-live-imports.mjs was actually motivated by this; the comment gives a reason that is truncated in my quote above and should be read in full before that link is asserted. - I have not swept the other
scripts/** gates for the same missing guard. If several are unguarded the shape of the fix changes.
Likely fix
Wrap the dispatch in the existing predicate, matching the 35 files that already do:
if(isEntrypoint(import.meta.url)){/* existing dispatch */}The self-test would want a case pinning that importing the module produces no output and no exit, or the guard can be removed again as quietly as it was never added.
Generated by Claude Code
Filed unassigned from the #10452 dev seat (session
session_01DdCnBGcHeufjrq7drTD3wt, PR #10607). Observed while probing the collector, not a card I acted on. No live consumer is broken today.The shape
scripts/check-cross-package-test-inputs.mjsends with a bare top-level dispatch:There is no
isEntrypoint()guard, so theelse verify()branch fires on import, not only on invocation. The file also exports real helpers (escapingBindings,importSpecifiers,coversDirectory,matchesAny,repoRelativeLiterals,findEscapingPackages,serializePackageList,unionInto).Measured on
505e9dd905:That line is printed by the import alone. On a tree where the gate is unhappy the same import calls
process.exit(1)instead, so any consumer of the exports inherits the gate's verdict as its own exit status, plus its stdout.Why it is a finding rather than a bug report
Nothing imports the module today — the nine files that mention it, mention it in prose. So there is no present breakage, and this is about the absence of a guard rather than a live defect.
Two things make it worth recording anyway:
scripts/invoked-as.mjsexportsisEntrypoint, and 35 scripts underscripts/already call it. This file is one of the ones that does not.scripts/check-examples-live-imports.mjs:315documents that itsglobToRegExpis "Mirrored fromglobToRegExpincheck-cross-package-test-inputs.mjsrather than" imported. A hand-mirrored copy of a helper is exactly the sort of duplication an unguarded entry point encourages, and duplicated glob semantics between two gates that must agree is its own hazard.Not claimed
check-examples-live-imports.mjswas actually motivated by this; the comment gives a reason that is truncated in my quote above and should be read in full before that link is asserted.scripts/**gates for the same missing guard. If several are unguarded the shape of the fix changes.Likely fix
Wrap the dispatch in the existing predicate, matching the 35 files that already do:
The self-test would want a case pinning that importing the module produces no output and no exit, or the guard can be removed again as quietly as it was never added.
Generated by Claude Code