test(snapshot): reproduce vp run ctrl-c tearing tasks down mid-shutdown#2069
Closed
fengmk2 wants to merge 1 commit into
Closed
test(snapshot): reproduce vp run ctrl-c tearing tasks down mid-shutdown#2069fengmk2 wants to merge 1 commit into
fengmk2 wants to merge 1 commit into
Conversation
Killing a vp run task with Ctrl+C in fish leaves stray escape sequences on the next prompt: fish probes the terminal (OSC 11, CSI 6n, DA1) at every prompt draw, and vp run tears the task down within milliseconds of Ctrl+C instead of waiting for its graceful shutdown, so the dying task tree's late terminal writes and mode restores race the shell's probes and the replies land as garbage input. The new run_ctrlc_teardown fixture pins the vp-side defect: a dev-server-like vpt payload whose shutdown takes 300 ms records, via a watcher process in its own process group that survives vp's teardown, whether that shutdown was allowed to finish. verdict.txt currently reads "task was torn down before its graceful shutdown finished"; a fix should flip it to "task completed its graceful shutdown". Also adds vpt wait-file, a generic helper that polls until a file exists and prints it, for asserting on files written by a step's surviving process tree. Refs #2036
✅ Deploy Preview for viteplus-preview canceled.
|
Member
Author
How to use the Graphite Merge QueueAdd the label auto-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Member
Author
|
Consolidated into #2065: the snapshot reproduction commit is included on that branch together with the fix. |
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.

Reproduces #2036 with a PTY snapshot test.
The stray characters after killing
vp runin fish are the terminal's replies to fish's own prompt probes (fish 4.x sends OSC 11, CSI 6n, and DA1 at every prompt draw). The vp-side defect that turns them into garbage: on Ctrl+C,vp runtears the task down within a few milliseconds instead of waiting for its graceful shutdown, so the dying task tree (vite dev server, managed node) still touches the terminal while the shell is already drawing its next prompt. Plainvite devis clean because the shell waits for vite itself, which finishes its terminal cleanup before exiting. Verified end to end by driving real fish 4.8 in a scripted PTY:vp run devreproduces the exact junk from the issue, a plainnodeprocess killed the same way does not.The new
run_ctrlc_teardownfixture pins this: a dev-server-likevptpayload whose shutdown takes 300 ms records whether that shutdown was allowed to finish. The verdict is written by a watcher process in its own process group (it survives vp's teardown the same way real dev-server grandchildren do) and read by a follow-upvpt wait-filestep, which keeps the snapshot deterministic under parallel suite load. The recorded snapshot currently says:A fix should flip this line to
task completed its graceful shutdown.Also adds
vpt wait-file <path> [timeout-ms], a generic helper that polls until a file exists and prints it.