Skip to content

fix(ci): stop the finalize Phase spawning real PowerShell on Windows - #224

Merged
quickbeard merged 1 commit into
mainfrom
fix/windows-ci-shim-powershell-stall
Jul 30, 2026
Merged

fix(ci): stop the finalize Phase spawning real PowerShell on Windows#224
quickbeard merged 1 commit into
mainfrom
fix/windows-ci-shim-powershell-stall

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

The failure

CI has been red on Windows only (Ubuntu passes every run), always on the same test:

FAIL tests/InstallApp.test.tsx > InstallApp fail-stop invariant > successful flow reaches the done screen
AssertionError: expected '…' to contain 'Happy coding'

Reproduced identically in runs 30528624379, 30540195956, 30547525224 and 30550161365.

Root cause

SetupApp's finalize Phase calls installShims(), which on Windows runs updateWindowsUserPath()execFileSync("powershell", …) (src/lib/shims.ts:306).

Both app-level suites mock node:child_process but replace only execFileexecFileSync passes straight through to the real module. So every flow that reached finalize spawned a real, synchronous PowerShell. The runner's first such spawn is cold and blocks the event loop for ~10s, starving Ink's renders and the polling waitForFrame (which resolves silently on timeout). The app was still on ◆ Configure tools when the assertion ran.

Ubuntu Windows
successful flow reaches the done screen ~0.5s 11–13s
sibling finalize tests (warm PowerShell) ~0.7s ~1.5–1.9s
tests/InstallApp.test.tsx (file) 13s 49s

The same stall took ConfigApp > manual-creds happy path down in run 30540195956, along with two DoctorApp tests starved on a sibling worker.

The fix

Stub installShims in both suites that drive the finalize Phase. Nothing in either file asserts shim files, and shimsInstalled still flips true so SetupComplete's resume message is unchanged. lib/shims.test.ts already skips its own installShims block on Windows (describe.skipIf(process.platform === "win32")) for exactly this reason — the app-level tests just never got the same guard.

It also stops the suite rewriting the PATH registry entry of whatever machine runs it.

Verification

Local: pnpm fix, pnpm typecheck, pnpm test (71 files, 1254 passed), pnpm build && node dist/index.js --version0.5.3. The Windows matrix job on this PR is the real check.

Known, not fixed here

tests/lib/remove.test.ts calls runRemove() 16 times for real; each runs uninstallShims()removeFromWindowsUserPath() → another real PowerShell spawn that strips ~/.codev-hub/bin from the user PATH in the registry. ~6.5s of the Windows run and a genuine side effect on a Windows dev machine, but it isn't failing and those tests assert real shim-file/rc-file removal, so it needs a more careful change than this fix warranted.

🤖 Generated with Claude Code

`SetupApp`'s finalize Phase calls `installShims()`, which on Windows runs
`updateWindowsUserPath()` -> `execFileSync("powershell", ...)`. Both app-level
suites mock `node:child_process` but replace only `execFile`, so `execFileSync`
passed straight through to the real module: every flow that reached finalize
spawned a real, synchronous PowerShell.

The runner's first such spawn is cold and blocks the event loop for ~10s,
starving Ink's renders and the polling `waitForFrame` (which resolves silently
on timeout). The app was still on `Configure tools` when the assertion ran, so
`InstallApp > successful flow reaches the done screen` failed on every Windows
run with "expected ... to contain 'Happy coding'" — 11-13s for that one test
vs ~0.5s on Ubuntu, and 49s vs 13s for the file. The same stall took
`ConfigApp > manual-creds happy path` down in run 30540195956.

Stub `installShims` in both suites. Nothing there asserts shim files, and
`lib/shims.test.ts` already skips its own installShims block on Windows for
exactly this reason. It also stops the suite rewriting the PATH registry entry
of whatever machine runs it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@quickbeard
quickbeard merged commit 2961bdb into main Jul 30, 2026
4 checks passed
@quickbeard
quickbeard deleted the fix/windows-ci-shim-powershell-stall branch July 30, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant