[Bug]: [py] Generated bidi.UserAgentClientHints is empty — inline CDDL params drop the command
Los mantenedores suelen responder en 1 día
@titusfortner ya está trabajando en esto.
Desde el 13/11/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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
- Lenguaje dominante
- Java
- Estrellas
- 34.6k
- Forks
- 8.7k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 86
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de SeleniumHQ/selenium
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
SeleniumHQ/selenium#18323 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
SeleniumHQ/selenium#17843 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[java] DriverFinderTest property fixture doesn't clear/restore selenium.webdriver.verboseQuizá libre de nuevo @stefanpoia la tomó hace 25 días y no hay ningún pull request abierto. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
SeleniumHQ/selenium#17836 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
A-needs-triaging C-java D-chrome D-firefox I-defect OS-linux
Dificultad 4/5 1-2 días Aptitud para principiantes 53/100
SeleniumHQ/selenium#18324 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
A-needs-triaging B-grid I-defect OS-mac
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
SeleniumHQ/selenium#18304 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de SeleniumHQ/selenium
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
btraceio/jafar#228 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
jenkinsci/git-client-plugin#1807 ·
-
area-templates triage:bot-seen triage:needs-human
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/aspire#22356 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
apache/flink-agents#1395 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
floci-io/floci#8666 · 1 comentario ·
Los mantenedores suelen responder en 1 día