[GH-ISSUE #6466] [Bug] capture-native-ui-scenario schema permits omitting required steps #3876

Closed
opened 2026-10-31 00:44:50 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @coygeek on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/6466

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

CLI

Observed behavior

capture-native-ui-scenario --schema --json requires only pid and windowId in its options object. It advertises steps as an optional string, but invoking the command without --steps always fails input validation with missing_argument for steps. Passing --steps '[]' also fails because the decoded array must contain at least one step. The help and full manifest describe a JSON array without stating either requirement.

Reproduction

From a fresh checkout at 9eb829aca34be36ff112826337996f6139f82eff, prepare the locked dependencies and built runtime:

npm ci && npm run build:cached

The following commands were each run once against an already prepared checkout; dependency installation and rebuilding were not repeated for this reproduction. The fixture is an empty directory, so no application or native UI is needed.

WORK=$(mktemp -d)
export HOME="$WORK/home"
mkdir -p "$HOME" "$WORK/target"
node scripts/rea.mjs capture-native-ui-scenario --schema --json
node scripts/rea.mjs capture-native-ui-scenario --help
node scripts/rea.mjs capture-native-ui-scenario --llms-full
node scripts/rea.mjs capture-native-ui-scenario "$WORK/target" \
  --pid 1 --window-id 1 --json
node scripts/rea.mjs capture-native-ui-scenario "$WORK/target" \
  --pid 1 --window-id 1 --steps '[]' --json
node scripts/rea.mjs capture-native-ui-scenario "$WORK/target" \
  --pid 1 --window-id 1 --steps '[{"kind":"wait","milliseconds":0}]' --json

The two invalid-step calls reproduced the mismatch in 1/1 run each. The last command is a control: it passes steps validation and rejects the directory during target admission.

Expected behavior

Discovery should state that --steps is required and its decoded JSON value must be a non-empty array. Preserve the runtime rejection of missing, empty, and malformed steps.

The CLI identifies --schema as its command JSON Schema. The shared scenario contract requires steps, with minimum length one. The MCP contract uses that same schema; this MCP comparison is source-derived, not a tools/list observation.

Impact and scope

P2: Discovery-driven scripts and callers can construct a schema-valid invocation that the handler refuses, requiring an avoidable correction and retry. Runtime validation returns useful field-specific issues, so supplying a valid non-empty array is a practical workaround. The one-step control passed input validation. No UI capture, target mutation, data loss, or incorrect Evidence result was observed. Frequency outside these local calls is unknown.

REA version

6.7.0 (source 9eb829aca3)

Runtime and platform

Node.js v26.12.1; macOS 27.0.1; arm64. The repository pins Node.js 24.18.0; that exact runtime was not run.

Target and artifact context

Empty local directory; PID and window ID are positive parser inputs only. Invalid steps are rejected before target admission. The valid-step control rejects the directory before UI observation.

Interface

CLI

Earliest failure stage

Request parsing or validation

Relevant output or evidence

Observed schema fragment:

{"steps":{"description":"JSON array of declarative AX actions or waits","type":"string"}}

The surrounding options object has "required":["pid","windowId"]. Discovery commands exit 0. Both invalid invocations exit 1 with code: "invalid_request" and these respective issues:

{"path":["steps"],"reason":"missing_argument","expected":"array"}
{"path":["steps"],"reason":"out_of_range","minimum":1}

The one-step control exits 1 with code: "target_unavailable" and details.constraint: "directory_requires_file", establishing that valid steps proceed beyond input validation. It does not establish successful native capture.

Typed outcome or recovery expected

Before invocation, discover that the flag is required and must decode to at least one valid step. The existing errors identify the missing field or minimum after a failed call; the recommended CLI usage should supply that information before the call.

Analysis or suspected cause

Source-derived: the CLI declaration explicitly makes the string optional. The handler forwards omission as undefined to the required canonical array validator before provider dispatch. The string transport cannot use an array minItems keyword directly; guidance should describe the decoded-array restriction or discovery should use a representation that expresses it.

Additional context

Issue #2674 concerns passive observe-native-ui silently dropping steps. Issue #1169 concerns defaulted CLI inputs being incorrectly marked required. Neither covers this scenario command's required steps being advertised as optional. No real application, native helper, or MCP server was exercised.

Originally created by @coygeek on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6466 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area CLI ### Observed behavior `capture-native-ui-scenario --schema --json` requires only `pid` and `windowId` in its options object. It advertises `steps` as an optional string, but invoking the command without `--steps` always fails input validation with `missing_argument` for `steps`. Passing `--steps '[]'` also fails because the decoded array must contain at least one step. The help and full manifest describe a JSON array without stating either requirement. ### Reproduction From a fresh checkout at `9eb829aca34be36ff112826337996f6139f82eff`, prepare the locked dependencies and built runtime: ```sh npm ci && npm run build:cached ``` The following commands were each run once against an already prepared checkout; dependency installation and rebuilding were not repeated for this reproduction. The fixture is an empty directory, so no application or native UI is needed. ```sh WORK=$(mktemp -d) export HOME="$WORK/home" mkdir -p "$HOME" "$WORK/target" node scripts/rea.mjs capture-native-ui-scenario --schema --json node scripts/rea.mjs capture-native-ui-scenario --help node scripts/rea.mjs capture-native-ui-scenario --llms-full node scripts/rea.mjs capture-native-ui-scenario "$WORK/target" \ --pid 1 --window-id 1 --json node scripts/rea.mjs capture-native-ui-scenario "$WORK/target" \ --pid 1 --window-id 1 --steps '[]' --json node scripts/rea.mjs capture-native-ui-scenario "$WORK/target" \ --pid 1 --window-id 1 --steps '[{"kind":"wait","milliseconds":0}]' --json ``` The two invalid-step calls reproduced the mismatch in 1/1 run each. The last command is a control: it passes steps validation and rejects the directory during target admission. ### Expected behavior Discovery should state that `--steps` is required and its decoded JSON value must be a non-empty array. Preserve the runtime rejection of missing, empty, and malformed steps. The CLI identifies `--schema` as its command JSON Schema. The [shared scenario contract](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/domain/native/nativeUiObservation.ts#L31) requires `steps`, with [minimum length one](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/domain/native/nativeUiObservation.ts#L62). The [MCP contract](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/contracts/native/nativeToolContracts.ts#L85) uses that same schema; this MCP comparison is source-derived, not a tools/list observation. ### Impact and scope P2: Discovery-driven scripts and callers can construct a schema-valid invocation that the handler refuses, requiring an avoidable correction and retry. Runtime validation returns useful field-specific issues, so supplying a valid non-empty array is a practical workaround. The one-step control passed input validation. No UI capture, target mutation, data loss, or incorrect Evidence result was observed. Frequency outside these local calls is unknown. ### REA version 6.7.0 (source 9eb829aca34be36ff112826337996f6139f82eff) ### Runtime and platform Node.js v26.12.1; macOS 27.0.1; arm64. The repository pins Node.js 24.18.0; that exact runtime was not run. ### Target and artifact context Empty local directory; PID and window ID are positive parser inputs only. Invalid steps are rejected before target admission. The valid-step control rejects the directory before UI observation. ### Interface CLI ### Earliest failure stage Request parsing or validation ### Relevant output or evidence Observed schema fragment: ```json {"steps":{"description":"JSON array of declarative AX actions or waits","type":"string"}} ``` The surrounding options object has `"required":["pid","windowId"]`. Discovery commands exit 0. Both invalid invocations exit 1 with `code: "invalid_request"` and these respective issues: ```json {"path":["steps"],"reason":"missing_argument","expected":"array"} {"path":["steps"],"reason":"out_of_range","minimum":1} ``` The one-step control exits 1 with `code: "target_unavailable"` and `details.constraint: "directory_requires_file"`, establishing that valid steps proceed beyond input validation. It does not establish successful native capture. ### Typed outcome or recovery expected Before invocation, discover that the flag is required and must decode to at least one valid step. The existing errors identify the missing field or minimum after a failed call; the recommended CLI usage should supply that information before the call. ### Analysis or suspected cause Source-derived: the [CLI declaration](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/cli/utilityCommands.ts#L122) explicitly makes the string optional. The [handler](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/cli/utilityCommands.ts#L129) forwards omission as `undefined` to the required canonical array validator before provider dispatch. The string transport cannot use an array `minItems` keyword directly; guidance should describe the decoded-array restriction or discovery should use a representation that expresses it. ### Additional context [Issue #2674](https://github.com/morluto/rea/issues/2674) concerns passive `observe-native-ui` silently dropping steps. [Issue #1169](https://github.com/morluto/rea/issues/1169) concerns defaulted CLI inputs being incorrectly marked required. Neither covers this scenario command's required steps being advertised as optional. No real application, native helper, or MCP server was exercised.
Author
Owner

@morluto commented on GitHub (Oct 23, 2026):

Resolved by github.com/morluto/rea@3f49545320. The shared CLI contract requires steps and advertises one-or-more decoded steps. AJV validates advertised schema against parser-required inputs; native UI execution is unnecessary for the schema-only report. Validation: tests/boundary/cli/cliInputSchemaRequired.test.ts passed in the recorded round2/3 execution; this review did not rerun tests. Coverage is limited to the cited control; no broader real-provider, Windows or performance claim.

<!-- gh-comment-id:6376110445 --> @morluto commented on GitHub (Oct 23, 2026): Resolved by https://github.com/morluto/rea/commit/3f49545320c524ac0f0ca018973eedeea178238f. The shared CLI contract requires steps and advertises one-or-more decoded steps. AJV validates advertised schema against parser-required inputs; native UI execution is unnecessary for the schema-only report. Validation: `tests/boundary/cli/cliInputSchemaRequired.test.ts` passed in the recorded round2/3 execution; this review did not rerun tests. Coverage is limited to the cited control; no broader real-provider, Windows or performance claim.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3876
No description provided.