Skip to content

[build] standardize generated-file license and not to edit markers across generators#17816

Merged
titusfortner merged 6 commits into
SeleniumHQ:trunkfrom
titusfortner:standardize-generated-markers
Jul 24, 2026
Merged

[build] standardize generated-file license and not to edit markers across generators#17816
titusfortner merged 6 commits into
SeleniumHQ:trunkfrom
titusfortner:standardize-generated-markers

Conversation

@titusfortner

Copy link
Copy Markdown
Member

🔗 Related Issues

N/A — cleanup/consistency initiative.

💥 What does this PR do?

  • Every code generator in the repo now emits an identical, single-sourced file header: the Apache license followed by a standardized This file is generated by <generator>. DO NOT EDIT! / Regenerate with: <command> marker.
  • Previously each language's generator used its own wording (Any changes will be lost!, AUTO GENERATED, etc.), and the Java CDP generator emitted no marker at all.
  • The license body and the marker wording are each defined in exactly one place, so changing either no longer means hand-editing every generator.
  • Regenerate with: is a concrete, copy-pasteable command in each generated file, not vague prose.
  • update_copyright.py now ensures the Apache header idempotently on every source file — including generated ones — instead of skipping them; its pass is a verified no-op against every generator's output.

🔧 Implementation Notes

  • Canonical text lives in scripts/license_header.txt and scripts/generated_note_template.txt. Python and Ruby get thin helper libs (scripts/generated_note.py, rb/support/generated_note.rb); Java and JS format the shared template inline — each language reads the same files because none can import another's helper.
  • Generators reach the shared files as build-time siblings: a copy_file per Bazel package for Python/JS, the Runfiles API for Java, and Bazel::Runfiles (the lib added in [rb] resolve spec runfiles via Bazel::Runfiles #17810) for Ruby — avoiding repo-root path arithmetic.
  • Ruby needs one temporary bridge: rules_ruby 0.26.0's rb_binary launcher doesn't add dep libs to RUBYLIB, so require 'bazel/runfiles' resolves in an rb_test but not in a generator (rb_binary). GeneratedNote.ensure_runfiles_on_load_path covers that until rules_ruby#374 ships in 0.28.0; on that upgrade the method, its single call, and the //rb/lib/bazel:runfiles dep are all deleted — verified by building against merged Nodes are not reading hub's configuration during re-registering #374 with all three removed.
  • Each generator separates the license from the marker with a blank line. That blank line is what keeps update_copyright.py idempotent: its leading-comment scan stops there and never rewrites the marker. Verified against the build-only Python/JS/Java/Ruby generator output, not just the committed files.
  • update_copyright.py cleanup: dropped the now-redundant generated-file skip, pruned stale exclusions (deleted selenium-core/jsunit/node dirs), generalized node_modules to **/node_modules/** and applied it to the .ts/.tsx passes, and added a *.rbs.erb pass.
  • Regenerated output that carries the marker (28 BiDi protocol .rb/.rbs files, repositories.bzl header) is a separate commit from the tooling change.

🤖 AI assistance

  • AI assisted (complete below)
    • Tool(s): Claude Code
    • What was generated: shared template/helpers, per-generator edits, update_copyright.py changes, regenerated output, and this description
    • I reviewed all AI output and can explain the change

🔄 Types of changes

  • Cleanup (formatting, renaming)

@selenium-ci selenium-ci added C-py Python Bindings C-rb Ruby Bindings C-java Java Bindings C-nodejs JavaScript Bindings B-build Includes scripting, bazel and CI integrations B-devtools Includes everything BiDi or Chrome DevTools related B-support Issue or PR related to support classes labels Jul 23, 2026
@selenium-ci

Copy link
Copy Markdown
Member

Thank you, @titusfortner for this code suggestion.

The support packages contain example code that many users find helpful, but they do not necessarily represent
the best practices for using Selenium, and the Selenium team is not currently merging changes to them.

After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium
to work, we will likely close the PR.

We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks.
If you have any questions, please contact us

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Standardize generator headers and DO NOT EDIT markers from shared templates

✨ Enhancement ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Centralize Apache license text and generated-file marker templates under scripts/.
• Update Python/JS/Java/Ruby generators to emit identical, copy-pasteable regeneration hints.
• Make update_copyright idempotently enforce the same license header across all sources.
Diagram

graph TD
  T1["scripts/license_header.txt"] --> G["Generators (Py/JS/Java/Rb)"] --> O["Generated sources"]
  T2["scripts/generated_note_template.txt"] --> G --> O
  T1 --> U["scripts/update_copyright.py"]
  T2 --> H["Helper libs"] --> G
  B["Bazel data/runfiles"] --> G
  subgraph Legend
    direction LR
    _tpl["Template file"] ~~~ _gen["Generator"] ~~~ _out["Generated output"]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Bazel rule/aspect to prepend headers post-generation
  • ➕ Removes per-language header logic inside generators
  • ➕ Guarantees consistent headers regardless of generator implementation
  • ➖ More Bazel complexity and harder local (non-Bazel) generator runs
  • ➖ Still needs language-specific comment-style handling and blank-line semantics
2. Per-language shared libs only (no shared *.txt templates)
  • ➕ Simpler runtime file access; avoids runfiles/copy_file plumbing
  • ➖ Header wording drifts again across languages
  • ➖ Requires updating multiple implementations to change one sentence

Recommendation: Current approach (single canonical text files + thin per-language formatting) is the best tradeoff: it keeps license/marker wording truly single-sourced while minimizing new build-system complexity. The Bazel-aspect approach is cleaner conceptually but is likely overkill given the repo’s multi-language, multi-generator usage patterns and the need to keep generators runnable in their existing contexts.

Files changed (55) +338 / -154

Enhancement (5) +105 / -3
CdpClientGenerator.javaPrepend standardized header to all generated Java sources +33/-3

Prepend standardized header to all generated Java sources

• Loads canonical license + generated-note templates via Bazel Runfiles, formats them as line comments, and prepends the resulting header to each generated CompilationUnit output.

java/src/org/openqa/selenium/devtools/CdpClientGenerator.java

cdp_client_generator.rbAdd helper method to render standardized generated marker +7/-0

Add helper method to render standardized generated marker

• Requires the new GeneratedNote helper and exposes a generated_note method for ERB templates to insert the canonical two-line marker with the correct regenerate command.

rb/lib/selenium/devtools/support/cdp_client_generator.rb

bidi_generate.rbInject standardized generated-note into Ruby BiDi ERB rendering +3/-0

Inject standardized generated-note into Ruby BiDi ERB rendering

• Requires the GeneratedNote helper and renders a standardized marker into the ERB binding so templates can include the consistent two-line header.

rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb

generated_note.rbImplement Ruby generated-note renderer with Bazel runfiles support +52/-0

Implement Ruby generated-note renderer with Bazel runfiles support

• Adds a helper to load scripts/generated_note_template.txt via Bazel runfiles and render it with a given comment prefix; includes a temporary RUBYLIB/load-path bridge for rules_ruby launcher behavior.

rb/support/generated_note.rb

generated_note.pyAdd Python helper to render standardized generated markers +10/-0

Add Python helper to render standardized generated markers

• Introduces a small utility that loads the shared template and formats the two-line marker with the requested comment style and substitutions.

scripts/generated_note.py

Refactor (39) +126 / -149
repositories.bzlReplace pinned_browsers header with standardized generated marker +2/-1

Replace pinned_browsers header with standardized generated marker

• Updates the top-of-file comment to the new two-line generated-file marker and explicit regeneration command for the pinned_browsers generator output.

common/repositories.bzl

gen_file.pyUse shared license + generated marker for atoms/C++/Java outputs +17/-19

Use shared license + generated marker for atoms/C++/Java outputs

• Replaces the embedded C-style license block and ad-hoc AUTO GENERATED marker with a license header read from a copied template plus a standardized generated note rendered via scripts/generated_note.py.

javascript/private/gen_file.py

generate_bidi.mjsRead shared templates and emit standard generated marker in BiDi TS files +20/-20

Read shared templates and emit standard generated marker in BiDi TS files

• Removes the hardcoded JS license header, reads the canonical license/note templates from sibling files, and inserts the standardized generated marker plus a simpler provenance line.

javascript/selenium-webdriver/generate_bidi.mjs

make-atoms-module.jsPrepend standardized license + generated marker to atoms module output +20/-1

Prepend standardized license + generated marker to atoms module output

• Replaces the single-line GENERATED CODE header with the canonical license header and standardized generated marker rendered as // comments.

javascript/selenium-webdriver/lib/atoms/make-atoms-module.js

generate_bidi.pyStandardize Python BiDi module headers from shared templates +19/-45

Standardize Python BiDi module headers from shared templates

• Replaces bespoke header text and per-file embedded license strings with a shared license header read from a copied template and a standardized generated-note marker including a concrete regenerate command.

py/generate_bidi.py

domain.rb.erbUse shared generated-note marker in CDP domain template +1/-1

Use shared generated-note marker in CDP domain template

• Replaces the previous one-off autogenerated warning line with a standardized generated-note snippet emitted by the helper.

rb/lib/selenium/devtools/support/cdp/domain.rb.erb

loader.rb.erbUse shared generated-note marker in CDP loader template +1/-1

Use shared generated-note marker in CDP loader template

• Replaces the previous one-off autogenerated warning line with the standardized generated-note snippet emitted by the helper.

rb/lib/selenium/devtools/support/cdp/loader.rb.erb

bluetooth.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

browser.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

browsing_context.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

emulation.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

input.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

log.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

network.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

permissions.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

script.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

session.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

speculation.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

storage.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

user_agent_client_hints.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

web_extension.rbUpdate generated marker header in Ruby BiDi protocol file +1/-1

Update generated marker header in Ruby BiDi protocol file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

module.rb.erbReplace hardcoded autogenerated header with generated_note injection +1/-2

Replace hardcoded autogenerated header with generated_note injection

• Swaps the two explicit autogenerated lines for a single template insertion of the standardized generated note.

rb/lib/selenium/webdriver/bidi/support/templates/module.rb.erb

module.rbs.erbReplace hardcoded autogenerated header with generated_note injection +1/-2

Replace hardcoded autogenerated header with generated_note injection

• Swaps the two explicit autogenerated lines for a single template insertion of the standardized generated note.

rb/lib/selenium/webdriver/bidi/support/templates/module.rbs.erb

bluetooth.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

browser.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

browsing_context.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

emulation.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

input.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

log.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

network.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

permissions.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

script.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

session.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

speculation.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

storage.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

user_agent_client_hints.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

web_extension.rbsUpdate generated marker header in Ruby BiDi RBS signature file +1/-1

Update generated marker header in Ruby BiDi RBS signature file

• Rewrites the generated-file warning line to the standardized 'generated by <generator>' format while keeping the explicit Bazel regenerate command.

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

pinned_browsers.pyEmit standardized generated marker for repositories.bzl output +3/-1

Emit standardized generated marker for repositories.bzl output

• Uses the shared generated_note helper to generate the exact standardized marker and regenerate command in the generated repositories.bzl content.

scripts/pinned_browsers.py

update_copyright.pyRead canonical license text and broaden idempotent enforcement scope +13/-28

Read canonical license text and broaden idempotent enforcement scope

• Loads the license body from scripts/license_header.txt, simplifies JS exclusions (including generalized node_modules), applies exclusions consistently to TS/TSX passes, and adds a dedicated pass for *.rbs.erb files.

scripts/update_copyright.py

Other (11) +107 / -2
BUILD.bazelProvide license/note templates to CDP generator via runfiles +5/-0

Provide license/note templates to CDP generator via runfiles

• Adds scripts/license_header.txt and scripts/generated_note_template.txt as data dependencies and adds the rules_java runfiles dependency so the generator can load shared templates at runtime.

java/src/org/openqa/selenium/devtools/BUILD.bazel

BUILD.bazelMake shared license available to JS gen_file generator +9/-0

Make shared license available to JS gen_file generator

• Copies scripts/license_header.txt into the package for sibling-file reads and adds the generated_note Python helper as a dependency for consistent marker rendering.

javascript/private/BUILD.bazel

BUILD.bazelStage shared templates for BiDi TypeScript generator +15/-0

Stage shared templates for BiDi TypeScript generator

• Copies the canonical license and generated-note template next to generate_bidi.mjs and includes them in the js_binary data so the generator can read sibling files reliably.

javascript/selenium-webdriver/BUILD.bazel

BUILD.bazelStage shared templates for atoms module generator +17/-1

Stage shared templates for atoms module generator

• Copies license and generated-note templates into the package and adds them to the make_atoms_module js_binary data inputs.

javascript/selenium-webdriver/lib/atoms/BUILD.bazel

BUILD.bazelStage license template and add generated_note helper for Python BiDi generator +8/-0

Stage license template and add generated_note helper for Python BiDi generator

• Copies scripts/license_header.txt next to generate_bidi.py for file reads and adds scripts:generated_note as a dependency for consistent marker rendering.

py/BUILD.bazel

BUILD.bazelWire generated-note template/helper into Ruby CDP generator +2/-0

Wire generated-note template/helper into Ruby CDP generator

• Adds scripts/generated_note_template.txt as data and depends on the new rb/support:generated_note library so ERB templates can render the standardized marker.

rb/lib/selenium/devtools/BUILD.bazel

BUILD.bazelWire generated-note template/helper into Ruby BiDi generator and checker +4/-0

Wire generated-note template/helper into Ruby BiDi generator and checker

• Adds the shared generated_note template as data and depends on rb/support:generated_note for both the rb_binary generator and the rb_test that validates generated protocol files.

rb/lib/selenium/webdriver/BUILD.bazel

BUILD.bazelAdd GeneratedNote support library target +6/-0

Add GeneratedNote support library target

• Introduces a new rb_library exposing generated-note rendering and (temporarily) a runfiles dependency to locate the shared template at runtime.

rb/support/BUILD.bazel

BUILD.bazelExport canonical templates and add Python generated_note library +23/-1

Export canonical templates and add Python generated_note library

• Exports license_header.txt and generated_note_template.txt for cross-package consumption, adds scripts:generated_note py_library, and wires pinned_browsers/update_copyright to the new shared data.

scripts/BUILD.bazel

generated_note_template.txtAdd canonical generated-file marker template +2/-0

Add canonical generated-file marker template

• Defines the single source of truth for the standardized two-line generated marker with {generator} and {command} placeholders.

scripts/generated_note_template.txt

license_header.txtAdd canonical Apache license notice text for header generation +16/-0

Add canonical Apache license notice text for header generation

• Defines the single source of truth for the Apache 2.0 license notice body used by generators and the copyright updater.

scripts/license_header.txt

@qodo-code-review

qodo-code-review Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Scripts exports not visible ✗ Dismissed 🐞 Bug ≡ Correctness ⭐ New
Description
In scripts/BUILD.bazel, license_header.txt and generated_note_template.txt are exported via
exports_files() without public (or otherwise permissive) visibility, but multiple other packages now
depend on these labels (e.g., via copy_file src=//scripts:license_header.txt and java_binary data).
This can cause Bazel analysis/build failures due to visibility violations when those dependent
targets are built.
Code

scripts/BUILD.bazel[R9-12]

+exports_files([
+    "generated_note_template.txt",
+    "license_header.txt",
+])
Evidence
The exported file targets are currently defined without explicit visibility in scripts/BUILD.bazel,
while multiple other packages now directly depend on those labels; Bazel enforces visibility on such
cross-package dependencies during analysis.

scripts/BUILD.bazel[5-12]
javascript/private/BUILD.bazel[4-8]
javascript/selenium-webdriver/BUILD.bazel[17-28]
java/src/org/openqa/selenium/devtools/BUILD.bazel[84-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`scripts/BUILD.bazel` exports `license_header.txt` and `generated_note_template.txt` using `exports_files(...)` but does not set `visibility`. Other Bazel packages now depend on these file targets, so if the `scripts` package default visibility is private, builds will fail with visibility errors.

## Issue Context
Several generators/rules now reference these files cross-package (e.g., `copy_file(src = "//scripts:license_header.txt")`, `java_binary(data = ["//scripts:..."])`). Visibility rules apply to these dependencies during Bazel analysis.

## Fix Focus Areas
- scripts/BUILD.bazel[9-12]

## Expected change
Update the `exports_files(...)` call to include an explicit visibility, e.g.:

```bzl
exports_files(
   [
       "generated_note_template.txt",
       "license_header.txt",
   ],
   visibility = ["//visibility:public"],
)
```

(Or use a package group / restricted visibility if repo-wide public visibility is not desired.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Direct run fails missing header ✓ Resolved 🐞 Bug ☼ Reliability
Description
py/generate_bidi.py reads a sibling license_header.txt at import time, but that file is only
produced via a Bazel copy_file output, so running python generate_bidi.py ... as documented in
the file will raise FileNotFoundError before argument parsing. This is a deterministic regression
for non-Bazel invocation paths and local tooling that executes the generator directly from the
source tree.
Code

py/generate_bidi.py[R53-55]

+# Shared license body, copied next to this file by BUILD.bazel — see scripts/license_header.txt.
+_LICENSE_NOTICE = (Path(__file__).parent / "license_header.txt").read_text(encoding="utf-8").rstrip("\n")
+LICENSE_HEADER = "\n".join(f"# {line}".rstrip() for line in _LICENSE_NOTICE.split("\n"))
Evidence
The generator’s own docstring documents direct python generate_bidi.py ... usage, but the new
header logic unconditionally reads a sibling license_header.txt. The Bazel build rule shows this
sibling file is created as an output of copy_file, implying it won’t exist for source-tree
execution.

py/generate_bidi.py[19-61]
py/BUILD.bazel[706-718]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`py/generate_bidi.py` reads `Path(__file__).parent / "license_header.txt"`, but that file does not exist in the source tree and is only created by Bazel via `copy_file`. This makes direct invocation of the script (which the module’s docstring explicitly documents) fail immediately during import.

### Issue Context
Bazel mode works because `py/BUILD.bazel` creates `license_header.txt` and adds it to `data`, but developers/tools can still run the generator directly from a checkout.

### Fix Focus Areas
- py/generate_bidi.py[19-61]
- py/BUILD.bazel[706-718]

### Suggested fix
- Make license header loading resilient:
 - Prefer the Bazel-provided sibling file when present.
 - Otherwise fall back to reading the canonical source-tree file `scripts/license_header.txt` (e.g., `Path(__file__).resolve().parents[1] / "scripts" / "license_header.txt"`).
- Avoid import-time hard failure by deferring header file reads until `__main__`/generator execution (or wrapping in a clear error that explains how to run via Bazel).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. generated_note helpers lack tests 📘 Rule violation ☼ Reliability ⭐ New
Description
New shared generated-file marker helpers were added (scripts/generated_note.py and
rb/support/generated_note.rb) without accompanying unit tests, increasing the chance of silent
formatting regressions across generators. Add small/unit tests to lock the exact rendered output and
placeholder substitution behavior.
Code

scripts/generated_note.py[R1-10]

+from pathlib import Path
+
+_TEMPLATE = (Path(__file__).parent / "generated_note_template.txt").read_text(encoding="utf-8").rstrip("\n")
+
+
+def generated_note(comment_prefix, generator, command):
+    """Render the standard two-line generated-file marker in the given comment style."""
+    text = _TEMPLATE.format(generator=generator, command=command)
+    prefix = f"{comment_prefix} " if comment_prefix else ""
+    return "\n".join(f"{prefix}{line}".rstrip() for line in text.split("\n"))
Evidence
PR Compliance ID 4 expects feasible behavior changes to be covered by (preferably small/unit) tests.
The PR adds new shared helper implementations for generated-note rendering but does not add any test
coverage alongside them.

AGENTS.md: Prefer Adding Tests; Favor Small Unit Tests Over Browser Tests and Avoid Mocks
scripts/generated_note.py[1-10]
rb/support/generated_note.rb[20-41]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
New shared generated-file marker helpers were introduced without tests, risking regressions in header/marker rendering across generators.

## Issue Context
These helpers centralize the `This file is generated by … DO NOT EDIT!` / `Regenerate with: …` marker and are used by multiple generators.

## Fix Focus Areas
- scripts/generated_note.py[1-10]
- rb/support/generated_note.rb[20-41]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Java runfiles prefix hardcoded ✗ Dismissed 🐞 Bug ☼ Reliability
Description
CdpClientGenerator hard-codes _main/scripts/... in Runfiles.rlocation, but in legacy WORKSPACE
mode the repo is named selenium, so those runfiles keys won’t resolve and
Paths.get(runfiles.rlocation(...)) will throw a NullPointerException. This prevents CDP source
generation outside Bzlmod-style _main runfiles layouts.
Code

java/src/org/openqa/selenium/devtools/CdpClientGenerator.java[R69-73]

+      Runfiles runfiles = Runfiles.preload().withSourceRepository("");
+      String license = readCommented(runfiles, "_main/scripts/license_header.txt", "// ");
+      String note =
+          readCommented(runfiles, "_main/scripts/generated_note_template.txt", "// ")
+              .replace("{generator}", "CdpClientGenerator.java")
Evidence
The repo’s WORKSPACE name is selenium, but the new Java generator resolves scripts/*.txt via
_main/... runfiles keys and immediately passes the rlocation result into Paths.get(...) without
validation, making non-_main runfiles layouts fail hard.

WORKSPACE[1-1]
java/src/org/openqa/selenium/devtools/CdpClientGenerator.java[67-90]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The generator resolves runfiles using hard-coded `_main/...` keys. In WORKSPACE mode the repository name is `selenium`, so `_main/...` lookups won’t resolve; `runfiles.rlocation(...)` can return null and `Paths.get(null)` throws `NullPointerException`.

### Issue Context
This is a portability regression: Bzlmod-based execution may work (main repo often appears as `_main`), but the repo still has a `WORKSPACE` with `workspace(name = "selenium")`, so non-Bzlmod builds/runs are plausible.

### Fix Focus Areas
- java/src/org/openqa/selenium/devtools/CdpClientGenerator.java[67-90]
- WORKSPACE[1-1]

### Suggested fix
- Stop hard-coding `_main/` in rlocation keys.
 - Prefer repo-relative keys if supported by the Java Runfiles API you’re already using (you call `withSourceRepository("")`; use that to resolve `scripts/license_header.txt` / `scripts/generated_note_template.txt` without a repo prefix).
 - Or derive the repository prefix dynamically (e.g., from an environment variable like the workspace name) and build the rlocation key from that.
 - Or implement a small helper that tries both `${repo}/scripts/...` and `_main/scripts/...` and fails with a clear exception message.
- Add an explicit null-check around `runfiles.rlocation(...)` and throw an exception that names the missing runfile key, instead of letting an NPE occur.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Ruby runfiles prefix hardcoded ✗ Dismissed 🐞 Bug ☼ Reliability
Description
GeneratedNote hard-codes _main/... for both template lookup and for locating bazel/runfiles.rb
in the runfiles manifest, which breaks legacy WORKSPACE-mode runfiles keyed by the workspace name
(selenium). This can prevent Ruby generators from loading Bazel runfiles support and from
rendering the generated-note marker.
Code

rb/support/generated_note.rb[R36-50]

+  # Renders the standard two-line generated-file marker in the given comment style.
+  def self.render(comment_prefix, generator, command)
+    template = File.read(rlocation('_main/scripts/generated_note_template.txt'))
+    text = template.sub('{generator}', generator).sub('{command}', command)
+    text.rstrip.split("\n").map { |line| "#{comment_prefix} #{line}" }.join("\n")
+  end
+
+  # Delete this when update to rules_ruby 0.28.0
+  def self.ensure_runfiles_on_load_path
+    if (manifest = ENV.fetch('RUNFILES_MANIFEST_FILE', nil)) && File.exist?(manifest)
+      entry = File.foreach(manifest).find { |line| line.start_with?('_main/rb/lib/bazel/runfiles.rb ') }
+      $LOAD_PATH.unshift(File.dirname(entry.split(' ', 2).last.chomp, 2)) if entry
+    elsif (dir = ENV.fetch('RUNFILES_DIR', nil)) && !dir.empty?
+      $LOAD_PATH.unshift(File.join(dir, '_main', 'rb', 'lib'))
+    end
Evidence
The WORKSPACE explicitly names the repo selenium, but the new Ruby helper hard-codes _main/ for
both template resolution and manifest probing, which is incompatible with workspace-name-prefixed
runfiles layouts.

WORKSPACE[1-1]
rb/support/generated_note.rb[20-50]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`rb/support/generated_note.rb` assumes the runfiles workspace prefix is always `_main`:
- It reads the template from `_main/scripts/generated_note_template.txt`.
- It searches the manifest for `_main/rb/lib/bazel/runfiles.rb` to amend `$LOAD_PATH`.
In WORKSPACE mode, the prefix will be `selenium` (per `WORKSPACE`), so these lookups can fail.

### Issue Context
This helper is used by rb_binary generators (not just tests), so failures here block generator execution.

### Fix Focus Areas
- rb/support/generated_note.rb[22-50]
- WORKSPACE[1-1]

### Suggested fix
- Avoid hard-coding `_main`:
 - Compute the workspace prefix dynamically (if available via environment, e.g. a workspace-name env var) and build keys like `"#{ws}/scripts/generated_note_template.txt"`.
 - For the manifest search, match on the suffix `"/rb/lib/bazel/runfiles.rb "` rather than `start_with?("_main/..." )`, then derive the correct parent path from the resolved real path.
 - Optionally, try both `_main/...` and `selenium/...` and raise a clear error if neither resolves.
- Keep the current “fail loud” behavior, but make the error message include the workspace prefix you attempted.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (1)
6. Generated headers changed repo-wide ✗ Dismissed 📘 Rule violation ⚙ Maintainability
Description
This PR applies widespread header/marker-only edits across many generated and generator-adjacent
files, creating a large, mostly non-functional diff that increases review burden and reduces
reversibility. Consider splitting by language/component or separating generator refactor from
regeneration-only updates to keep the change set smaller and easier to roll back.
Code

rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb[R20-21]

+# This file is generated by bidi_generate.rb. DO NOT EDIT!
# Regenerate with: bazel run //rb/lib/selenium/webdriver:bidi-generate
Evidence
PR Compliance ID 2 requires avoiding broad, non-functional churn and keeping diffs small and
reversible. The diff shows header-only changes being applied to checked-in generated BiDi protocol
files (representative examples cited), indicating the change is spread across many files rather than
remaining localized.

AGENTS.md: Avoid Repo-wide Refactors or Formatting-Only Changes; Keep Diffs Small and Reversible
rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb[20-21]
rb/sig/lib/selenium/webdriver/bidi/protocol/bluetooth.rbs[18-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR introduces broad, repo-spanning churn that is primarily standardized header/DO NOT EDIT marker changes across many generated outputs and generators.

## Issue Context
Compliance requires avoiding repo-wide refactors/format-only churn and keeping diffs small and reversible.

## Fix Focus Areas
- rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb[20-21]
- rb/sig/lib/selenium/webdriver/bidi/protocol/bluetooth.rbs[18-19]
- scripts/BUILD.bazel[5-23]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

7. Python doc says ARGV ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
py/generate_bidi.py’s usage docstring says Bazel passes arguments as “ARGV”, which is
non-idiomatic for Python and inconsistent with the script’s actual argparse-based CLI. This can
confuse maintainers; the doc should refer to “command-line arguments” / sys.argv instead.
Code

py/generate_bidi.py[R29-31]

+Bazel passes <cddl_file> <output_dir> <spec_version> as ARGV and supplies the shared
+license and generated-note text as runfiles, so this is not runnable directly from a
+source checkout.
Evidence
The docstring explicitly uses “ARGV”, but the script is a standard Python CLI that parses positional
arguments via argparse.parse_args() into args.* fields, so the accurate/idiomatic term is
“command-line arguments” / sys.argv.

py/generate_bidi.py[19-32]
py/generate_bidi.py[1663-1702]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The Python generator’s top-level usage docstring uses the Ruby term `ARGV` when describing how Bazel passes parameters, even though this script uses Python’s `argparse` (i.e., command-line arguments / `sys.argv`).

### Issue Context
This is a docs-only clarity issue in the newly changed lines.

### Fix Focus Areas
- py/generate_bidi.py[26-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit 3dca601

Results up to commit 549b139 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Direct run fails missing header ✓ Resolved 🐞 Bug ☼ Reliability
Description
py/generate_bidi.py reads a sibling license_header.txt at import time, but that file is only
produced via a Bazel copy_file output, so running python generate_bidi.py ... as documented in
the file will raise FileNotFoundError before argument parsing. This is a deterministic regression
for non-Bazel invocation paths and local tooling that executes the generator directly from the
source tree.
Code

py/generate_bidi.py[R53-55]

+# Shared license body, copied next to this file by BUILD.bazel — see scripts/license_header.txt.
+_LICENSE_NOTICE = (Path(__file__).parent / "license_header.txt").read_text(encoding="utf-8").rstrip("\n")
+LICENSE_HEADER = "\n".join(f"# {line}".rstrip() for line in _LICENSE_NOTICE.split("\n"))
Evidence
The generator’s own docstring documents direct python generate_bidi.py ... usage, but the new
header logic unconditionally reads a sibling license_header.txt. The Bazel build rule shows this
sibling file is created as an output of copy_file, implying it won’t exist for source-tree
execution.

py/generate_bidi.py[19-61]
py/BUILD.bazel[706-718]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`py/generate_bidi.py` reads `Path(__file__).parent / "license_header.txt"`, but that file does not exist in the source tree and is only created by Bazel via `copy_file`. This makes direct invocation of the script (which the module’s docstring explicitly documents) fail immediately during import.

### Issue Context
Bazel mode works because `py/BUILD.bazel` creates `license_header.txt` and adds it to `data`, but developers/tools can still run the generator directly from a checkout.

### Fix Focus Areas
- py/generate_bidi.py[19-61]
- py/BUILD.bazel[706-718]

### Suggested fix
- Make license header loading resilient:
 - Prefer the Bazel-provided sibling file when present.
 - Otherwise fall back to reading the canonical source-tree file `scripts/license_header.txt` (e.g., `Path(__file__).resolve().parents[1] / "scripts" / "license_header.txt"`).
- Avoid import-time hard failure by deferring header file reads until `__main__`/generator execution (or wrapping in a clear error that explains how to run via Bazel).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. Generated headers changed repo-wide ✗ Dismissed 📘 Rule violation ⚙ Maintainability
Description
This PR applies widespread header/marker-only edits across many generated and generator-adjacent
files, creating a large, mostly non-functional diff that increases review burden and reduces
reversibility. Consider splitting by language/component or separating generator refactor from
regeneration-only updates to keep the change set smaller and easier to roll back.
Code

rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb[R20-21]

+# This file is generated by bidi_generate.rb. DO NOT EDIT!
# Regenerate with: bazel run //rb/lib/selenium/webdriver:bidi-generate
Evidence
PR Compliance ID 2 requires avoiding broad, non-functional churn and keeping diffs small and
reversible. The diff shows header-only changes being applied to checked-in generated BiDi protocol
files (representative examples cited), indicating the change is spread across many files rather than
remaining localized.

AGENTS.md: Avoid Repo-wide Refactors or Formatting-Only Changes; Keep Diffs Small and Reversible
rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb[20-21]
rb/sig/lib/selenium/webdriver/bidi/protocol/bluetooth.rbs[18-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR introduces broad, repo-spanning churn that is primarily standardized header/DO NOT EDIT marker changes across many generated outputs and generators.

## Issue Context
Compliance requires avoiding repo-wide refactors/format-only churn and keeping diffs small and reversible.

## Fix Focus Areas
- rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb[20-21]
- rb/sig/lib/selenium/webdriver/bidi/protocol/bluetooth.rbs[18-19]
- scripts/BUILD.bazel[5-23]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Ruby runfiles prefix hardcoded ✗ Dismissed 🐞 Bug ☼ Reliability
Description
GeneratedNote hard-codes _main/... for both template lookup and for locating bazel/runfiles.rb
in the runfiles manifest, which breaks legacy WORKSPACE-mode runfiles keyed by the workspace name
(selenium). This can prevent Ruby generators from loading Bazel runfiles support and from
rendering the generated-note marker.
Code

rb/support/generated_note.rb[R36-50]

+  # Renders the standard two-line generated-file marker in the given comment style.
+  def self.render(comment_prefix, generator, command)
+    template = File.read(rlocation('_main/scripts/generated_note_template.txt'))
+    text = template.sub('{generator}', generator).sub('{command}', command)
+    text.rstrip.split("\n").map { |line| "#{comment_prefix} #{line}" }.join("\n")
+  end
+
+  # Delete this when update to rules_ruby 0.28.0
+  def self.ensure_runfiles_on_load_path
+    if (manifest = ENV.fetch('RUNFILES_MANIFEST_FILE', nil)) && File.exist?(manifest)
+      entry = File.foreach(manifest).find { |line| line.start_with?('_main/rb/lib/bazel/runfiles.rb ') }
+      $LOAD_PATH.unshift(File.dirname(entry.split(' ', 2).last.chomp, 2)) if entry
+    elsif (dir = ENV.fetch('RUNFILES_DIR', nil)) && !dir.empty?
+      $LOAD_PATH.unshift(File.join(dir, '_main', 'rb', 'lib'))
+    end
Evidence
The WORKSPACE explicitly names the repo selenium, but the new Ruby helper hard-codes _main/ for
both template resolution and manifest probing, which is incompatible with workspace-name-prefixed
runfiles layouts.

WORKSPACE[1-1]
rb/support/generated_note.rb[20-50]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`rb/support/generated_note.rb` assumes the runfiles workspace prefix is always `_main`:
- It reads the template from `_main/scripts/generated_note_template.txt`.
- It searches the manifest for `_main/rb/lib/bazel/runfiles.rb` to amend `$LOAD_PATH`.
In WORKSPACE mode, the prefix will be `selenium` (per `WORKSPACE`), so these lookups can fail.

### Issue Context
This helper is used by rb_binary generators (not just tests), so failures here block generator execution.

### Fix Focus Areas
- rb/support/generated_note.rb[22-50]
- WORKSPACE[1-1]

### Suggested fix
- Avoid hard-coding `_main`:
 - Compute the workspace prefix dynamically (if available via environment, e.g. a workspace-name env var) and build keys like `"#{ws}/scripts/generated_note_template.txt"`.
 - For the manifest search, match on the suffix `"/rb/lib/bazel/runfiles.rb "` rather than `start_with?("_main/..." )`, then derive the correct parent path from the resolved real path.
 - Optionally, try both `_main/...` and `selenium/...` and raise a clear error if neither resolves.
- Keep the current “fail loud” behavior, but make the error message include the workspace prefix you attempted.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Java runfiles prefix hardcoded ✗ Dismissed 🐞 Bug ☼ Reliability
Description
CdpClientGenerator hard-codes _main/scripts/... in Runfiles.rlocation, but in legacy WORKSPACE
mode the repo is named selenium, so those runfiles keys won’t resolve and
Paths.get(runfiles.rlocation(...)) will throw a NullPointerException. This prevents CDP source
generation outside Bzlmod-style _main runfiles layouts.
Code

java/src/org/openqa/selenium/devtools/CdpClientGenerator.java[R69-73]

+      Runfiles runfiles = Runfiles.preload().withSourceRepository("");
+      String license = readCommented(runfiles, "_main/scripts/license_header.txt", "// ");
+      String note =
+          readCommented(runfiles, "_main/scripts/generated_note_template.txt", "// ")
+              .replace("{generator}", "CdpClientGenerator.java")
Evidence
The repo’s WORKSPACE name is selenium, but the new Java generator resolves scripts/*.txt via
_main/... runfiles keys and immediately passes the rlocation result into Paths.get(...) without
validation, making non-_main runfiles layouts fail hard.

WORKSPACE[1-1]
java/src/org/openqa/selenium/devtools/CdpClientGenerator.java[67-90]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The generator resolves runfiles using hard-coded `_main/...` keys. In WORKSPACE mode the repository name is `selenium`, so `_main/...` lookups won’t resolve; `runfiles.rlocation(...)` can return null and `Paths.get(null)` throws `NullPointerException`.

### Issue Context
This is a portability regression: Bzlmod-based execution may work (main repo often appears as `_main`), but the repo still has a `WORKSPACE` with `workspace(name = "selenium")`, so non-Bzlmod builds/runs are plausible.

### Fix Focus Areas
- java/src/org/openqa/selenium/devtools/CdpClientGenerator.java[67-90]
- WORKSPACE[1-1]

### Suggested fix
- Stop hard-coding `_main/` in rlocation keys.
 - Prefer repo-relative keys if supported by the Java Runfiles API you’re already using (you call `withSourceRepository("")`; use that to resolve `scripts/license_header.txt` / `scripts/generated_note_template.txt` without a repo prefix).
 - Or derive the repository prefix dynamically (e.g., from an environment variable like the workspace name) and build the rlocation key from that.
 - Or implement a small helper that tries both `${repo}/scripts/...` and `_main/scripts/...` and fails with a clear exception message.
- Add an explicit null-check around `runfiles.rlocation(...)` and throw an exception that names the missing runfile key, instead of letting an NPE occur.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 8f485a7 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Informational
1. Python doc says ARGV ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
py/generate_bidi.py’s usage docstring says Bazel passes arguments as “ARGV”, which is
non-idiomatic for Python and inconsistent with the script’s actual argparse-based CLI. This can
confuse maintainers; the doc should refer to “command-line arguments” / sys.argv instead.
Code

py/generate_bidi.py[R29-31]

+Bazel passes <cddl_file> <output_dir> <spec_version> as ARGV and supplies the shared
+license and generated-note text as runfiles, so this is not runnable directly from a
+source checkout.
Evidence
The docstring explicitly uses “ARGV”, but the script is a standard Python CLI that parses positional
arguments via argparse.parse_args() into args.* fields, so the accurate/idiomatic term is
“command-line arguments” / sys.argv.

py/generate_bidi.py[19-32]
py/generate_bidi.py[1663-1702]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The Python generator’s top-level usage docstring uses the Ruby term `ARGV` when describing how Bazel passes parameters, even though this script uses Python’s `argparse` (i.e., command-line arguments / `sys.argv`).

### Issue Context
This is a docs-only clarity issue in the newly changed lines.

### Fix Focus Areas
- py/generate_bidi.py[26-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Comment thread rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb Outdated
Comment thread py/generate_bidi.py
Comment thread java/src/org/openqa/selenium/devtools/CdpClientGenerator.java Outdated
Comment thread rb/support/generated_note.rb
@titusfortner
titusfortner requested a review from Copilot July 23, 2026 21:52
Comment thread py/generate_bidi.py Outdated
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 8f485a7

@titusfortner titusfortner changed the title [build] standardize generated-file license and DO NOT EDIT markers across generators [build] standardize generated-file license and not to edit markers across generators Jul 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Standardizes generated-file headers across the repo by centralizing the Apache 2.0 license body and a consistent “generated / DO NOT EDIT” marker, then updating multiple generators and update_copyright.py to consume the shared sources.

Changes:

  • Centralized canonical license text and generated-file marker text into shared scripts/*.txt sources, with thin helpers for Python/Ruby.
  • Updated multiple generators (Python, Ruby, Java, JavaScript) to emit consistent “generated by … / regenerate with …” markers, and regenerated affected Ruby BiDi outputs.
  • Simplified/expanded update_copyright.py passes and exclusions (notably node_modules and .rbs.erb coverage) and made it consume the shared license text.

Reviewed changes

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

Show a summary per file
File Description
scripts/update_copyright.py Loads canonical license text from scripts/license_header.txt and updates JS exclusions / adds .rbs.erb pass.
scripts/pinned_browsers.py Uses shared generated-note helper to stamp generated marker into produced output.
scripts/license_header.txt Introduces single-source Apache 2.0 license body text.
scripts/generated_note.py Adds Python helper to render the standardized two-line generated marker.
scripts/generated_note_template.txt Adds shared template for generated marker text.
scripts/BUILD.bazel Exports shared template/license files; adds py_library helper and wires data deps.
rb/support/generated_note.rb Adds Ruby helper for rendering the standardized marker via Bazel runfiles.
rb/support/BUILD.bazel Adds rb_library target for the Ruby generated-note helper.
rb/sig/lib/selenium/webdriver/bidi/protocol/web_extension.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/user_agent_client_hints.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/storage.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/speculation.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/session.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/script.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/permissions.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/network.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/log.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/input.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/emulation.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/browsing_context.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/browser.rbs Updates generated marker wording to standardized form.
rb/sig/lib/selenium/webdriver/bidi/protocol/bluetooth.rbs Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/BUILD.bazel Wires shared template and Ruby helper into BiDi generator + checker.
rb/lib/selenium/webdriver/bidi/support/templates/module.rbs.erb Replaces inline marker text with templated generated-note injection.
rb/lib/selenium/webdriver/bidi/support/templates/module.rb.erb Replaces inline marker text with templated generated-note injection.
rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb Uses Ruby helper to render standardized marker for generated files.
rb/lib/selenium/webdriver/bidi/protocol/web_extension.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/user_agent_client_hints.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/storage.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/speculation.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/session.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/script.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/permissions.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/network.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/log.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/input.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/emulation.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/browsing_context.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/browser.rb Updates generated marker wording to standardized form.
rb/lib/selenium/webdriver/bidi/protocol/bluetooth.rb Updates generated marker wording to standardized form.
rb/lib/selenium/devtools/support/cdp/loader.rb.erb Switches CDP generated marker to standardized helper output.
rb/lib/selenium/devtools/support/cdp/domain.rb.erb Switches CDP generated marker to standardized helper output.
rb/lib/selenium/devtools/support/cdp_client_generator.rb Adds Ruby helper method to supply standardized marker to templates.
rb/lib/selenium/devtools/BUILD.bazel Wires shared template and Ruby helper into CDP generator.
py/generate_bidi.py Switches Python BiDi generator headers to shared license + marker sources.
py/BUILD.bazel Copies shared license locally for Python generator; depends on Python marker helper.
javascript/selenium-webdriver/lib/atoms/make-atoms-module.js Prepends shared license + standardized generated marker to generated atoms module output.
javascript/selenium-webdriver/lib/atoms/BUILD.bazel Copies shared license + marker template next to the JS generator script.
javascript/selenium-webdriver/generate_bidi.mjs Switches JS BiDi generator headers to shared license + marker template read as runfiles siblings.
javascript/selenium-webdriver/BUILD.bazel Copies shared license + marker template next to the BiDi generator script and wires into js_binary.
javascript/private/gen_file.py Switches JS private generator to shared license body + standardized marker block comments.
javascript/private/BUILD.bazel Copies shared license locally for the Python generator and wires Python marker helper dep.
java/src/org/openqa/selenium/devtools/CdpClientGenerator.java Prepends a shared license + standardized marker header to generated Java sources using Runfiles.
java/src/org/openqa/selenium/devtools/BUILD.bazel Adds shared template/license runfiles and Runfiles library dep for the Java generator.
common/repositories.bzl Updates generated marker wording for pinned browsers output.
Comments suppressed due to low confidence (1)

rb/support/generated_note.rb:43

  • Grammar nit: "Delete this when update to ..." should be "Delete this when updating to ...".

Comment thread java/src/org/openqa/selenium/devtools/CdpClientGenerator.java
Comment thread java/src/org/openqa/selenium/devtools/CdpClientGenerator.java
Comment thread rb/support/generated_note.rb Outdated
Comment thread rb/support/BUILD.bazel Outdated
@titusfortner
titusfortner force-pushed the standardize-generated-markers branch from 8f485a7 to f91e171 Compare July 23, 2026 22:34
Comment thread scripts/generated_note.py
Comment thread scripts/BUILD.bazel
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit f91e171

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 55 out of 55 changed files in this pull request and generated 2 comments.

Comment thread scripts/pinned_browsers.py
Comment thread javascript/private/gen_file.py Outdated
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 8577ad5

@titusfortner
titusfortner requested a review from Copilot July 23, 2026 23:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 56 out of 56 changed files in this pull request and generated no new comments.

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 3dca601

@titusfortner
titusfortner merged commit 39155d8 into SeleniumHQ:trunk Jul 24, 2026
50 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 B-support Issue or PR related to support classes C-java Java Bindings 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.

3 participants