Repository navigation
fix(browser): scope request interception to mock-route lifetime (fix #8339) - #11112
Closed
greedyivan wants to merge 2 commits into
Closed
greedyivan wants to merge 2 commits into
greedyivan wants to merge 2 commits into
Conversation
7 tasks done
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Author
|
CI triage for the three failed checks — none trace to this PR's diff:
Retriggering with an empty commit for a fresh sample. |
…dows unit, OOM page-crash flake, oxc snapshot)
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.
Summary
Mock routes are playwright
context.route()handlers; the provider unroutes them when afile ends, so the route count crosses zero between files and playwright toggles CDP
Fetch.disable/Fetch.enable. Chromium acksFetch.enablebefore interception is live,so the first module request of a mocking file can be served unmocked and cached by the ES
registry for the file's lifetime.
This PR scopes the interception to the mock-route lifetime:
the mocker releases the file's imports (probe mechanism from fix(browser): close the mock route interception race (fix #8339) #11083, @cplieger);
teardown), unroute the probe and drop the memo — files without mocks run with zero
interception;
drift from parallel sessions;
interceptionArmTimeout = 2 s(ceil(3 × p99)over 74 measuredarms: 13–30 ms sequential, p99 604 ms including a 32-parallel-sessions run); otherwise it
fails loud.
Non-chromium providers are untouched.
Measurements
chromium,
DEBUG=pw:protocol, 11-file suite (10 mocking files + 1 plain):The +10 pauses are one probe roundtrip per arm.
Tests
test/browser/specs/mocking-interception.test.ts(chromium): oneFetch.enable/Fetch.disablepair per mocking file; one paused probe per arm; zero paused requestsattributable to the non-mocking file; all files green. firefox/webkit: run health.
mocking.test.tsunchanged, green (cross-file leak, rerun invalidation).Fixes #8339. Probe-arming mechanism follows #11083 — this PR narrows its lifetime and adds
the disarm path, per-context serialization, and deadline calibration.