Skip to content

[build] update BiDi schema generation to include external spec methods missing due to upstream spec omissions - #18057

Merged
titusfortner merged 2 commits into
SeleniumHQ:trunkfrom
titusfortner:bidi-incomplete-overlays
Sep 20, 2026
Merged

titusfortner merged 2 commits into
SeleniumHQ:trunkfrom
titusfortner:bidi-incomplete-overlays

Conversation

@titusfortner

Copy link
Copy Markdown
Member

🔗 Related Issues

Builds on #18055

💥 What does this PR do?

  • Add patches to fix issues with the Bluetooth and digitalCredentials CDDL integration
  • Remove the hack that was written to ignore those as being incomplete
  • The update_cddl run adds the previously missing command and events to the generated bindings

🔧 Implementation Notes

  • Each gap is closed by a CDDL overlay in common/bidi that redefines the aggregate (DigitalCredentialsCommand, BluetoothEvent), applied through the existing override_cddl_files
  • Deletes METHOD_DOMAIN_MAP from the JS generator: the model now takes the method's <domain>. prefix as-is (as Ruby and Python already do) and the TypeScript stage fails on a domain missing from DOMAIN_FILES, instead of silently filing unknown domains under common, which is what let these slip.

🤖 AI assistance

  • AI assisted (complete below)
    • Tool(s): Claude Code (Fable 5.1)
    • What was generated: the overlays and wiring, the diagnosis of the common fallback, and this description
    • I reviewed all AI output and can explain the change

💡 Additional Considerations

  • Should open upstream PRs to w3c-fedid/digital-credentials and WebBluetoothCG/web-bluetooth so Selenium does not have to support a workaround

🔄 Types of changes

  • New feature (non-breaking change which adds functionality and tests!) — one command and two events in the internal BiDi protocol layers

@selenium-ci selenium-ci added C-py Python Bindings C-rb Ruby Bindings C-nodejs JavaScript Bindings B-build Includes scripting, bazel and CI integrations B-devtools Includes everything BiDi or Chrome DevTools related labels Sep 20, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Generate missing BiDi methods through spec-shaped CDDL overlays

✨ Enhancement 🐞 Bug fix 🧪 Tests ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Replace incomplete-method allowlisting with spec-shaped overlays for missing Bluetooth and Digital
 Credentials aggregates.
• Generate one Digital Credentials command and two Bluetooth events across BiDi bindings.
• Reject unmapped JavaScript generator domains instead of silently routing them to common.
Diagram

