Skip to content

test: de-flake whole-group teardown; make CI failures diagnosable#2

Merged
irwansetiawan merged 1 commit into
mainfrom
fix/flaky-group-teardown
Jul 9, 2026
Merged

test: de-flake whole-group teardown; make CI failures diagnosable#2
irwansetiawan merged 1 commit into
mainfrom
fix/flaky-group-teardown

Conversation

@irwansetiawan

Copy link
Copy Markdown
Owner

main went red immediately after the 0.4.0 merge, on a tree identical to one that had just passed CI.

What actually happened

Only ubuntu-latest, 22 failed. macos-latest, 22 passed; the other two jobs were cancelled by fail-fast, which made it look like a four-job failure. The failing assertion was test/process.test.ts:48expected false to be true — i.e. waitForPort(GROUP_PORT, 8000) timed out after 8047ms.

It does not reproduce locally (12/12 clean runs of that file in isolation).

Cause

The multiproc-server fixture starts two node processes — the server plus a fanned-out child that mimics vite→esbuild — before it binds the port. An 8s readiness wait is marginal on a loaded 4-core ubuntu runner, where vitest runs all 31 test files in parallel alongside a 9s rapid-switch stress test. This is a timing flake, not a product bug: the group-teardown behaviour it guards is unchanged and passes everywhere else.

Changes

  • 20s readiness wait for this fixture only. A wait that succeeds costs nothing; only a genuine failure waits longer.
  • On timeout, dump the server's log. expected false to be true told us nothing about the cause; the test now raises server never bound port 39518. Its log: …. Verified by forcing the failure path (binding a different port) and confirming the message prints.
  • fail-fast: false in CI. Cancelling sibling jobs on the first failure destroyed the evidence needed to tell a platform-specific flake from a real regression.

Test-only + CI config. No src/ changes. 114/114 pass locally, typecheck clean.

… message

The whole-group-teardown fixture starts two node processes (server + fanned-out
child) before it binds. An 8s readiness wait is marginal on a loaded ubuntu
runner where vitest runs 31 files in parallel next to a 9s stress test; it
flaked once on main (ubuntu/22 only — macos/22 passed).

- Raise that wait to 20s. A successful wait costs nothing; only failures wait.
- On timeout, dump the server's own log instead of asserting
  'expected false to be true', which said nothing about the cause.
- CI: fail-fast: false. The first failure cancelled the sibling jobs and hid
  whether the flake was platform-specific.
@irwansetiawan
irwansetiawan merged commit fbfbc2d into main Jul 9, 2026
4 checks passed
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