Repository navigation
fix(cli): advertise domain constraints for selector and path options - #9181
Conversation
Android class, method, and mapping fields, ADB setting keys, and browser endpoints used bare strings in --schema. They now reuse the domain fields, so empty selectors, relative mapping paths, and malformed setting keys fail in the advertised schema.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The reviewed changes appear safe to merge; no new actionable issues were found. SummaryThe PR makes CLI schemas advertise existing domain constraints for Android inputs, ADB setting keys, endpoints, target IDs, and selectors.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
D["Domain field"] --> I["CLI input schema"]
I --> J["Advertised JSON Schema"]
A["Argument text"] --> I
I --> P["Full domain parser"]
P --> V["Validated values"]
V --> T["Provider call"]
Reviews (6) · Last reviewed commit: "fix(cli): remove duplicate merged schema..." · Reviewed by Greptile |
Empty browser and Electron selectors now fail in the CLI parser, so their diagnostics are VALIDATION_ERROR with the one-character minimum. ADB setting keys stay on the selector repair path, which restores maximum 256 and the identifier pattern.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Empty browser and Electron selectors still fail as VALIDATION_ERROR too_small on the named field. The tests no longer copy Zod's sentence.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Browser and Inspector tests take custom issue text from the schema that owns it, and empty capture comparison must name both missing inspection fields.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
# Conflicts: # src/cli/browserAdvancedCommands.ts # src/cli/browserCommands.ts # src/cli/javascriptRuntimeCommands.ts
Summary
Several CLI options were bare strings, so
--schemaaccepted values the domain schema and MCPtools/listalready rejected: empty Android class or method names, a relativemappingPath, an empty browser endpoint or selector, and an ADB setting key with spaces or more than 256 characters.Those CLI fields now use the domain fields. Transforms stay on the service side:
cliDomainInputkeeps the inbound string so argv text is unchanged and--schemamatches the input view.Addresses #7677 and #8950.
adbSelectorConstraintsstays ADB-only. The content-schema walker from #7122 is unchanged.Problem and expected behavior
Smallest trigger:
rea inspect-android-class app.apk "" --schema --jsonadvertisedclassNamewith no minimum, and Ajv accepted{ path: "app.apk", className: "" }. The command then failed at domain validation.read-adb-settingadvertisedkeyas onlyminLength: 1, so Ajv acceptedkey with spaceand a 257-character key.Expected: the advertised CLI schema rejects those inputs the same way the domain field does. A nonempty class name, an absolute mapping path, a nonempty listener endpoint, and an identifier setting key still validate.
Change and scope
Android APK path, class name, method name, search query, and mapping path use
androidInputSchemas.read-adb-settingnamespace and key useadbInputSchemas.read_adb_setting. Browser, Electron, and Inspector endpoints use the inbound string of the domain endpoint field (minLength: 1, plus the existing description). Target ids and the web-listener selector use the domainmin(1)strings.cliDomainInputreturns aZodPipefield's input schema. Screenshot and observation endpoints therefore still arrive at the service as URL text; the service transform still normalizes them.Electron page
targetIdrepeatsz.string().min(1)becauseinspectElectronPageInputSchemais a union and does not expose one shape. That is the same minimum the union members use.Contribution scope: ordinary CLI/schema fix. Maintainer scope decision for new providers or target execution: not applicable.
Not included: numeric token admission (#9178) and absolute-path schema parity for the six inspection tools (#9179).
Contract and boundary impact
--schemafor the listed options now includes the domain minimums, the mapping absolute pattern, and the setting-key pattern and maximum. MCP schemas are unchanged.docs/public/product-catalog.json), package, or installation impact: none.Evidence and regression coverage
tests/boundary/cli/cliDomainFieldSchema.test.tsloads--schemaforinspect-android-class,inspect-android-method,read-adb-setting,inspect-web-event-listeners, andcapture-web-screenshot, and checks Ajv. The Android class parser also rejects an empty class name.z.string()orz.string().min(1)without the domain pattern or maximum.minLength. Relative mapping paths fail the absolute pattern. Setting keys fail the identifier pattern ormaxLength: 256.minLengthis still enforced by the service transform, which JSON Schema does not represent. That matchestools/list.Boundary regression: CLI advertised input schema versus the domain parser. Lifecycle regressions are not applicable.
Validation performed
After merging current main and resolving overlapping schema imports, the four focused CLI suites passed (68 tests); pre-push
check:fastpassed.npm run test:focused -- tests/boundary/cli/cliDomainFieldSchema.test.ts— 1 passed.Review follow-up: empty browser, Inspector, and Electron selectors are
VALIDATION_ERROR/too_smallon the named field. The tests do not freeze Zod's sentence. Malformed endpoint URLs stayinvalid_request.read-adb-settingkey is on the ADB selector repair path, so a 257-character key keepsmaximum: 256andbad keykeepsexpected: "regex".npm run test:focused -- tests/boundary/cli/browserInputDiagnostics.test.ts tests/boundary/cli/electronCli.test.ts tests/boundary/cli/adbCli.test.ts tests/boundary/cli/cliDomainFieldSchema.test.ts— 68 passed. After dropping the frozen sentence,browserInputDiagnostics.test.tsandelectronCli.test.ts— 24 passed.npm run check:fastpassed.npm run check:fast— typecheck and lint passed. Pre-pushcheck:fastpassed.Schema-owned diagnostics: browser and Inspector custom messages are compared with the domain schema's own issue, and empty capture comparison requires missing
before.inspectionandafter.inspection.npm run test:focused -- tests/boundary/cli/browserInputDiagnostics.test.ts— 15 passed.npm run check:fastpassed.npx oxfmton the touched files — formatted.Compatibility, safety, and release
!orBREAKING CHANGEmarker.Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.