graph TD
  A["Pinned Webref"] -->|"overlaid by"| B["CDDL Overlays"] -->|"parsed by"| C["Schema Projector"] -->|"emits"| D["Shared Schema"] -->|"consumed by"| E["Language Generators"] -->|"produces"| F["BiDi Bindings"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Fix upstream specifications first
  • ➕ Eliminates Selenium-maintained compatibility overlays
  • ➕ Keeps aggregate definitions authoritative in their originating specifications
  • ➖ Blocks complete bindings until both specifications and the pinned Webref revision update
  • ➖ Leaves current generated bindings incomplete
2. Patch the projected model directly
  • ➕ Avoids adding local CDDL productions
  • ➕ Can inject missing methods after parsing
  • ➖ Encodes specification exceptions in generator logic
  • ➖ Risks inconsistent behavior across language generators
  • ➖ Bypasses normal CDDL completeness and directionality analysis

Recommendation: Use the PR's CDDL overlays as the interim solution because they repair discovery at the shared specification layer and benefit every language generator consistently. Submit corresponding upstream specification fixes, then remove each overlay once the pinned Webref revision contains the corrected aggregates.

Files changed (14) +220 / -93

Enhancement (5) +126 / -23
generate_bidi.mjsAdd Digital Credentials output and strict domain validation +9/-21

Add Digital Credentials output and strict domain validation

• Adds TypeScript file, class, and name-prefix mappings for Digital Credentials. Method domains now come directly from their protocol prefix, and generation fails when a domain lacks an explicit output mapping.

javascript/selenium-webdriver/generate_bidi.mjs

protocol.rbLoad the Ruby Digital Credentials protocol domain +1/-0

Load the Ruby Digital Credentials protocol domain

• Requires the newly generated Digital Credentials protocol implementation from the Ruby BiDi protocol entry point.

rb/lib/selenium/webdriver/bidi/protocol.rb

bluetooth.rbExpose the missing Bluetooth events in Ruby +6/-2

Expose the missing Bluetooth events in Ruby

• Registers characteristic and descriptor generated events and maps their payloads to the corresponding generated parameter records.

rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb

digital_credentials.rbGenerate the Ruby Digital Credentials command domain +69/-0

Generate the Ruby Digital Credentials command domain

• Adds the Digital Credentials protocol domain, virtual wallet action enum, serialized parameters, validation, and 'set_virtual_wallet_behavior' command.

rb/lib/selenium/webdriver/bidi/protocol/digital_credentials.rb

digital_credentials.rbsAdd Ruby signatures for Digital Credentials +41/-0

Add Ruby signatures for Digital Credentials

• Defines RBS types for the generated domain, command parameters, action enum, and command method.

rb/sig/lib/selenium/webdriver/bidi/protocol/digital_credentials.rbs

Bug fix (3) +18 / -19
digital-credentials-command.cddlDefine the missing Digital Credentials command aggregate +7/-0

Define the missing Digital Credentials command aggregate

• Adds a temporary spec-shaped aggregate exposing 'setVirtualWalletBehavior' to command discovery. The comments document when the overlay can be removed.

common/bidi/digital-credentials-command.cddl

web-bluetooth-events.cddlComplete the Bluetooth event aggregate +10/-0

Complete the Bluetooth event aggregate

• Overrides the upstream aggregate to include characteristic and descriptor generated events alongside the existing two events.

common/bidi/web-bluetooth-events.cddl

project_bidi_schema.mjsRemove the incomplete-method completeness bypass +1/-19

Remove the incomplete-method completeness bypass

• Deletes the known-incomplete allowlist and requires every parsed protocol method to appear in the projected schema.

javascript/selenium-webdriver/project_bidi_schema.mjs

Tests (1) +0 / -21
project_bidi_schema_test.mjsRemove obsolete allowlist-specific completeness tests +0/-21

Remove obsolete allowlist-specific completeness tests

• Deletes tests for accepting allowlisted drops and detecting stale allowlist entries now that completeness has no exceptions.

javascript/selenium-webdriver/project_bidi_schema_test.mjs

Other (5) +76 / -30
schema.jsonRegenerate the shared schema with missing BiDi methods +68/-27

Regenerate the shared schema with missing BiDi methods

• Adds the Digital Credentials command and two Bluetooth events with corrected directionality. Regenerates aggregate definitions and selectors so downstream bindings can consume the methods.

common/bidi/schema.json

webref_cddl.bzlAdvance the pinned Webref CDDL revision +1/-1

Advance the pinned Webref CDDL revision

• Updates the Webref commit used to download CDDL grammars and definition indexes.

common/webref_cddl.bzl

BUILD.bazelApply the new CDDL overlays during BiDi generation +5/-2

Apply the new CDDL overlays during BiDi generation

• Registers the Digital Credentials and Web Bluetooth overlays with the existing override pipeline and documents their purpose.

javascript/selenium-webdriver/BUILD.bazel

generate_bidi.bzlDeclare the generated Digital Credentials TypeScript module +1/-0

Declare the generated Digital Credentials TypeScript module

• Adds 'digital_credentials.ts' to the Bazel-declared TypeScript outputs so the new domain is generated and compiled.

javascript/selenium-webdriver/private/generate_bidi.bzl

generate_bidi_protocol.bzlDeclare the generated Python Digital Credentials module +1/-0

Declare the generated Python Digital Credentials module

• Adds 'digital_credentials' to the Python generator's required domain module outputs.

py/private/generate_bidi_protocol.bzl

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@titusfortner titusfortner changed the title [build] replace the BiDi KNOWN_INCOMPLETE allowlist with spec-shaped CDDL overlays [build] update BiDi schema generation to include external spec methods missing due to upstream spec omissions Sep 20, 2026
@titusfortner
titusfortner merged commit e93424f into SeleniumHQ:trunk Sep 20, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-devtools Includes everything BiDi or Chrome DevTools related C-nodejs JavaScript Bindings C-py Python Bindings C-rb Ruby Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants