From a8d9dbe02a914284aeebec5daf13385b0a5774f2 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Thu, 9 Jul 2026 09:16:37 -0400 Subject: [PATCH] fix(#2089): widen read-injection-scanner property test timeout to avoid node22 race MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/read-injection-scanner.property.test.cjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/read-injection-scanner.property.test.cjs b/tests/read-injection-scanner.property.test.cjs index 92cf925f9..fb891c9c1 100644 --- a/tests/read-injection-scanner.property.test.cjs +++ b/tests/read-injection-scanner.property.test.cjs @@ -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() };