Conversation
PR Summary by QodoAdd Bazel-based Java BiDi protocol code generator
AI Description
Diagram
High-Level Assessment
Files changed (21)
|
Code Review by Qodo
1.
|
|
I started reviewing this and ended up creating #17786 |
Code Review by Qodo
1. Default timeout bypassed
|
|
Code review by qodo was updated up to the latest commit 7b9799f |
|
Code review by qodo was updated up to the latest commit 1760de4 |
|
Code review by qodo was updated up to the latest commit 1f4ec87 |
|
Code review by qodo was updated up to the latest commit 3d4a143 |
|
Good progress. Heads up in case you missed it, #17784 added the preserveExtras signal to the projected schema (alongside the existing extensible), so extensibility is now fully derivable per-type: extensible marks the open types, and preserveExtras is pre-scoped to the ones that are both extensible and re-sendable so you don't have to work out that scoping in the generator. |
3d4a143 to
a2fa95c
Compare
|
Code review by qodo was updated up to the latest commit 7e5e00c |
|
Code review by qodo was updated up to the latest commit c72ff7f |
|
Code review by qodo was updated up to the latest commit 4120336 |
|
Code review by qodo was updated up to the latest commit 3dc9bc8 |
1ec479b to
c0d4894
Compare
|
Code review by qodo was updated up to the latest commit c0d4894 |
|
Code review by qodo was updated up to the latest commit d4ba756 |
|
Code review by qodo was updated up to the latest commit ff75984 |
|
Earlier rounds are addressed. Three things still before merge and a few we can do after the merge if we want just to get this out there. Let me know if any of these don't make sense or if you want me to push anything to this branch. Blockers:
Follow-ups:
|
|
Code review by qodo was updated up to the latest commit a029d2b |
|
Code review by qodo was updated up to the latest commit b99f0b0 |
| deps = [ | ||
| "//java/src/org/openqa/selenium/bidi:bidi-generated", | ||
| "//java/src/org/openqa/selenium/firefox", | ||
| "//java/src/org/openqa/selenium/grid/security", |
There was a problem hiding this comment.
1. Module tests cannot compile 🐞 Bug ≡ Correctness
The new protocol/module test target omits direct dependencies on Selenium core and the BiDi client even though BrowsingContextModuleTest imports WindowType and BiDiException. The suite macro compiles all test sources into a support library using only this target's declared dependencies, so Bazel strict-deps rejects those imports.
Agent Prompt
Issue description
The protocol module test suite directly imports Selenium core and BiDi client classes but does not declare their Bazel targets, causing strict-deps compilation failures.
Fix Focus Areas
- java/test/org/openqa/selenium/bidi/protocol/module/BUILD.bazel[12-18]
Recommended Fix
Add `//java/src/org/openqa/selenium:core` and `//java/src/org/openqa/selenium/bidi` to the suite's `deps` list. Keep `bidi-generated` as the direct dependency for generated protocol classes.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit d3eb521 |
|
Code review by qodo was updated up to the latest commit 115e85a |
|
Code review by qodo was updated up to the latest commit 88d9de1 |
|
@titusfortner I have addressed the blockers, is this good to merge? I will address the rest in the next PR. |
🔗 Related Issues
Adheres to the ADR #17786 and matches also decisions there.
8th one was explicitly decided does not work for Java and so was dropped in discussion with the TLC.
💥 What does this PR do?
Adds the BiDi Java client generator: reads the shared, binding-neutral BiDi schema and emits the full typed Java BiDi protocol layer — module classes (one per domain, with commands and events) plus supporting POJOs, enums, and discriminated unions — across all 14 domain, on top of the hand-written seam (Module base class + Handle) that makes it usable.
Shape of a generated module class (real output, network.Network trimmed to 2 events + 2 commands as example):
Usage is symmetric regardless of whether a command has a result:
🔧 Implementation Notes
Autogenerated code and not checked in
The build compiles the genrule's srcjar directly:
No generated
.javais ever committed.Trade-off accepted knowingly: less reviewable diff surface for generator changes. Given Java has a lot of generated classes, strict typing means one
.javafile per record/enum/union, not a handful of dynamically-typed modules like the JS or Python bindings. The actual generated code never appears in this PR's diff, only the generator that produces it.How to see the generated output since it's not in the diff, pull it out locally:
bazel build //java/src/org/openqa/selenium/bidi:bidi-generated mkdir -p /tmp/bidi-generated-src unzip -o -q bazel-bin/java/src/org/openqa/selenium/bidi/bidi-generated.srcjar -d /tmp/bidi-generated-src open /tmp/bidi-generated-src # or just browse/grep itIf you'd rather regenerate directly without the Bazel packaging step (useful for diffing output after a generator change):
bazel build //java/src/org/openqa/selenium/bidi:bidi-client-generator bazel run //java/src/org/openqa/selenium/bidi:bidi-client-generator -- \ "$(bazel info bazel-genfiles)/javascript/selenium-webdriver/create-bidi-src_schema.json" \ /tmp/bidi-out.srcjar unzip -o -q /tmp/bidi-out.srcjar -d /tmp/bidi-generated-src(Direct invocation of the built binary without
bazel runfails withCannot locate runfiles directory— it needsbazel runto set up its runfiles tree.)🤖 AI assistance
💡 Additional Considerations
Only network, log, script, and browsingContext have dedicated generated-code tests (unit and/or browser-integration) added in this PR.
session, browser, emulation, storage, input, webExtension, permissions, speculation, bluetooth, userAgentClientHints have none yet.
Essentially, the modules that are needed for implementing high-level APIs for Selenium 5 have tests.
🔄 Types of changes