Repository navigation
feat(v2): add the sync API on top of playwright/_impl_v2 - #3277
Merged
Pavel Feldman (pavelfeldman) merged 1 commit intoOct 20, 2026
Merged
Conversation
Yury Semikhatsky (yury-s)
approved these changes
Oct 20, 2026
PW_IMPL=v2 now switches the sync API too. It is the greenlet mechanism of v1, shared by the two implementations (sync_api/_context_manager.py, _impl/_sync_base.py, _impl/_greenlets.py): a dispatcher fiber runs the event loop, and a sync call switches to it until its task is done. - Every v2 object carries _loop and _dispatcher_fiber for the generated API. The connection runs each channel listener in an EventGreenlet; a route, WebSocket route, binding or locator handler runs through run_in_greenlet(); a predicate runs in the listener. A callback that ran in the dispatcher fiber itself would spin in wait_for_future(). - A sync call runs in a task of the dispatcher, where the caller's stack is not visible: _sync() stores the caller's frame on the task, and capture_raw_stack() continues from it (API names, trace stacks). - The stop path handles a driver that did not start or exited on its own. - An error of an event listener is logged instead of printed, so that a test run is quiet and a plain script still gets it on stderr. - tests/sync runs under PW_IMPL=v2: conftest, test.sh, test-v2.sh and the three v2 CI bots. The sync legacy tests get the @only_v1 marks of their async twins; the sync ports use the v2 matcher and _wrap_api_call() where the async ports do. The test scripts pass --maxschedchunk=1. - transform.md, section 13, documents the sync layer. Also the polish after the review of the port: the instrumentation list, the buffer validator mode and the DEBUG matcher follow upstream; an error of the eager part of an API call is raised as it is, without the API name (deliberate); the test server ignores finish() after the client went away, BT-034 suppresses Node's certificate warning. The lint checks run in the Lint job, not as a git hook: the docs drop `pre-commit install`.
Pavel Feldman (pavelfeldman)
force-pushed
the
v2-polish
branch
from
October 20, 2026 22:12
4104f6e to
f0f9554
Compare
Pavel Feldman (pavelfeldman)
merged commit Oct 20, 2026
4e1ce7a
into
microsoft:main
30 of 32 checks passed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
PW_IMPL=v2switches the sync API too: the greenlet mechanism of v1, shared. Every v2 object carries_loopand_dispatcher_fiber; channel listeners, route/WebSocket-route/binding/locator handlers run in greenlets of their own; a sync call's stack is read from the caller's frame on the task.tests/syncruns under v2 (conftest, test scripts, the three v2 CI bots); the sync legacy tests get the@only_v1marks of their async twins.transform.mdsection 13 documents the sync layer.DEBUGmatcher, test serverfinish(),test-v2.sh), and the lint checks run in the Lint job, not as a git hook.