feat(py): extend create-bidi-src with full set of BiDi-adjacent CDDL …#17378
Merged
Conversation
Contributor
There was a problem hiding this comment.
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_filessupport to the Bazelgenerate_bidirule and merges multiple CDDL inputs before generation. - Wires additional
*_all_cddlspecs into the Pythoncreate-bidi-srcgeneration target and declares new output modules. - Removes the hardcoded permissions module generation in
generate_bidi.pyand reintroducesset_permission()API behavior viabidi_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. |
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>
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>
…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>
6c1f2aa to
9adba4b
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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:
🔗 Related Issues
💥 What does this PR do?
🔧 Implementation Notes
🤖 AI assistance
💡 Additional Considerations
🔄 Types of changes