Skip to content

[🐛 Bug]: [bidi] Generated layers don't hold list elements to their declared types #18193

Open

Description

@titusfortner

Description

ADR 17786 decision 4 holds every value to its declared type, and decisions 5 and 7 enforce that before sending and on receipt. A review finding on #18190 led to a survey of the generated BiDi layers, which found three cases where list elements aren't held to their element type. Map values are tracked in #18106. .NET is left out because its BiDi layer is hand-written.

1. Primitive list elements

A wrong-typed element in a list of primitives (session.SubscribeParameters.events, session.ManualProxyConfiguration.noProxy) should error before sending and raise on receipt. Python, Java and JavaScript already do.

  • Ruby: emit the element primitive for list fields in the generator (today events renders as {wire_key: 'events', list: true}), and check each element against it in Record before sending (rb/lib/selenium/webdriver/bidi/serialization/record.rb:129 skips the primitive check for lists) and on receipt (read returns lists without checking their elements).

2. null list elements

A null element in a list whose element type isn't nullable should be rejected. JavaScript already does.

  • Ruby: reject a nil element in Record before sending and on receipt, unless the element type is nullable. Today primitive lists accept [1, nil] in both directions, and enum lists accept nil on receipt (Serialization.to_symbol returns nil for a nil element) though they reject it when sending. Lists of records and unions already reject it.
  • Python: reject a None element before sending and on receipt, unless the element type is nullable. _validate_outbound_scalar returns early on None (py/selenium/webdriver/common/_bidi/serialization.py:500), and _read_scalar skips its primitive check for None (:428).
  • Java: reject a JSON null element on receipt, unless the element type is nullable. JsonTypeCoercer returns null for it (java/src/org/openqa/selenium/json/JsonTypeCoercer.java:146). Sending already rejects it.

3. Union list elements

An element outside a list's union of scalars should be rejected. browsingContext.PrintParameters.pageRanges is a list of js-uint / text. JavaScript already does.

  • Ruby: emit the allowed primitives for a list whose elements are a union of scalars (today pageRanges renders as {wire_key: 'pageRanges', required: false, list: true}), and check each element against them in Record before sending and on receipt.
  • Python: resolve a union of scalars to the set of allowed primitives instead of Any (py/generate_bidi_protocol.py:687), and check each element of pageRanges against it before sending and on receipt. Today it is list[Any].
  • Java: check each element of a union-typed list against the union's arms before sending and on receipt. Today a union element resolves to Object (java/src/org/openqa/selenium/bidi/BiDiGenerator.java:1960), so pageRanges is an unchecked List<Object>, and script.MappingLocalValue and script.MappingRemoteValue entries are unchecked List<List<Object>>.

Activity

  1. added
    C-pyPython Bindings
    C-rbRuby Bindings
    C-javaJava Bindings
    I-defectSomething is not working as intended
    B-devtoolsIncludes everything BiDi or Chrome DevTools related
    and removed
    C-rbRuby Bindings
    on Oct 17, 2026
  2. Bowen-Xue-ac2 commented on Oct 21, 2026

    @Bowen-Xue-ac2

    Hi there, I opened #18216 (Python) and #18217 (Java), but I have not been able to complete the CLA signing process. Both CLA Assistant links return “no healthy upstream”, and the homepage returns the same error. Is there an alternative signing process, or should I retry once the service is available? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-devtoolsIncludes everything BiDi or Chrome DevTools relatedC-javaJava BindingsC-pyPython BindingsI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions