fix(ci): stop the finalize Phase spawning real PowerShell on Windows - #224
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The failure
CI has been red on Windows only (Ubuntu passes every run), always on the same test:
Reproduced identically in runs 30528624379, 30540195956, 30547525224 and 30550161365.
Root cause
SetupApp's finalize Phase callsinstallShims(), which on Windows runsupdateWindowsUserPath()→execFileSync("powershell", …)(src/lib/shims.ts:306).Both app-level suites mock
node:child_processbut replace onlyexecFile—execFileSyncpasses 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 pollingwaitForFrame(which resolves silently on timeout). The app was still on◆ Configure toolswhen the assertion ran.successful flow reaches the done screentests/InstallApp.test.tsx(file)The same stall took
ConfigApp > manual-creds happy pathdown in run 30540195956, along with two DoctorApp tests starved on a sibling worker.The fix
Stub
installShimsin both suites that drive the finalize Phase. Nothing in either file asserts shim files, andshimsInstalledstill flips true soSetupComplete's resume message is unchanged.lib/shims.test.tsalready skips its owninstallShimsblock 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 --version→0.5.3. The Windows matrix job on this PR is the real check.Known, not fixed here
tests/lib/remove.test.tscallsrunRemove()16 times for real; each runsuninstallShims()→removeFromWindowsUserPath()→ another real PowerShell spawn that strips~/.codev-hub/binfrom 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