Skip to content

fix: coalesce concurrent watch-mode restarts, deflake the pool stderr fixture - #10822

Merged
sheremet-va merged 2 commits into
mainfrom
fix/ci-flakes
Jul 24, 2026
Merged

fix: coalesce concurrent watch-mode restarts, deflake the pool stderr fixture#10822
sheremet-va merged 2 commits into
mainfrom
fix/ci-flakes

Conversation

@sheremet-va

Copy link
Copy Markdown
Member

Analysis of the recent CI failure increase across main and PR branches (runs from Jul 21-23). Two of the recurring clusters are root-caused and fixed here; the rest are catalogued below with evidence.

Fixed

1. Windows/macOS e2e: unhandled TypeError: Cannot read properties of undefined (reading 'logger') (main runs 30009378686, 29992865327, 29926056935; attributed to file-watching.test.ts)

The stack is _restart → report('onServerRestart') → VerboseReporter.log → this.ctx.logger. _start re-creates the reporters (this.reporters = await createReporters(...)) but ctx is only assigned later by the onInit report. Chokidar regularly fires several change events for one config edit; a second _restart beginning inside that window reports onServerRestart to constructed-but-uninitialized reporters. Fix: requests arriving during an in-flight restart coalesce into one trailing restart (which re-resolves the config from scratch, so it picks up whatever changed meanwhile). Regression test drives three concurrent _restart calls and verifies the instance still reruns.

2. e2e pool.test.ts > can capture worker's stdout and stderr (main runs 29805385576, 29923860728; also on unrelated PR branches)

The fixture triggers a MaxListenersExceededWarning and the test asserts it in captured stderr, but process.emitWarning prints on a later tick and the test body was synchronous — a fast worker teardown exits before the warning reaches stderr. The fixture now awaits the warning event plus one tick.

Catalogued, not fixed here

  • Browser CDP/mock race familycdp.test.ts > cdp sends events correctly, mock-importActual (browser+coverage), mocking.test.ts > mocking dependency correctly invalidates it on rerun, 1_mocked-on-watch-change, and runner.test.ts > tests are actually running (fails on a stderr-must-be-empty assertion polluted by the cdp failure). One family: module mocks and CDP events race the module fetch because delivery is CDP-only. Needs dedicated work; a naive interceptor-fallback was already tried and hangs.
  • pool-worker-exit.test.ts > worker death on a shared runner does not skip coverage finalization (macOS, main 30010040100) — after two worker crashes, 3-crash.test.ts/4-third.test.ts are entirely absent from the reported tree, i.e. the queued files were never scheduled onto a replacement worker before the run finalized. This is a crash-recovery scheduling race in the pool, not test timing — needs its own investigation.
  • Browser hooks-timeout.test.ts — hook-timeout assertions sporadically observe Playwright's own locator.click: Timeout 249ms exceeded instead of the expected hook timeout; timing-margin dependent.
  • import-durations.test.ts > should handle tests with no imports gracefully (main 29825620887) — exit code 1 instead of 0; the captured log doesn't include the cause.

None of the failures on the three split PRs (#10820, #10821, #10710) are introduced by their changes — each maps to one of the clusters above, all of which reproduce on main or on unrelated branches.

… fixture

Chokidar regularly fires several change events for one config edit. A
restart beginning while another was still re-creating the servers
reported onServerRestart to reporters that were re-instantiated but not
yet initialized (ctx is only assigned by onInit), crashing the e2e run
with "Cannot read properties of undefined (reading 'logger')". Requests
arriving during a restart now coalesce into one trailing restart.

The pool fixture asserted a MaxListenersExceededWarning in captured
stderr but never waited for it: emitWarning prints asynchronously, so a
fast worker teardown could exit before the warning reached stderr.
@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 3a484d6
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a6237b0f80245000805c6ca
😎 Deploy Preview https://deploy-preview-10822--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sheremet-va
sheremet-va merged commit a31f86a into main Jul 24, 2026
27 checks passed
@sheremet-va
sheremet-va deleted the fix/ci-flakes branch July 24, 2026 14:01
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo