Skip to content

feat(ci_failure_triage): report Hypatia pinned at different commits - #1103

Merged
hyperpolymath merged 6 commits into
mainfrom
claude/triage-hypatia-pin-drift
Nov 14, 2026
Merged

hyperpolymath merged 6 commits into
mainfrom
claude/triage-hypatia-pin-drift

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Minted repos keep segfaulting (exit 139) in the RSR oracle and the Hypatia scan because they pin an old Hypatia (be98f74), from before the #1062 crash fix. This was confirmed by MMT/Autoformalisation on Apodeixis.jl#25: syncing the pins from the template fixed it. The pin sits in five places that must move together, and the template itself splits them. This adds a static check, in the same shape as the existing panic-attack scanner_pin_drift.

What

  • check_hypatia_pin_drift/1 reads these Hypatia pin sites:
    • HYPATIA_SHA: env (block or flow form)
    • --hypatia-ref <sha>
    • a checkout of repository: hyperpolymath/hypatia with a sibling ref:, in either order
    • hypatia-rule-order.json scanner.commit (only when scanner.repository is hyperpolymath/hypatia)
  • When more than one commit is pinned, it reports every site. The new hypatia_pin_drift rule is report-only: routed to the owner, never auto-fixed. YAML comments are stripped, so a kept "old pin" comment is not a second pin. ${{ … }} values are not pins.
  • mix hypatia.ci_triage pins runs it alongside the panic-attack check and accepts the policy JSON.

Proof

