Skip to content

feat(orchestra): tell the user which options a command is missing - #3563

Draft
amanjeetsingh150 wants to merge 1 commit into
feat/parser-errors-from-schemafrom
feat/parser-errors-schema-swap
Draft

feat(orchestra): tell the user which options a command is missing#3563
amanjeetsingh150 wants to merge 1 commit into
feat/parser-errors-from-schemafrom
feat/parser-errors-schema-swap

Conversation

@amanjeetsingh150

Copy link
Copy Markdown
Collaborator

Stacked on #3562, which is stacked on #3560. Review those first; the diff here is only the last commit.

- tapOn said only "The command tapOn requires additional options" — the part the user already knew. FlowCommandSchema knows the required arguments, the one-of groups and which commands take a selector, so the error can name them:

- inputText          Requires `text`.
- runFlow            Requires one of `file`, `commands`.
- extendedWaitUntil  Requires one of `visible`, `notVisible`.
- addMedia           Requires `files`.
- tapOn              It takes an element selector, for example `tapOn: Login`.

runFlow and extendedWaitUntil are only expressible because of @YamlRequiresOneOf from #3560 — this is the first thing making that annotation do user-facing work rather than only feeding a test.

  • The text is read off the schema, not written out here, so it cannot name an option the parser rejects. Fills in the // TODO: Add docs link next to it.
  • objectCommands was re-deriving the command list by the same reflection the schema does; it now asks the schema. Both it and allCommands become lazyFlowCommandSchema reads stringCommands from further down that same file, and an eager read would run before that map exists. This is the bit worth a careful look.
  • swipe deliberately gets no options text: its variants are named by Kotlin class (YamlSwipeElement), and those shouldn't reach a user-facing error until variants have YAML-facing names.

The six characterisation tests from #3562 pass unchanged, which is what they were for. Five more describe the new message; each failed against the parser as it was. The docs-link test asserts FlowParseException.docs rather than the message — that field is rendered separately by the CLI and the workspace planner, so asserting on the message would pass for the wrong reason. e020's golden file is regenerated.

Verify:

  • ./gradlew :maestro-orchestra:test — 445 tests, 0 failures
  • ./gradlew :maestro-orchestra-models:test — 51 tests, 0 failures
  • ./gradlew :maestro-cli:compileKotlin — passes

🤖 Generated with Claude Code

https://claude.ai/code/session_015vHfmsiT7skZdV13zcbeof

`- tapOn` said only "The command `tapOn` requires additional options", which is
the part the user already knew. FlowCommandSchema knows the required arguments,
the one-of groups and which commands take a selector, so the error can name them:

  - inputText          Requires `text`.
  - runFlow            Requires one of `file`, `commands`.
  - extendedWaitUntil  Requires one of `visible`, `notVisible`.
  - addMedia           Requires `files`.
  - tapOn              It takes an element selector, for example `tapOn: Login`.

Read off the schema rather than written out here, so the message cannot name an
option the parser does not accept. Also fills in the `// TODO: Add docs link`
sitting next to it.

`objectCommands` was re-deriving the command list by the same reflection
FlowCommandSchema does; it now asks the schema. Both it and `allCommands` become
lazy, because FlowCommandSchema reads `stringCommands` from further down that
same file and an eager read would run before that map exists.

The characterisation tests from the previous commit still pass unchanged, which
is what they were for. Five more describe the new message; each failed against
the parser as it was, with "but was: The command `inputText` requires additional
options". The docs-link one asserts FlowParseException.docs rather than the
message, since that field is rendered separately by the CLI and the workspace
planner -- asserting on the message would pass for the wrong reason.

Verify:
- ./gradlew :maestro-orchestra:test - 445 tests, 0 failures
- ./gradlew :maestro-orchestra-models:test - 51 tests, 0 failures
- ./gradlew :maestro-cli:compileKotlin - passes

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vHfmsiT7skZdV13zcbeof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant