fix: coalesce concurrent watch-mode restarts, deflake the pool stderr fixture - #10822
Merged
Conversation
… 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.
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
macarie
approved these changes
Jul 24, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 tofile-watching.test.ts)The stack is
_restart → report('onServerRestart') → VerboseReporter.log → this.ctx.logger._startre-creates the reporters (this.reporters = await createReporters(...)) butctxis only assigned later by theonInitreport. Chokidar regularly fires several change events for one config edit; a second_restartbeginning inside that window reportsonServerRestartto 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_restartcalls 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
MaxListenersExceededWarningand the test asserts it in captured stderr, butprocess.emitWarningprints on a later tick and the test body was synchronous — a fast worker teardown exits before the warning reaches stderr. The fixture now awaits thewarningevent plus one tick.Catalogued, not fixed here
cdp.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, andrunner.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.tsare 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.hooks-timeout.test.ts— hook-timeout assertions sporadically observe Playwright's ownlocator.click: Timeout 249ms exceededinstead 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
mainor on unrelated branches.