[rb] construct the BiDi transport inside the domain from a connection - #17796
Conversation
PR Summary by QodoMove BiDi transport construction into protocol domains
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
19 rules 1. RSpec mocks used for connection
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the Ruby BiDi generated protocol layer so each protocol Domain constructs its own Transport from a raw connection (instead of the remote bridge creating a Transport and passing it down), and updates bridge APIs/signatures accordingly.
Changes:
- Move
BiDi::Transportconstruction intoBiDi::Protocol::Domain#initialize, accepting a “connection-like” object. - Expose
connection(raw WebSocket connection) from the remote bridge instead oftransport. - Update unit specs and RBS signatures to reflect the new construction flow.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| rb/spec/unit/selenium/webdriver/bidi/protocol_spec.rb | Updates protocol-layer unit tests to pass a connection and assert Transport is built internally. |
| rb/sig/lib/selenium/webdriver/remote/bridge.rbs | Replaces transport with connection in the bridge’s typed surface. |
| rb/sig/lib/selenium/webdriver/remote/bidi_bridge.rbs | Updates typed ivars/accessors to expose connection instead of transport. |
| rb/sig/lib/selenium/webdriver/bidi/protocol/domain.rbs | Loosens Domain#initialize type to accept an untyped source. |
| rb/lib/selenium/webdriver/remote/bridge.rb | Renames the base bridge API from transport to connection (raising when BiDi isn’t enabled). |
| rb/lib/selenium/webdriver/remote/bidi_bridge.rb | Stores/exposes the raw websocket as @connection instead of constructing/storing a Transport. |
| rb/lib/selenium/webdriver/bidi/protocol/domain.rb | Constructs a Transport over a connection derived from a Driver bridge or passed directly. |
🔗 Related Issues
💥 What does this PR do?
Moves the BiDi
Transportinto the protocolDomainclasses instead of having the bridge build one and hand it down.Transportexists only to serve the generated domain classes — it's the seam that serializes params, sends them over the socket, and parses the typed reply.Transport.connection, and eachDomainwraps it in its ownTransport.🔧 Implementation Notes
Domain#initializeaccepts aDriveror anything satisfying the connection contract (responds tosend_cmd) and constructs theTransportitself, replacing the earlierTransporttype check. The.rbssignatures loosen tountypedfor the connection accordingly.🤖 AI assistance
💡 Additional Considerations
🔄 Types of changes