Repository navigation
feat(cli): check a .rb script's syntax before its review, and hide --dry-run - #209
Merged
Merged
Conversation
…dry-run A script with a typo reached the review dialog, the PIN and the touch, and only failed on the rack after the process booted. run and exec now have the local Ruby parse a .rb script first and refuse one with a syntax error, before anyone is asked anything. Nothing in the script runs: ruby -c only parses, and the exact bytes go in on stdin with any #! line blanked. Without a Ruby that runs, the script goes unchecked. --skip-syntax-check is for syntax a local Ruby is too old for. --dry-run is hidden from --help and the docs: it was for developing the script review. A real run does the same checks before asking anyone anything, so a dry run first only made the person approve the same dialog twice, and its Run button ran nothing. internal/cli/AGENTS.md says what it's for.
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Nov 4, 2026 5:52a.m. | Review ↗ | |
| Go | Nov 4, 2026 5:52a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Ruby 3.2 ends its output with "-: compile error (SyntaxError)", and packaged Rubies are called ruby3.4 and the like, so those lines still named stdin.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Syntax check. A script with a typo got all the way through the review dialog, the PIN and the touch, then failed on the rack once the process had booted.
runandexecnow have the local Ruby parse a.rbscript first and refuse one with a syntax error, before anyone is asked anything:ruby --disable=all -c -:-conly parses, includingBEGINblocks, and--disable=allignoresRUBYOPT. The script goes in on stdin as the exact bytes that will be sent, with any#!line blanked (Ruby takes switches from it, and hunts for a Ruby script past one naming another interpreter).TestCheckRunsNothingInTheScriptcovers these with a real Ruby, and fails if-cis removed.ruby, a version manager shim with no version set, a timeout or a signal all leave the script unchecked. Only Ruby exiting with an error refuses it.--skip-syntax-checkis for a local Ruby too old for the script's syntax. macOS's system Ruby 2.6 refusesdef x = 1, for example, so the error names the Ruby that judged it.--dry-runis hidden from--helpand the docs, and still works. It was for developing the script review. A real run does the same checks before asking anyone anything, so a dry run first only had the person approve the same dialog twice, and that dialog's Run button runs nothing.internal/cli/AGENTS.mdnow says what it's for.Tested: the new and affected CLI tests pass, and removing
-cor the#!blanking makes them fail. Run for real against a gateway, a broken script is refused with no dialog, andrun --helpno longer lists--dry-run. The real-Ruby tests also run in CI, on Ruby 3.2.3, as well as on 3.4.7 locally.Also bumps the version to v0.1.31. There are no gateway changes.