Skip to content

fix(rules): close the leftover Codex findings on pins and WF033 - #1110

Merged
hyperpolymath merged 3 commits into
mainfrom
claude/pins-wf033-followup
Nov 14, 2026
Merged

hyperpolymath merged 3 commits into
mainfrom
claude/pins-wf033-followup

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

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-ref reaches its argument only across blanks or a backslash-newline. A bare line break in a literal script ends the command.
  • The SHA must end the argument, so <sha>-backup is not a pin.
  • Comments in run: scripts are now blanked by shell quoting rules, not YAML rules, so --label "foo # bar" --hypatia-ref … is still read. This uses the new Hypatia.Workflow.shell_mask/2, which keeps byte offsets.
  • Because offsets are kept, a match in a folded run: > maps to its own source line.
  • The text fallback (YAML the parser cannot read) counts a repository:/ref: pair only under the with: of a step that uses: actions/checkout@….

WF033 (lib/rules/workflow_audit.ex)

  • A bare success test in an && list that ends the script fails the step. bash -e -c 'false && echo ok' returns 1.
  • 'success' == needs.x.result counts as a guard, the same as the other order.
  • exit inside 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

  • Tests: 8 new tests, one per finding, and each fails on origin/main. Stashing lib gives 206 tests, 8 failures, and with the fix there are 0. Guard tests were also added: a && list followed by another command, and exit "$CODE".
  • mix test test/rules test/soundness_test.exs gives 954 tests, 0 failures.
  • mix format --check-formatted passes on the changed files.
  • gen-rules-praxis.sh --check, check-readme-claims.sh and tests/rules-praxis-test.sh all pass.

Not done

  • The && 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.
  • Shell masking does not model $'…', heredocs or command substitution.

Generated by Claude Code

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
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f5468771-a1c7-49cc-84d5-2ea974bbd26e
Commits

Reviewing files that changed from the base of the PR and between 8721e71 and 7331142.

Files selected for processing: 5

  • lib/hypatia/workflow.ex
  • lib/rules/ci_failure_triage.ex
  • lib/rules/workflow_audit.ex
  • test/rules/always_reads_cancelled_needs_test.exs
  • test/rules/ci_failure_triage_test.exs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 14, 2026 18:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T19:32:29.334249Z 7331142 New commits
🔒 Security Review ✅ Completed 2026-11-14T19:30:52.240452Z 7331142 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread lib/rules/workflow_audit.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/workflow_audit.ex Resolved
…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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread lib/rules/workflow_audit.ex Resolved
Comment thread lib/rules/workflow_audit.ex Resolved
Comment thread lib/hypatia/workflow.ex Resolved
@hyperpolymath
hyperpolymath merged commit 1d7efec into main Nov 14, 2026
8 checks passed
@hyperpolymath
hyperpolymath deleted the claude/pins-wf033-followup branch November 14, 2026 19:27
@sonarqubecloud

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

hyperpolymath added a commit that referenced this pull request Nov 14, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants