From 9cc846d0fef16af114e31e3d4066a095534060a2 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Tue, 28 Apr 2026 00:07:22 -0700 Subject: [PATCH] fix(windows-ci): broaden bin/ pattern to match path.join(ROOT, 'bin') MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round 6. Round 5 tightened the bin/ pattern to require a script-name segment after 'bin', which inadvertently released test/brain-sync.test.ts that uses: const BIN = path.join(ROOT, 'bin'); const full = bin.startsWith('/') ? bin : path.join(BIN, bin); The 'bin' segment is the LAST argument to path.join — there's no literal script name to match. The earlier looser pattern caught this; round 5 broke that. Fix: revert to `,\\s*['"]bin['"]\\s*[,)]` which matches both forms: - `, 'bin', 'script-name')` (path.join with name) — typical - `, 'bin')` (path.join ending at bin) — brain-sync style Curated subset: 73 → 66 tests (~52% of free suite). The 7 additional exclusions are all bin-script tests that were misclassified by the round-5 tightening. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/test-free-shards.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/test-free-shards.ts b/scripts/test-free-shards.ts index d382f5b2..94b4d53f 100755 --- a/scripts/test-free-shards.ts +++ b/scripts/test-free-shards.ts @@ -66,11 +66,12 @@ const WINDOWS_FRAGILE_PATTERNS: Array<{ pattern: RegExp; reason: string }> = [ // Tests that spawn a bash shebang script in bin/ via spawnSync. Git Bash on // Windows can run `bash /path/to/script` but spawnSync(scriptPath, ...) // tries to execute the file directly via CreateProcess, which fails on the - // shebang. The pattern matches any path-join with a 'bin' segment as a - // separator-bounded literal. Catches both `path.join(ROOT, 'bin', ...)` and - // the destructured `join(import.meta.dir, '..', 'bin', ...)` form used in - // diff-scope.test.ts. - { pattern: /,\s*['"]bin['"]\s*,\s*['"][a-z][\w-]+/, reason: 'spawns bin/ shebang script (Windows CreateProcess does not parse shebangs)' }, + // shebang. The pattern matches `, 'bin'` as a path-join argument (closing + // OR followed by another segment), which catches: + // - path.join(ROOT, 'bin', 'script-name') — typical + // - join(import.meta.dir, '..', 'bin', 'name') — destructured (diff-scope) + // - path.join(ROOT, 'bin') — bare BIN constant (brain-sync) + { pattern: /,\s*['"]bin['"]\s*[,)]/, reason: 'spawns bin/ shebang script (Windows CreateProcess does not parse shebangs)' }, // Tests that launch a real Playwright browser. The windows-free-tests CI job // runs a curated subset that intentionally does NOT install Chromium — // browser bring-up on Windows is a separate concern (see PR #1238). Tests