Repository navigation
fix(tier3): preserve exit status for quoted script paths - #727
Conversation
Signed-off-by: Afloat <ShuffleMonkey@163.com>
chrisknvidia
left a comment
There was a problem hiding this comment.
Thanks, this is a real gap and the fix is the right size. I reproduced it on main: python 'scripts/my task.py' with a recorded exit code comes back as "status could not be attributed", and with this change it reports the recorded 0 or 2. I checked a range of quoting styles (unquoted, single, double, escaped space, env prefix, redirects, pipelines, || true, ; echo, compound &&) and only the quoted-path-with-spaces cases change; everything else gives the same answer as before. Nothing new is executed here, and the single-segment branch runs after the same guards as before, so it does not widen what gets credited. The four regression cases fail on main and pass here; the three control cases pass on both. One small note inline about compound commands. CHANGELOG entry is under Unreleased.
Signed-off-by: Afloat <ShuffleMonkey@163.com>
Signed-off-by: Afloat <ShuffleMonkey@163.com>
rng1995
left a comment
There was a problem hiding this comment.
Thanks, @Afloat16, for preserving exit status for quoted script paths. I independently reproduced the remaining shell-negation issue: a script that exits 2 under ! python 'scripts/my task.py' 2 gives the shell status 0, and the new single-segment branch incorrectly passes command_succeeded; a script that exits 0 is incorrectly failed with shell status 1. The base leaves these quoted-path cases unclassified. Please keep negated commands unattributed unless the script's own status is known.
Validation: 31 quoted-path and declarative-check tests passed, plus an actual local-shell reproduction of both inverted outcomes. The existing issue remains unresolved; this review adds no duplicate inline thread.
Address the outstanding review with focused regression coverage and synchronize current main, keeping the release note under Unreleased. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Exercise escaped directory spaces independently from filename detection, assert that each script actually ran, and skip the POSIX shell fixture where bash execution is unavailable. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Retain the latest release notes and merged fixes alongside this change. Signed-off-by: Afloat <ShuffleMonkey@163.com>
rng1995
left a comment
There was a problem hiding this comment.
Thanks @Afloat16 for this contribution! I reviewed 45ee1a927f. I reproduced the problem on main, confirmed this change fixes it, and ran the new and related tests on this head (all pass). I left 2 inline comments (1 P2, 1 P3) to address before this can be approved.
Treat |& as a pipeline separator and skip the shell time keyword and -p options before checking for negation. Keep shell-tail and inverted statuses unattributed while retaining the quoted single-command fix. Add real Bash regressions for quoted and unquoted stderr pipelines and both timed-negation forms. All 15 added failure cases reproduce on the previous source; 2,154 related tests and full src/tests Ruff pass. Merge main and retain this change under Unreleased. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Signed-off-by: Afloat <ShuffleMonkey@163.com>
Head branch was pushed to by a user without write access
Keep real shell comment markers and physical command boundaries while excluding their text from the exit-status separator scan. Preserve literal hash arguments and real stderr pipelines, with native Bash and Zsh cases. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Stop comment-boundary inference at active shell expansions and backticks. Preserve literal and escaped forms and keep the default tokenizer unchanged. Record actual Bash and Zsh pipeline exits in the regression coverage. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Respect the recorded Bash and Zsh continuation behavior while preserving exit-status attribution for plain braced identifier arguments. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Keep no-comment commands on the existing tokenizer path, accept continued braced identifiers, use an ANSI-C state label compatible with the source scan, and gate stderr-pipeline tests on Bash 4. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Preserve existing status attribution when the comment scanner removes no text, while keeping ambiguous comment boundaries and real pipeline statuses unattributed. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Resolve only the competing changelog insertion. Preserve the reviewed pull request implementation, tests, and documentation unchanged while retaining upstream updates. Signed-off-by: Afloat <ShuffleMonkey@163.com>
Signed-off-by: Afloat <ShuffleMonkey@163.com>
Signed-off-by: Afloat <ShuffleMonkey@163.com>
|
@Afloat16 - Please resolve merge conflict to merge the PR. |
Synchronize with NVIDIA/SkillEvaluator main f867b7f. Retain this PR's entry under Unreleased and preserve published release history. Signed-off-by: Afloat <ShuffleMonkey@163.com>
|
Resolved the merge conflict in The implementation and regression-test patch has the same stable patch ID before and after synchronization. On the exact merged tree, 316 passed in the focused checks (Linux, Python 3.12.14); full-source Ruff, changed-file formatting, and Hosted checks on this head have completed: 21 successful, 2 skipped, no failures. The CI workflow passed. |
CHANGELOG.md: keep main's Unreleased content unchanged and keep this PR's quoted-script-status bullet as the first entry under Unreleased > Fixed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
… comments Skip the "--" option terminator after "time [-p]" when looking for a negation, so "time -- ! cmd" and "time -p -- ! cmd" stay unattributed instead of passing a check with the inverted shell status. Only treat a comment as unmodelled when it follows a command substitution, backtick or non-identifier parameter expansion. A comment that comes before the expansion cannot be misread by nested quoting, so a leading comment line no longer drops the script's recorded status. Add native Bash and Zsh tests for both, with controls that keep a comment after an expansion unattributed. Tests that need "time --" skip on Bash versions that read "--" as a command name. Update the CHANGELOG entry. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
Resolve the CHANGELOG.md conflict by keeping main's entries and this change's entry under Unreleased. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
Resolve the CHANGELOG.md conflict by keeping main's entries and this change's entry under Unreleased. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
rng1995
left a comment
There was a problem hiding this comment.
Thanks @Afloat16 for this contribution! I re-checked c1e38b48c: I merged current main into the branch (the only conflict was CHANGELOG.md, resolved by keeping main's entries and this entry under Unreleased), confirmed that every earlier review comment is addressed in the code, and ran this PR's tests and ruff, which pass. I found nothing new. Approving. I also pushed one follow-up commit for two edge cases found while re-checking: time -- ! cmd (and time -p -- ! cmd) is no longer given a recorded exit status, and a comment that comes before a command substitution no longer drops the script's recorded status. Both are covered by native Bash and Zsh tests. The optional note about compound cd dir && python 'a b.py' paths is left as a follow-up.
Summary
A single command such as
python 'scripts/my task.py'is recognized as invoking the expected script, butcommand_succeededreports it as not checked even when the tool recorded exit code 0 or 2. Exit-status attribution rejoins decoded shell tokens with spaces, losing the quoted path boundary before it checks the invocation again.For a single shell-command segment, use the original command text for the existing invocation check. Keep the existing rejection of unmodelled shells, control syntax and inline shell programs, and leave compound-command attribution unchanged.
Current review follow-up
Current head:
fa1db9974a36ceeca8cf6f12fe29479a702afff8, including the quoted-hash fix incd2232b329cb0d1f230d4ffba7b562ed7424572eand a merge of maina3bb7e91a325c92e1d2e05bcd716e1139e3624f2that preserves both Unreleased entries. Every PR code/test blob is unchanged by that merge.The comment scanner now rejects an unmodelled expansion only when it would remove comment text. With no comment removed, original spelling and existing status attribution are preserved, including quoted literal hashes next to command substitution, backticks or parameter defaults. Actual pipelines and ambiguous nested comment boundaries remain unattributed. The earlier split-identifier, ANSI-C quote-state and Bash 3.2 guard fixes remain in place.
Original verification
Four new regression cases fail on unchanged base
8fe9723: single- and double-quoted paths, each with success and nonzero exit status. Three additional controls retain unavailable status for pipelines,|| true, and a following unrelated command.python -m pytest tests/tier3/test_quoted_script_status.py tests/tier3/test_declarative_checks.py tests/reporting/test_declarative_coverage.py -q— 60 passed.make lintequivalent:python -m ruff check src testsmake testdid not complete successfully in this environment (see below)make buildequivalent:python -m build(wheel and sdist)The unchanged base
8fe9723, tested withpython -m pytest -x -q, stops after 456 passed and 19 deselected attests/ci/test_gateway_benchmark_workflows.py::test_gitlab_enriched_tier1_applies_the_keyless_job_baselines[extra0-expected0]. The sandbox has no/tmp, while that workflow fixture explicitly invokesmktemp -d /tmp/skillevaluator-enriched-tier1.XXXXXX. The same test fails for the same reason on the retry branch. No full-suite pass is claimed.Release Impact
CHANGELOG.md