Skip to content

test: fix both required-gate flakes (parity teardown ENOTEMPTY + screenshot render timeout) - #119

Merged
myobie merged 1 commit into
mainfrom
fix/parity-teardown-enotempty-flake
Jul 22, 2026
Merged

test: fix both required-gate flakes (parity teardown ENOTEMPTY + screenshot render timeout)#119
myobie merged 1 commit into
mainfrom
fix/parity-teardown-enotempty-flake

Conversation

@myobie

@myobie myobie commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

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) and afterEach only SIGTERM'd
them and returned immediately — a daemon still shutting down keeps writing into
its sessionDir (exit metadata via tmp+rename, socket/pid cleanup); when that
races afterAll's recursive rmSync, a file re-created into a just-emptied dir
throws ENOTEMPTY. Fix: afterEach now waits (bounded 5s) for every spawned
daemon to leave the process table
before removing files. Applied to both files
(same wait-less pattern), rmSync retries bumped 3→10.

2. waitForText render-poll timeout (screenshot.test.ts)

screenshot.test.ts > preserves 256-color codes timed out at 5000ms waiting
for text. #116 raised vitest's testTimeout to 15000ms, but the real 5000ms is
waitForText'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/waitFor default
5000→10000ms, matching the explicit 10000–15000ms render-heavy tests already
pass (scrollback-fidelity.test.ts) and staying under screenshot's 15000ms
vitest 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.

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.
@myobie
myobie merged commit 55a6d0a into main Jul 22, 2026
2 of 3 checks passed
@myobie myobie changed the title test(parity): fix ENOTEMPTY teardown flake in the R2 fixture suites test: fix both required-gate flakes (parity teardown ENOTEMPTY + screenshot render timeout) Jul 22, 2026
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