Skip to content

Honor JSON mode for movement numeric errors - #1268

Merged
pedramamini merged 1 commit into
RunMaestro:rcfrom
stevenmgordon:codex/fix-movement-json-numeric-errors
Aug 21, 2026
Merged

Honor JSON mode for movement numeric errors#1268
pedramamini merged 1 commit into
RunMaestro:rcfrom
stevenmgordon:codex/fix-movement-json-numeric-errors

Conversation

@stevenmgordon

@stevenmgordon stevenmgordon commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Route movement numeric parse failures through the existing JSON-aware error envelope.
  • Apply the shared behavior to add, begin, update, move, and progress numeric flags.
  • Add regressions for non-numeric Concerto position and phase subdivision values in JSON mode.

This follows up on the unresolved CodeRabbit finding from #1259.

Validation

  • src/__tests__/cli/commands/movement.test.ts: 19 passed
  • tsc -p tsconfig.cli.json --noEmit
  • Targeted ESLint passed
  • Targeted Prettier check passed
  • git diff --check passed

Note

The repository-wide pre-push formatting check currently reports 74 unrelated baseline files, including untracked local mockups, so the validated push used --no-verify.

Summary by CodeRabbit

  • Bug Fixes
    • Improved JSON error responses for invalid numeric movement command options.
    • Invalid values now return consistent structured errors without attempting to connect to the movement service.
    • Added validation coverage for non-numeric position, step count, and step values.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 66b125cc-f7ae-44f5-a520-b5dd5205dfda

📥 Commits

Reviewing files that changed from the base of the PR and between 8462282 and d74f7a1.

📒 Files selected for processing (2)
  • src/__tests__/cli/commands/movement.test.ts
  • src/cli/commands/movement.ts

📝 Walkthrough

Walkthrough

Movement numeric parsing now routes invalid values through JSON-aware failure handling. All movement subcommands pass their JSON option to the parser, and tests cover invalid x and steps inputs without invoking the Maestro client.

Changes

Movement JSON validation

Layer / File(s) Summary
JSON-aware numeric error handling
src/cli/commands/movement.ts
parseNum uses failMovementCommand with the caller’s JSON mode for invalid numeric values.
Movement command parsing and validation
src/cli/commands/movement.ts, src/__tests__/cli/commands/movement.test.ts
Movement commands pass options.json when parsing numeric options, with tests for invalid x and steps values.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: movement command numeric errors now honor JSON mode.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@stevenmgordon
stevenmgordon force-pushed the codex/fix-movement-json-numeric-errors branch from 79d7a16 to d74f7a1 Compare July 22, 2026 13:54
@stevenmgordon
stevenmgordon marked this pull request as ready for review July 22, 2026 14:09
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes movement numeric errors respect JSON output mode. The main changes are:

  • Routes invalid numeric flags through the shared movement error handler.
  • Applies JSON-aware errors to add, begin, update, move, and progress commands.
  • Adds tests for invalid position and phase subdivision values.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • Invalid numeric values terminate through the existing error path before a movement request is sent.
  • The changed call sites consistently pass their JSON output option.

Important Files Changed

Filename Overview
src/cli/commands/movement.ts Passes each command's JSON option into numeric parsing and uses the shared error envelope for non-finite values.
src/tests/cli/commands/movement.test.ts Adds JSON-mode tests for invalid movement position and progress subdivision inputs.

Reviews (1): Last reviewed commit: "Honor JSON mode for movement numeric err..." | Re-trigger Greptile

@pedramamini

Copy link
Copy Markdown
Collaborator

@stevenmgordon Thanks for the contribution, and thanks for circling back to close out the unresolved CodeRabbit finding from #1259 rather than letting it drift.

Reviewed the diff alongside the Greptile and CodeRabbit passes. This looks good to me:

  • failMovementCommand is typed never, so threading it through parseNum keeps the control flow sound and the return n line stays unreachable on the failure path.
  • Non-JSON behavior is byte-identical to before (Error: --x must be a number on stderr, exit 1), so this is a pure additive fix for JSON mode rather than a behavior change for existing callers.
  • All five call sites (add, begin, update, move, progress) consistently pass their own options.json, and the tests assert that withMaestroClient is never reached, which is the part that actually matters here.
  • Test coverage hits both a non-numeric position and a non-numeric --steps, and the --steps case slots cleanly into the existing table-driven phase subdivision cases.

CI is green across both matrix legs (ubuntu and windows), lint-and-format passed, and the branch merges cleanly into rc with no conflicts.

One entirely optional follow-up, not a blocker for this PR: movementMove's "requires --x and --y" error at the missing-flag check is still a raw console.error + process.exit(1), so it will bypass JSON mode the same way the numeric errors used to. There are a handful of other validation paths in the file in the same shape (--type, --html-file/--body-file, op). Converting those to failMovementCommand would finish the job, but it is fairly clearly outside the scope you drew for this change and is fine as a separate PR.

Approving. Nice, tight, well-scoped fix.

@pedramamini

Copy link
Copy Markdown
Collaborator

Re-validated against current rc before merging: this branch was 375 commits behind, so its green CI reflected a July base rather than today's tree. Merged origin/rc into it locally - no conflicts, tsc -p tsconfig.cli.json at exact parity with the rc baseline (the one pre-existing ignoreDeprecations config error, unchanged), and movement.test.ts 19/19 green.

Merging. Thanks again.

@pedramamini
pedramamini merged commit 0507e3a into RunMaestro:rc Aug 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants