Skip to content

test: deflake env_install_interrupt by killing reinstall on install dir creation - #2283

Closed
fengmk2 wants to merge 1 commit into
docs/stacked-prsfrom
fix/env-install-interrupt-flake
Closed

test: deflake env_install_interrupt by killing reinstall on install dir creation#2283
fengmk2 wants to merge 1 commit into
docs/stacked-prsfrom
fix/env-install-interrupt-flake

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jul 31, 2026

Copy link
Copy Markdown
Member

A fixed 100ms kill can fire before vp creates the new install dir on slow
Windows runners, leaving no stale dir for check-stale-packages to find.
Poll for the new install dir and kill as soon as it appears; the package's
200ms postinstall keeps the install running well past that point.


Stack created with GitHub Stacks CLIGive Feedback 💬

…ir creation

A fixed 100ms kill can fire before vp creates the new install dir on slow
Windows runners, leaving no stale dir for check-stale-packages to find.
Poll for the new install dir and kill as soon as it appears; the package's
200ms postinstall keeps the install running well past that point.
@fengmk2

fengmk2 commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

fix in #2282

@fengmk2

fengmk2 commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Superseded by #2282, which stabilized this fixture. Closing.

@fengmk2 fengmk2 closed this Jul 31, 2026
@fengmk2
fengmk2 deleted the fix/env-install-interrupt-flake branch August 2, 2026 13:28
fengmk2 added a commit that referenced this pull request Aug 4, 2026
…2316)

The Windows `env_install_interrupt` case kept flaking after #2283 and
#2299, in two modes: the check-stale step reported "interrupted stale
package removed" instead of "exists", and a 60s zero-output step
timeout.

Root cause: on Windows, `vp` on PATH is the trampoline in `VP_HOME/bin`,
which runs `current/bin/vp.exe` as a child and waits. The interrupt
driver's `child.pid` was the trampoline, so #2299 killed the wrong
process first. The real vp.exe was then torn down by `taskkill /T`,
which kills the tree in unspecified order; whenever the npm subtree died
before vp.exe, the still-alive vp treated the reinstall as failed and
removed the partial install dir the test asserts on. When child
enumeration returned nothing, only the trampoline died and the real vp
survived as an orphan, matching the zero-output mode. Unix never flaked
because `bin/vp` is a symlink, so the killed child is the installer.

Fix, all inside the fixture:

- Spawn `VP_HOME/current/bin/vp[.exe]` directly so `child.pid` is the
process that runs the install on every platform; killing it first now
prevents the cleanup reaction.
- Kill the postinstall subtree via a PID handshake: postinstall writes
its PID into the ready file (write-then-rename), so the driver needs no
PowerShell/CIM enumeration. The npm layers in between exit on their own
once the script dies, and with vp already dead nobody reacts.
- Add stage markers and a 45s watchdog so a future failure names the
stage that hung instead of showing a blank PTY screen.

Verified on macOS with `cargo test -p vite_cli_snapshots --
env_install_interrupt`; the Windows race itself can only be exercised by
this PR's Windows CLI snapshot leg.
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