Repository navigation
Conversation
check_run_syntax ran bash -n on each run: script, and its own docstring
said what that misses: a `docker run ... bash -c '...'` script is one
string to the outer shell, so an error inside it was not seen unless it
broke the outer quoting. (The apostrophe that broke run 37253683063 did
break the outer quoting, and main's gate already reports it; an unclosed
`if` or a stray `fi` inside the string it does not.)
Once the outer script parses, each single-quoted `bash -c '...'` and
`sh -c '...'` argument is now read out the way the outer shell reads it
-- '\'' is a quote, a splice of an outer value ('"$PART"', '$X') is one
word -- and parsed with bash -n / sh -n. A closing quote glued to
anything else, and a quote that never closes, are "cannot tell" (exit
2), not clean. Double-quoted bash -c "..." is not read: the outer shell
expands it first.
Measured on main's 122 workflows: 24 such scripts, 8 of them with
'"$VAR"' splices, all 24 parse. The self-test plants 12 new cases
(75 of 75 pass); main's gate run against the new cases fails the 7 that
expect a non-zero exit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
X Brain Health CheckScore: 100.0/100 X Brain is above merge threshold |
|
The three red checks on this PR come from main, not from this change.
#872 turns This PR changes only 🤖 Generated with Claude Code |
🧪 Brain Stress Test ResultsScore: not measured (no stress test prints a Score: line) X Stress test passed |
54020cd to
909c2e5
Compare
Summary by t27-beesThe change adds a second parsing pass for single-quoted Worth a look
Read: 2 files, +111 -4, the whole diff. Head |
Closes #892.
What changes
tools/check_run_syntax.pynow does a second pass once a workflowrun:script parses. Each single-quotedbash -c '...'/sh -c '...'argument in that script is read out and parsed withbash -n/sh -n.The read-out follows the outer shell's rules:
'\''is a quote;'"$PART"','$X'or'${Y}', becomes one placeholder word;bash -lcandbash -euo pipefail -care recognised;bash -c "..."is not read, because the outer shell expands it first;zsh -cis not read.The script is checked only when the outer script parses. A broken outer script is already reported, and its quote pairing cannot be trusted.
The summary line now also counts the inner scripts:
Measured
'"$VAR"'splices, all parse; exit 0tools/test_check_run_syntax.py8d0a7d9d4(the apostrophe that broke run 37253683063)fiinside the stringbash -nexits 0, innerbash -nexits 2The 12 new cases:
ifinsidebash -cbash -c'"$X"'splice'$X'/'${Y}'splicesh -c '…'with<(bash -lcbash -euo pipefail -c'echo x'yzsh -cNot measured
bash -cthrough a variable or a heredoc. These are not read.bash -nsubprocess per inner script, 24 on main. Its wall time in CI has not been measured.🤖 Generated with Claude Code