fix(#2089): widen read-injection-scanner property test timeout to avoid node22 race

The property test's execFileSync timeout (5000ms) was identical to the
scanner's own internal stdin-timeout (hooks/gsd-read-injection-scanner.js:109,
also 5000ms). Under concurrent test-chunk load on linux-node22 — which #2089's
3 new cursor test files redistribute — the scanner subprocess's stdin 'end'
event can fire late enough that execFileSync's SIGTERM arrives before the
scanner's own process.exit(0), producing err.status=null → exitCode=1 →
spurious property-test failure.

The scanner has no process.exit(N!=0) paths; the only non-zero exit is from
the signal-kill race. Doubling the test ceiling to 10000ms gives the scanner's
5000ms internal exit a 5s buffer to win the race deterministically on every
node version.
This commit is contained in:
Tom Boucher
2026-07-09 09:16:37 -04:00
parent a53c5462e6
commit a8d9dbe02a

View File

@@ -27,7 +27,14 @@ function runHook(payload) {
const stdout = execFileSync(process.execPath, [HOOK_PATH], {
input: JSON.stringify(payload),
encoding: 'utf-8',
timeout: 5000,
// 10s — double the scanner's own 5s internal stdin-timeout
// (hooks/gsd-read-injection-scanner.js:109). Under concurrent test
// load (crowded run-tests.cjs chunks), node22's event-loop scheduling
// can delay the scanner's stdin 'end' handler past 5s, racing the
// scanner's process.exit(0) against this timeout's SIGTERM. A 10s
// ceiling gives the scanner's own 5s exit a 5s buffer to win the race
// deterministically on every node version. (#2089)
timeout: 10000,
stdio: ['pipe', 'pipe', 'pipe'],
});
return { exitCode: 0, stdout: stdout.trim() };