On rsr-template-repo main d183b32, mix hypatia.ci_triage pins .github/workflows/*.yml .machine_readable/policies/hypatia-rule-order.json exits 3 and reports all five sites: dogfood-gate's oracle at 51539ab, and the scan, both verdict-grid flags and the policy at 6693f9a. On main it reports nothing for the same files.

Tests

  • 7 new tests:

    • the template's split, with all 5 sites reported
    • one pin everywhere is clean
    • a checkout of another repository is not a Hypatia pin
    • a commented-out old pin is ignored
    • a policy naming another scanner is not a Hypatia pin
    • ref: before repository: is still read
    • a variable HYPATIA_SHA is not a pin

    All fail on main.

  • mix test test/rules: 887 tests, 0 failures.

  • gen-rules-praxis.sh --check (deed regenerated, 438 rules), check-readme-claims.sh and rules-praxis-test.sh (22/22) are clean, and the self-scan reports no findings.

Not in scope


Generated by Claude Code

Minted repos pin Hypatia in five places that must move together (scan
HYPATIA_SHA, verdict grid --hypatia-ref x2, dogfood-gate's oracle
checkout, hypatia-rule-order.json scanner.commit). A stale pin lacks the
#1062 segfault fix (Apodeixis.jl#25), and the template itself splits the
oracle (51539ab) from the rest (6693f9a). check_hypatia_pin_drift/1
reports every site when more than one commit is pinned; owner decides,
never auto-fixed. `mix hypatia.ci_triage pins` runs it alongside the
panic-attack check and accepts the policy JSON.

Verified on rsr-template-repo d183b32: 5 sites reported, exit 3.

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 59 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: f9787175-5dd7-4ce9-924c-7b9ae33df024
Commits

Reviewing files that changed from the base of the PR and between da9cdd7 and f63995e.

Files selected for processing: 4

  • hypatia_rules_praxis.deed
  • lib/mix/tasks/hypatia.ci_triage.ex
  • lib/rules/ci_failure_triage.ex
  • 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 16:15
@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-14T17:53:38.628314Z f63995e New commits
🔒 Security Review ✅ Completed 2026-11-14T17:49:29.411146Z f63995e 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: 2bf98bb62c

ℹ️ 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/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
…s and apostrophes

Raised by Codex on #1103 (all three would hide or invent drift):
- A checkout pin is read from the parsed workflow, not a line-counting
  regex, so a blank line or many sibling `with:` inputs cannot hide it.
- Each occurrence is its own site, with its line: two jobs passing the
  same old `--hypatia-ref` are two findings, not one after Enum.uniq.
- An apostrophe inside a plain value (`name: Don't ...`) no longer opens
  a quoted scalar in strip_yaml_comments, so a later `# --hypatia-ref`
  comment is stripped, not read as a live pin. This is the shared
  stripper, so the panic-attack check gains the same fix.

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: bbfc48e448

ℹ️ 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/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Raised by Codex on #1103 (second round), all from scanning raw text:
- `'Don''t # x'`: a doubled quote ended the scalar early and the rest was
  stripped as a comment, hiding a live pin.
- A folded `run: >` carries `--hypatia-ref` and its SHA on two lines.
- `HYPATIA_SHA: *alias` resolves to the anchored commit.
- A lowercase `hypatia_sha` does not set the scanner; the name is
  case-sensitive.

Pins are now read from Hypatia.Kyaml's tree: HYPATIA_SHA map entries
(aliases resolved, case-sensitive) and `--hypatia-ref` in any string
scalar, with block-scalar lines from `segments`. Raw-text matching stays
only as a fallback for YAML that does not parse. The shared comment
stripper also keeps `''` inside a single-quoted scalar, so the
panic-attack check no longer loses a flow pin after one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT

Copy link
Copy Markdown
Owner Author

"Integration Status" is red only on superseded heads (2bf98bb, later bbfc48e). Each later push cancelled that run's stress, integration and coverage jobs, and the rollup counts a cancelled job as not-success. Nothing ran red: every job that finished passed. The current head is aed404c.


Generated by Claude Code

@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: aed404c2a8

ℹ️ 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/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Raised by Codex on #1103 (third round):
- HYPATIA_SHA counts only inside an `env:` mapping, not as a `with:`
  action input or any other key of that name.
- `--hypatia-ref` counts only inside a `run:` script, with shell
  comments removed: a step `name:`, a description, or a
  `# previously --hypatia-ref <sha>` line sets nothing.
- The policy's scanner.repository matches case-insensitively, as the
  checkout path already did.
- strip_yaml_comments: after `:` or `-` a quote opens a scalar only past
  YAML's separating space (`scheme:'v` is plain text); a flow `[`, `{`
  or `,` still opens one directly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT

Copy link
Copy Markdown
Owner Author

Scope note for reviewers. hypatia_pin_drift is advisory and report-only (routed to the owner, never auto-fixed). It now reads pins the way they take effect: env: HYPATIA_SHA, run: --hypatia-ref with shell comments removed, checkout ref: and the policy scanner.commit, all from the parsed YAML. Stated limits: a pin built at run time (string concatenation, $VAR expansion, values read from other files), and shell syntax beyond line comments (heredocs, eval), are not read. A finding is a prompt for a person to look, not a verdict.


Generated by Claude Code

@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: 332bca5659

ℹ️ 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/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
…e text fallback

Raised by Codex on #1103 (fourth round):
- `env: *shared` sets the environment from the anchored mapping; an
  alias under `env:` is now followed (only there, so the anchor is never
  counted twice), reported at the alias's line.
- YAML outside the parser's subset falls back to text; the fallback now
  also reads a `repository: hyperpolymath/hypatia` checkout with a
  sibling `ref:` (same indentation, either order, blank lines allowed).

Stated limits, replied on the threads: a flag that only appears inside
quoted shell data (`echo "… --hypatia-ref …"`), and YAML tags before a
quoted scalar in the text fallback.

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: 7a478eb3c4

ℹ️ 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/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
Comment thread lib/rules/ci_failure_triage.ex Resolved
@hyperpolymath
hyperpolymath merged commit fed21d8 into main Nov 14, 2026
32 checks passed
@hyperpolymath
hyperpolymath deleted the claude/triage-hypatia-pin-drift branch November 14, 2026 17:46
@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: f63995ed2f

ℹ️ 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".

end

defp run_pins(label, "run", value) do
case Hypatia.Kyaml.deref(value) do

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 Preserve each aliased run site

Fresh evidence beyond the fixed repeated-direct-run case is two steps that both use run: *cmd, where cmd anchors a command containing a stale --hypatia-ref: dereferencing here gives both matches the anchor scalar's location, making their site maps identical so the later Enum.uniq/1 collapses them and reports the anchor line instead of either active step. Preserve the alias location for each invocation so every effective pin site is reported.

Useful? React with 👍 / 👎.

Comment on lines +1196 to +1197
{"HYPATIA_SHA", @hypatia_env},
{"HYPATIA_SHA", @hypatia_env_flow},

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 Preserve semantic scope in the text fallback

Fresh evidence beyond the fixed parsed with: case is an otherwise valid workflow that triggers the fallback, such as one containing a multiline quoted scalar, plus with: {HYPATIA_SHA: <old-sha>} on an action. This fallback applies the environment regex to the entire document, so that unrelated action input is counted as a live scanner pin and causes false drift against a real newer pin; the fallback needs to retain the same env-mapping scope as the parsed path.

Useful? React with 👍 / 👎.

is_binary(repo) and String.downcase(repo) == "hyperpolymath/hypatia",
ref = Hypatia.Workflow.input(step, "ref"),
is_binary(ref) and Regex.match?(~r/\A[0-9a-fA-F]{40}\z/, ref) do
%{file: label, key: "checkout ref", sha: String.downcase(ref), line: step.line}

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 Report the checkout ref's source line

For every ordinary multiline checkout step, step.line is the line containing - uses: actions/checkout@…, not the later ref: input that holds the reported SHA. Consequently the finding directs the owner to the wrong line; retrieve the ref input node's location rather than using the enclosing step location.

Useful? React with 👍 / 👎.

hyperpolymath added a commit that referenced this pull request Nov 14, 2026
## 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](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