Skip to content

feat(py): extend create-bidi-src with full set of BiDi-adjacent CDDL …#17378

Merged
AutomatedTester merged 4 commits into
trunkfrom
extend-bidi-features
Apr 27, 2026
Merged

feat(py): extend create-bidi-src with full set of BiDi-adjacent CDDL …#17378
AutomatedTester merged 4 commits into
trunkfrom
extend-bidi-features

Conversation

@AutomatedTester
Copy link
Copy Markdown
Member

…specs

Include permissions, prefetch (speculation), ua-client-hints, and web-bluetooth all.cddl files from the webref_cddl_extension added in #17372. This gives end users the complete set of BiDi-adjacent modules generated from the W3C spec:

New modules: bluetooth, speculation, user_agent_client_hints AT Driver (interaction, settings) excluded for now — can be added when ready by including @at_driver_all_cddl and declaring those modules.

Changes:

  • generate_bidi.bzl: add extra_cddl_files attr; merge step using cat; declare new output modules
  • py/BUILD.bazel: wire up the four new _all_cddl targets
  • generate_bidi.py: remove hardcoded generate_permissions_file(); the permissions module is now fully driven by permissions-all.cddl
  • bidi_enhancements_manifest.py: add permissions enhancements restoring the high-level set_permission() API, including embeddedOrigin support that the old hardcoded version was missing

🔗 Related Issues

💥 What does this PR do?

🔧 Implementation Notes

🤖 AI assistance

  • No substantial AI assistance used
  • AI assisted (complete below)
    • Tool(s):
    • What was generated:
    • I reviewed all AI output and can explain the change

💡 Additional Considerations

🔄 Types of changes

  • New feature (non-breaking change which adds functionality and tests!)

Copilot AI review requested due to automatic review settings April 23, 2026 19:49
@selenium-ci selenium-ci added C-py Python Bindings B-build Includes scripting, bazel and CI integrations labels Apr 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the Python BiDi code-generation pipeline to include additional “BiDi-adjacent” CDDL specs (permissions, prefetch/speculation, UA client hints, web-bluetooth) and restores higher-level permissions conveniences via the enhancements manifest.

Changes:

  • Adds extra_cddl_files support to the Bazel generate_bidi rule and merges multiple CDDL inputs before generation.
  • Wires additional *_all_cddl specs into the Python create-bidi-src generation target and declares new output modules.
  • Removes the hardcoded permissions module generation in generate_bidi.py and reintroduces set_permission() API behavior via bidi_enhancements_manifest.py.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
py/private/generate_bidi.bzl Adds extra_cddl_files and concatenates multiple CDDL inputs; updates declared module outputs.
py/BUILD.bazel Wires additional downloaded CDDL specs into the create-bidi-src target.
py/generate_bidi.py Removes the bespoke generate_permissions_file() generation path so permissions come from CDDL.
py/private/bidi_enhancements_manifest.py Adds permissions enhancements (PermissionDescriptor + set_permission() helper) including embedded-origin support.

Comment thread py/private/bidi_enhancements_manifest.py
Comment thread py/private/generate_bidi.bzl Outdated
Comment thread py/private/bidi_enhancements_manifest.py Outdated
AutomatedTester added a commit that referenced this pull request Apr 24, 2026
- generate_bidi.bzl: replace cat-based merge with a hermetic Python
  script written via ctx.actions.write + ctx.actions.run, fixing
  portability on Windows where cat is unavailable

- bidi_enhancements_manifest.py: make embedded_origin keyword-only in
  set_permission() by moving it after user_context with a * separator,
  preserving the existing positional call signature
  (descriptor, state, origin, user_context)

- bidi_permissions_tests.py: add two new tests:
  - test_embedded_origin_is_keyword_only: guards against regression of
    the positional API (4th arg must remain user_context, not
    embedded_origin)
  - test_can_set_permission_with_embedded_origin: exercises the
    embedded_origin keyword arg end-to-end, verifying embeddedOrigin
    serialization in the BiDi command params

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 24, 2026 10:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Comment thread py/test/selenium/webdriver/common/bidi_permissions_tests.py Outdated
Comment thread py/private/merge_cddl.py Outdated
Comment thread py/private/generate_bidi.bzl
Comment thread py/private/bidi_enhancements_manifest.py Outdated
Comment thread py/test/selenium/webdriver/common/bidi_permissions_tests.py
AutomatedTester added a commit that referenced this pull request Apr 24, 2026
- merge_cddl.py: add arg validation (usage + SystemExit(1) if < 2 args)
  and insert a newline separator between files to prevent token-joining
- generate_bidi.bzl: make merge_tool optional (mandatory=False); add
  explicit fail() when extra_cddl_files is set without merge_tool
- bidi_enhancements_manifest.py: drop spurious return from
  set_permission (annotated -> None, was returning execute() result)
