Repository navigation
Conversation
|
/agentic_describe |
PR Summary by QodoPreserve fixed key-value tuple types in the BiDi schema
AI Description
Merge Risk
|
Code Review by Qodo
1. Repeated array positions get false arity
|
| const once = (m) => (m.Occurrence?.n ?? 1) === 1 && (m.Occurrence?.m ?? 1) === 1 | ||
| node.tuple = members.map((m) => (once(m) ? projectRef(m.Type) : { primitive: 'unknown' })) |
There was a problem hiding this comment.
1. Repeated array positions get false arity 🐞 Bug ≡ Correctness
arrayNode defaults a null upper occurrence bound to 1, so an unbounded + member is treated as a fixed tuple position. When a multi-member array contains such a member, checkSchema accepts the projected tuple rather than rejecting its incorrect fixed arity; the current schema has no such array, but a later projection would carry the wrong shape.
Agent Prompt
## Issue description
`arrayNode` treats an explicit null upper occurrence bound as if it were absent, incorrectly projecting a repeating `+` member into a fixed tuple position.
## Fix Focus Areas
- javascript/selenium-webdriver/project_bidi_schema.mjs[194-201]
- javascript/selenium-webdriver/project_bidi_schema_test.mjs[199-202]
## Recommended Fix
Default only an absent `Occurrence` or absent `m` to one; keep an explicit null or Infinity maximum unbounded. Add a multi-member array test with `{n: 1, m: null}` that verifies `checkSchema` rejects its projection.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
/agentic_review |
🔗 Related Issues
BiDi sends a JavaScript
Mapor object as a list of[key, value]pairs. The spec defines each entry as a fixed pair:script.MappingLocalValueandscript.MappingRemoteValueareso every entry has exactly two elements, and only the key may be plain text. The binding-neutral schema loses that, so no generator can enforce it.
💥 What does this PR do?
Where this shows up:
script.callFunctionscript.callFunctionpasses arguments to a function in the page and returns its result:script.CallFunctionParameters.arguments→script.LocalValue→script.MapLocalValue.value→script.MappingLocalValuescript.CallFunctionResult→script.RemoteValue→script.MapRemoteValue.value→script.MappingRemoteValueFor example, calling
(prefs) => prefs.get('theme')with aMapoftheme → "dark"must send:What is lost today
The schema on trunk (
script.MappingLocalValue,script.MappingRemoteValue) projects the entry as:That reads as "a list of any number of elements, each a value or a string". It drops two facts from the spec:
So the schema treats all of these as valid
script.callFunctionarguments, although only the first one is:What each binding does today:
Array<Array<LocalValue | string>>.List<List<Object>>, with only null checks.The changes fix this.
🔧 Implementation Notes
This PR covers only the schema, so the shared format change can be reviewed on its own.
🤖 AI assistance
🔄 Types of changes