You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
run --script silently replaces non-object params with an empty object. A mutating command can consequently run against the current selection instead of rejecting malformed input.
Change
Validate every script line before creating a session or running a command. Objects remain valid, and omitted or null parameters still mean an empty object. Other values produce a source-and-line error.
Not in this PR: Snapshot script parsing.
How it was checked
The regression test failed before the fix and all 27 CLI integration tests passed afterward.
Direct CLI checks confirmed malformed parameters exit nonzero with no command output, while omitted and null parameters succeed.
Before rebasing, cargo xtask ci stopped on an existing clippy::if_same_then_else error in apps/lightcraft/src/native_menu.rs:492. The same code remains on current upstream main; full CI was not rerun after rebasing.
Merging
Overlap: No directly overlapping PR found in a targeted search.
Existing edits and libraries: Invalid scripts stop before opening the library or executing commands.
Shared numbers taken: None.
New dependencies, unsafe, network access or deleted files: None.
Summary by CodeRabbit
Bug Fixes
run --script now reports a line-specific error when params is an array, string, number, or boolean, instead of silently treating it as empty.
Missing or nullparams still default to an empty object, and object values remain accepted.
Invalid parameters are rejected for both standard input and file input, with no command output produced.
Reviewing files that changed from the base of the PR and between 662df66 and b576c72.
Files selected for processing: 2
apps/lightcraft-cli/src/main.rs
apps/lightcraft-cli/tests/it/cli.rs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Walkthrough
The run --script parser now accepts object parameters, defaults missing or null parameters to an empty object, and reports an error for other JSON types. Integration tests cover both stdin and file input.
The parser reports the script path and line number when params is not an object, null, or absent. Integration tests check invalid types for stdin and file input, confirm no command output on failure, and verify accepted values.
The change rejects malformed parameters before connecting to a backend, opening a library, or executing commands. Valid object parameters and omitted or null parameters retain their existing behavior. No introduced or worsened security risk was identified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — The tightened input gate protects both existing execution destinations: a remote control connection and a headless session with optional library opening and imports. Invalid parameter types cannot reach either destination through this run-script path.
Trust Boundaries and Controls
observed — User-supplied script JSON receives stricter validation before reaching command execution. Existing direct control-method routing and engine.execute routing remain unchanged; the PR narrows accepted inputs rather than adding a route or expanding command authority.
Resilience and Maintainability Implications
observed — Pre-execution rejection is not transactional execution: after validation succeeds, commands still execute individually, runtime failure stops subsequent commands unless keep-going is enabled, and prior effects are not rolled back. This behavior predates the PR and is not worsened by the validation change.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: rejecting non-object script parameters.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
Clippy (1.99.0)
Clippy execution timed out
Comment @coderabbitai help to get the list of available commands.
…d control indexes, non-UTF-8 CLI arguments and non-object script params
Hand ports of three open upstream PRs (their files moved in the fork:
apps/cli, crates/develop/src/controls.rs). Tests come along, adapted to
the fork's test binary.
Sources: upstream PRs storytold#3165 (Silvertree2010), storytold#3124 and storytold#3122 (DAnaeto).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
run --scriptsilently replaces non-objectparamswith an empty object. A mutating command can consequently run against the current selection instead of rejecting malformed input.Change
Validate every script line before creating a session or running a command. Objects remain valid, and omitted or null parameters still mean an empty object. Other values produce a source-and-line error.
Not in this PR: Snapshot script parsing.
How it was checked
cargo fmt --all -- --checkandcargo clippy --locked -p lightcraft-cli --all-targets -- -D warningspassed.cargo xtask cistopped on an existingclippy::if_same_then_elseerror inapps/lightcraft/src/native_menu.rs:492. The same code remains on current upstream main; full CI was not rerun after rebasing.Merging
Summary by CodeRabbit
run --scriptnow reports a line-specific error whenparamsis an array, string, number, or boolean, instead of silently treating it as empty.nullparamsstill default to an empty object, and object values remain accepted.