Repository navigation
fix(rules): close the leftover Codex findings on pins and WF033 - #1110
Conversation
hypatia_pin_drift (#1103): - --hypatia-ref spans only blanks or a backslash-newline, and the SHA must end the argument (`<sha>-backup` is not a pin). - run: comments are blanked by shell quoting rules (new Hypatia.Workflow.shell_mask/2, offset-preserving), so a quoted `#` no longer hides a live flag, and a folded match maps to its own line. - The text fallback reads a checkout ref only under a step that uses actions/checkout. WF033 (#1105): - A bare success test in an && list that ends the script fails the step. - `'success' == needs.x.result` is a guard, like the other order. - `exit` in quotes or a shell comment is not a failure path. Each change has a test that fails without it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 40 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21048be425
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…a pin Codex on #1110: - WF033: `exit "0"` is a success. The exit command is found with quotes blanked, and its argument is read at the same offset with only comments blanked. - WF033: in `test … && echo ok; echo done` the last command sets the status, so the && list is not the step's result. - pins: `<` and `>` end the SHA argument, as the shell reads it. Each has a test that fails without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49a8f447c1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7331142f4e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # line break in a literal script ends the command (a folded scalar has | ||
| # already turned its breaks into spaces). The SHA must end the argument: | ||
| # `<sha>-backup` is not that commit (Codex on #1103). | ||
| @hypatia_ref_flag ~r/--hypatia-ref(?:=|(?:[ \t]|\\\n)+)["']?([0-9a-fA-F]{40})(?=["'\s;|&)<>]|\z)/ |
There was a problem hiding this comment.
Recognize a continued newline after the SHA
When a bare SHA is immediately followed by a backslash-newline with no intervening blank, as in --hypatia-ref <sha>\ followed by an indented --out x, Bash removes the continuation and the indentation still terminates the SHA argument. This lookahead instead sees \ and rejects the valid pin, so both the parsed-workflow regex and the similarly changed fallback regex can miss real drift; accept a backslash-newline when the following text separates arguments.
Useful? React with 👍 / 👎.
…1129) ## What This PR fixes the three Codex P2 findings that #1110 merged with: - **WF033:** `exit` takes its argument only across blanks. Before, a masked comment (`exit # done`) let `\s+` reach the next line and read `"$CODE"` as the exit argument. - **`Hypatia.Workflow.shell_mask/2`:** `)` no longer starts a word. In `--label=$(name)#suffix`, the `#` is part of the word, so a later `--hypatia-ref` is still read. - **WF033:** `&>`, `>&` and `<&` are redirections, not a later command. `test … && echo ok &>/dev/null` keeps the list's status. ## Why These are threads 4575286064, 4575286074 and 4575286070 on #1110. The owner approved this follow-up. ## Evidence - There are 3 new tests, and each fails on `main`'s code (`213 tests, 3 failures`) and passes with this change. - `mix test test/rules test/soundness_test.exs`: `977 tests, 0 failures`. This was run with #1128's `rsr_conformance.ex` applied locally, because `main` does not compile without it. - `mix format`, `gen-rules-praxis.sh --check`, `check-readme-claims.sh` and `rules-praxis-test.sh` all pass. ## Not done - CI cannot compile this until #1128 (the `main` compile fix) merges. After that I'll merge `main` into this branch. - A `#` right after a subshell's `)`, as in `(cmd)#x`, is now read as text, not as a comment. That only errs towards reading more of the script. --- _Generated by [Claude Code](https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT)_ --------- Co-authored-by: Claude <[email protected]>



What
This PR follows up #1103 (
hypatia_pin_drift) and #1105 (WF033). It fixes the 8 Codex findings that were still open when those PRs merged.Pins (
lib/rules/ci_failure_triage.ex)--hypatia-refreaches its argument only across blanks or a backslash-newline. A bare line break in a literal script ends the command.<sha>-backupis not a pin.run:scripts are now blanked by shell quoting rules, not YAML rules, so--label "foo # bar" --hypatia-ref …is still read. This uses the newHypatia.Workflow.shell_mask/2, which keeps byte offsets.run: >maps to its own source line.repository:/ref:pair only under thewith:of a step thatuses: actions/checkout@….WF033 (
lib/rules/workflow_audit.ex)&&list that ends the script fails the step.bash -e -c 'false && echo ok'returns 1.'success' == needs.x.resultcounts as a guard, the same as the other order.exitinside quotes or a shell comment is not a failure path.exit "$code"still is.Why
Each of these produced a false drift (exit 3), a missed drift, a wrong line, or a false or missed WF033.
Evidence
origin/main. Stashinglibgives206 tests, 8 failures, and with the fix there are 0. Guard tests were also added: a&&list followed by another command, andexit "$CODE".mix test test/rules test/soundness_test.exsgives954 tests, 0 failures.mix format --check-formattedpasses on the changed files.gen-rules-praxis.sh --check,check-readme-claims.shandtests/rules-praxis-test.shall pass.Not done
&&rule looks only at a test that starts its line and is the script's last command. A test in the middle of a longer&&chain is not traced.$'…', heredocs or command substitution.Generated by Claude Code