Skip to content

chore: generate typed protocol channels and use them in _impl - #3264

Merged
Pavel Feldman (pavelfeldman) merged 2 commits into
microsoft:mainfrom
pavelfeldman:protocol-types
Oct 16, 2026
Merged

Pavel Feldman (pavelfeldman) merged 2 commits into
microsoft:mainfrom
pavelfeldman:protocol-types

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • Generate typed channels (_protocol_channels.py) and message types (_protocol_types.py) from the protocol spec, like upstream's channels.d.ts: one method per command with the protocol parameters and no defaults, on<Event>/off<Event> per event. Absent optional fields are None.
  • Implementation methods take the Python names that the generated API passes, with no defaults, and send through the typed channels; locals_to_params is gone. mypy now reports each place that must pass a new protocol parameter or option.
  • Fixes found on the way: WebSocketRoute close handlers raised KeyError, locator.dblclick(steps=) raised TypeError, file drops failed on remote browsers, Locator.wait_for leaked handles, Locator.clear was not strict, and unknown keys such as noWaitAfter were sent.

- Generate typed channels (_protocol_channels.py) and message types
  (_protocol_types.py) from the protocol spec, like upstream's
  channels.d.ts. Each command is a method with the protocol parameters and
  no defaults; each event has on<Event>/off<Event>. Absent optional fields
  are None.
- Implementation methods take the Python names that the generated API
  passes, with no defaults, and send through the typed channels.
  locals_to_params is gone. mypy now reports each place that must pass a
  new protocol parameter or option.
- Fix bugs found on the way: WebSocketRoute close handlers raised KeyError,
  locator.dblclick(steps=) raised TypeError, file drops failed on remote
  browsers, Locator.wait_for leaked handles, Locator.clear was not strict,
  and unknown keys such as noWaitAfter were sent.
Also fix the generator header and the roll skill, which still described
the params dicts.
@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit 9d198c0 into microsoft:main Oct 16, 2026
28 of 29 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.

2 participants