- bidi_permissions_tests.py: add pytest.raises(TypeError) for 5th
  positional arg in test_embedded_origin_is_keyword_only; fix
  test_can_set_permission_with_embedded_origin docstring to accurately
  describe what is tested

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AutomatedTester and others added 4 commits April 25, 2026 12:52
…specs

Include permissions, prefetch (speculation), ua-client-hints, and
web-bluetooth all.cddl files from the webref_cddl_extension added in
#17372. This gives end users the complete set of BiDi-adjacent modules
generated from the W3C spec:

New modules: bluetooth, speculation, user_agent_client_hints
AT Driver (interaction, settings) excluded for now — can be added
when ready by including @at_driver_all_cddl and declaring those modules.

Changes:
- generate_bidi.bzl: add extra_cddl_files attr; merge step using cat;
  declare new output modules
- py/BUILD.bazel: wire up the four new _all_cddl targets
- generate_bidi.py: remove hardcoded generate_permissions_file(); the
  permissions module is now fully driven by permissions-all.cddl
- bidi_enhancements_manifest.py: add permissions enhancements restoring
  the high-level set_permission() API, including embeddedOrigin support
  that the old hardcoded version was missing

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- generate_bidi.bzl: replace cat-based merge with a hermetic Python
  script written via ctx.actions.write + ctx.actions.run, fixing
  portability on Windows where cat is unavailable

- bidi_enhancements_manifest.py: make embedded_origin keyword-only in
  set_permission() by moving it after user_context with a * separator,
  preserving the existing positional call signature
  (descriptor, state, origin, user_context)

- bidi_permissions_tests.py: add two new tests:
  - test_embedded_origin_is_keyword_only: guards against regression of
    the positional API (4th arg must remain user_context, not
    embedded_origin)
  - test_can_set_permission_with_embedded_origin: exercises the
    embedded_origin keyword arg end-to-end, verifying embeddedOrigin
    serialization in the BiDi command params

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the inline ctx.actions.write + hardcoded Python string in
generate_bidi.bzl with a standalone py_binary, consistent with how the
generator itself is wired up.

- py/private/merge_cddl.py: new tool that concatenates CDDL files
- py/private/BUILD.bazel: declare merge_cddl py_binary
- py/private/generate_bidi.bzl: add merge_tool attr (executable, cfg=exec);
  drop ctx.actions.write — merge step is now a plain ctx.actions.run
- py/BUILD.bazel: wire merge_tool = "//py/private:merge_cddl"

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- merge_cddl.py: add arg validation (usage + SystemExit(1) if < 2 args)
  and insert a newline separator between files to prevent token-joining
- generate_bidi.bzl: make merge_tool optional (mandatory=False); add
  explicit fail() when extra_cddl_files is set without merge_tool
- bidi_enhancements_manifest.py: drop spurious return from
  set_permission (annotated -> None, was returning execute() result)
- bidi_permissions_tests.py: add pytest.raises(TypeError) for 5th
  positional arg in test_embedded_origin_is_keyword_only; fix
  test_can_set_permission_with_embedded_origin docstring to accurately
  describe what is tested

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 25, 2026 11:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@AutomatedTester AutomatedTester merged commit b95cd1f into trunk Apr 27, 2026
41 of 42 checks passed
@AutomatedTester AutomatedTester deleted the extend-bidi-features branch April 27, 2026 08:53
AutomatedTester added a commit that referenced this pull request Apr 27, 2026
- generate_bidi.bzl: replace cat-based merge with a hermetic Python
  script written via ctx.actions.write + ctx.actions.run, fixing
  portability on Windows where cat is unavailable

- bidi_enhancements_manifest.py: make embedded_origin keyword-only in
  set_permission() by moving it after user_context with a * separator,
  preserving the existing positional call signature
  (descriptor, state, origin, user_context)

- bidi_permissions_tests.py: add two new tests:
  - test_embedded_origin_is_keyword_only: guards against regression of
    the positional API (4th arg must remain user_context, not
    embedded_origin)
  - test_can_set_permission_with_embedded_origin: exercises the
    embedded_origin keyword arg end-to-end, verifying embeddedOrigin
    serialization in the BiDi command params

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AutomatedTester added a commit that referenced this pull request Apr 27, 2026
- merge_cddl.py: add arg validation (usage + SystemExit(1) if < 2 args)
  and insert a newline separator between files to prevent token-joining
- generate_bidi.bzl: make merge_tool optional (mandatory=False); add
  explicit fail() when extra_cddl_files is set without merge_tool
- bidi_enhancements_manifest.py: drop spurious return from
  set_permission (annotated -> None, was returning execute() result)
- bidi_permissions_tests.py: add pytest.raises(TypeError) for 5th
  positional arg in test_embedded_origin_is_keyword_only; fix
  test_can_set_permission_with_embedded_origin docstring to accurately
  describe what is tested

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 C-py Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants