[Bug]: [py] Generated bidi.UserAgentClientHints is empty — inline CDDL params drop the command
メンテナーはふだん 1 日以内に返信
@titusfortner がすでに取り組んでいます。
2026年11月13日 から。
評価
この issue はまだ評価されていません。
説明
Description
What I was trying to do
Call the WebDriver BiDi userAgentClientHints.setClientHintsOverride command from Python's public API, i.e. selenium.webdriver.common.bidi.UserAgentClientHints.
What I expected
The generated facade class to expose set_client_hints_override, the way the other generated BiDi modules expose their commands.
What actually happens
The class is generated with no methods at all — just __init__ and pass. It is the only one of the 21 generated facade modules in that state.
The command itself is not missing from the project: the internal selenium.webdriver.common._bidi.UserAgentClientHints.set_client_hints_override works, because that layer is generated from common/bidi/schema.json, which the JS pipeline normalises first (normalize_bidi_ast.mjs hoists the inline block into a synthetic userAgentClientHints.SetClientHintsOverrideCommandParams). Ruby's protocol layer has it for the same reason. Only the Python facade, which parses the CDDL directly, loses it.
Root cause
py/generate_bidi.py extracts commands with a pattern that only accepts a named params type:
method:\s*['\"]([^'\"]+)['\"],\s*params:\s*(\w+(?:\.\w+)*)
The pinned ua-client-hints grammar declares its params inline instead:
userAgentClientHints.SetClientHintsOverrideCommand = {
method: "userAgentClientHints.setClientHintsOverride",
params: {
clientHints: userAgentClientHints.ClientHintsMetadata / null,
? contexts: [+text],
? userContexts: [+text],
}
}
So the command matches nothing and is dropped with no diagnostic. _extract_types also skips the definition, because it contains method:, so the params record is never emitted either. Scanning the merged spec, this is the only command written that way — the other 110 all use named params, which is why nothing else is affected and why this went unnoticed.
It has been this way since #17378 (2026-04-27) added the extra CDDL specs. No test covers the public module, and the generator has no guard for a module that ends up with types but zero commands and zero events.
What I'd like to know before sending a patch
docs/decisions/17670-bidi-implementation-boundaries.md (Accepted) says the bidi modules are internal/unsupported and the supported API should be protocol-neutral, and #17814 tracks marking Python's bidi modules as internal. That makes the right fix a judgement call rather than an obvious one, so I'd rather ask than guess:
- Tooling fix only — hoist inline params into a named type so the generator stops dropping spec content, warn when a module would be emitted empty, and leave the facade class empty on purpose. Fixes the silent drop, changes nothing a user can call. I have this working with unit tests.
- Also expose the method — add a hand-shaped
set_client_hints_overrideto the manifest, likeemulation.set_geolocation_override. This genuinely closes the gap, but it adds a method to a surface ADR 17670 is retiring. Two traps make the plain generated template unusable here: it stripsNone, so it could never send the explicitclientHints: nullthat clears an override, and the generated dataclasses use snake_case fields with no camelCase serialiser. I have this working too, with a browser test passing on Chrome. - Neither — if the public
bidifacade is on its way out, the empty class is arguably correct and this should just be documented.
Happy to open a PR for whichever you prefer. No other binding has a supported API for this either (Java/.NET none, Ruby protocol-only and @api private), so if the answer is 2, it is probably worth a cross-binding discussion first.
Reproducible Code
# Generate the Python BiDi facade from the pinned CDDL specs
bazel build //py:create-bidi-src
# The generated public module has no commands -- it ends with:
#
# class UserAgentClientHints:
# """BiDi interface for overriding User-Agent Client Hints."""
#
# def __init__(self, conn) -> None:
# self._conn = conn
#
# pass
# It is the only one of the 21 generated facade modules in that state:
grep -l '^ pass$' bazel-bin/py/selenium/webdriver/common/bidi/*.py
# -> bazel-bin/py/selenium/webdriver/common/bidi/user_agent_client_hints.py
# Public facade: __init__ only. Internal layer: has the command.
grep ' def ' py/selenium/webdriver/common/bidi/user_agent_client_hints.py
# -> def __init__(self, conn) -> None:
grep ' def ' py/selenium/webdriver/common/_bidi/user_agent_client_hints.py
# -> def set_client_hints_override(
# The single inline-params command in the merged spec, vs 110 named ones:
grep -c 'method:' bazel-bin/py/merged_bidi.cddl
python - <<'PY'
import re, pathlib
c = pathlib.Path("bazel-bin/py/merged_bidi.cddl").read_text()
inline = re.findall(r'method:\s*"([^"]+)",\s*params:\s*\{', c)
named = re.findall(r'method:\s*"([^"]+)",\s*params:\s*(\w+(?:\.\w+)*)', c)
print("inline params:", inline) # ['userAgentClientHints.setClientHintsOverride']
print("named params :", len(named)) # 110
PY
- 主要言語
- Java
- スター
- 34.6k
- フォーク
- 8.7k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 86
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SeleniumHQ/selenium のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
SeleniumHQ/selenium#18323 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
SeleniumHQ/selenium#17843 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[java] DriverFinderTest property fixture doesn't clear/restore selenium.webdriver.verbose再び着手できるかも @stefanpoia が 25 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
SeleniumHQ/selenium#17836 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
A-needs-triaging C-java D-chrome D-firefox I-defect OS-linux
難易度 4/5 1〜2日 初心者へのやさしさ 53/100
SeleniumHQ/selenium#18324 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
A-needs-triaging B-grid I-defect OS-mac
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
SeleniumHQ/selenium#18304 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
SeleniumHQ/selenium の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
btraceio/jafar#228 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
jenkinsci/git-client-plugin#1807 ·
-
area-templates triage:bot-seen triage:needs-human
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoft/aspire#22356 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
apache/flink-agents#1395 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
floci-io/floci#8666 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信