test: fix both required-gate flakes (parity teardown ENOTEMPTY + screenshot render timeout) - #119
Merged
Merged
Conversation
parity-shapes.test.ts (and parity-fixtures.test.ts) spawn session daemons and tore down without waiting for them to exit: afterEach SIGTERM'd the daemons but returned immediately, so a daemon still shutting down kept writing into its sessionDir (exit metadata via tmp+rename, socket/pid cleanup). When that raced afterAll's recursive rmSync of testRoot, a file re-created into a just-emptied dir threw ENOTEMPTY — a false-red that flaked the required vitest gate. Fix: afterEach now WAITS (bounded, 5s) for every spawned daemon to leave the process table before removing files, so nothing is writing during teardown. Also bumped the rmSync retries (3 -> 10) as belt-and-suspenders. Verified: 4 repeat runs of both files with 0 ENOTEMPTY; full suite green; typecheck clean.
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.
Fix both required-gate flakes
The vitest gate flaked twice in a row on unrelated tests. This fixes both at the source.
1. ENOTEMPTY teardown race (
parity-shapes/parity-fixtures)These suites spawn session daemons (
pty run -d) andafterEachonly SIGTERM'dthem and returned immediately — a daemon still shutting down keeps writing into
its
sessionDir(exit metadata via tmp+rename, socket/pid cleanup); when thatraces
afterAll's recursivermSync, a file re-created into a just-emptied dirthrows ENOTEMPTY. Fix:
afterEachnow waits (bounded 5s) for every spawneddaemon to leave the process table before removing files. Applied to both files
(same wait-less pattern),
rmSyncretries bumped 3→10.2.
waitForTextrender-poll timeout (screenshot.test.ts)screenshot.test.ts > preserves 256-color codestimed out at 5000ms waitingfor text. #116 raised vitest's
testTimeoutto 15000ms, but the real 5000ms iswaitForText's own internal poll timeout (src/testing/session.ts), which#116 never touched — so terminal render under CI load still tripped it (#116
fixed the true-color symptom; the underlying too-tight poll budget resurfaced on
256-color). Fix: raise the
waitForText/waitForAbsent/waitFordefault5000→10000ms, matching the explicit 10000–15000ms render-heavy tests already
pass (
scrollback-fidelity.test.ts) and staying under screenshot's 15000msvitest
testTimeout. Only affects failure/slow-wait latency.Verification
Parity fix: 4 repeat runs, 0 ENOTEMPTY. Screenshot fix: render suites green (49),
no regression (can't reproduce the CI-load timing flake locally, but 10000ms
gives 2× headroom). Full suite green; typecheck clean. Test-only + a
test-support-library default; no product behavior change.