Skip to content

ci(miri): gate PRs that touch the Miri-scoped crate - #712

Merged
nh13 merged 1 commit into
mainfrom
nh/miri-gate-unsafe-crates
Aug 9, 2026
Merged

nh13 merged 1 commit into
mainfrom
nh/miri-gate-unsafe-crates

Conversation

@nh13

@nh13 nh13 commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Stacked on #702 — review that one first; this PR's diff against it is .github/workflows/miri.yml only.

Why

Miri ran only on a daily cron, so the earliest a UB regression could surface was the next morning, attributed to a whole day of merges rather than to the change that introduced it. Bisecting UB is expensive, and naming the commit is most of Miri's value.

There was a good reason it was cron-only, recorded in the workflow header: a nightly-Miri regression should not block unrelated work. Path filtering keeps that true rather than trading it away — a PR that does not touch the covered crate never starts the workflow, so it cannot be blocked by it. What it can block is exactly the set of PRs able to introduce UB in the code Miri checks.

The other objection was cost, and it does not survive the current scope: the sort tests run in seconds under Miri, against a test job that takes minutes.

What

  • pull_request trigger filtered to crates/fgumi-raw-bam/** and .github/workflows/miri.yml.
  • No push: on main — a pull_request run tests the simulated merge commit, so a merged PR is already covered, and the cron re-checks main daily. Adding it would double every Miri run to shave hours off drift the cron already catches.
  • The cron stays, with a different job: a nightly/toolchain regression against unchanged code, and main between merges. It is also where scope can widen (the fgumi-sort FFI exclusion) without charging every PR for it.
  • The failure-reporting step from ci: report scheduled-workflow failures as a tracking issue #702 needed no change — it is already gated to github.event_name == 'schedule', so a PR failure stays in that PR's checks instead of filing an issue.

Verification

actionlint clean, and the filter checked against nine paths: crates/fgumi-raw-bam/{src/sort.rs,Cargo.toml} and this workflow trigger it; fgumi-sort, fgumi-umi, src/main.rs, Cargo.lock, README.md and check.yml do not.

This PR demonstrates itself. It touches .github/workflows/miri.yml, so the new filter matched and a miri check ran on it — the first per-PR Miri run in this repo. Measured on that run:

job duration
miri 1m26s
test 3m27s
coverage 3m43s
sort-correctness 2m22s

So the cost argument is settled with real numbers rather than an estimate: the whole Miri job, recompile included, is under half the test job and is nowhere near the critical path. Inside it, the scoped filter ran 30 tests passed, 694 filtered out — the intended narrow scope, and not a vacuous run.

Two things reviewers should weigh

  1. main is not branch-protected, so nothing here makes the job a required check. If required checks are ever configured, note the standard GitHub trap: a required check skipped by a path filter leaves a PR waiting forever. That needs a "skipped is success" companion job, not a change here.

  2. Miri covers 2 of the 7 files carrying #[allow(unsafe_code)] — fgumi-sort has five, excluded because memory_probe.rs calls mimalloc/mach2 FFI that Miri cannot execute. So a green Miri means less than it reads like. The higher-value follow-up is a cheap, stable-toolchain check in check.yml asserting the set of allow(unsafe_code)-bearing files matches an expected allowlist, failing on any addition or move. That would cover all 7 and catch new unsafe appearing in an uncovered crate, which nothing does today.

Follow-up for the runall stack

feat-runall adds fgumi-pipeline-core and a second Miri step for its erased module. That crate is not on main, so it is deliberately absent from the filter here. Whichever branch lands that step must add crates/fgumi-pipeline-core/** alongside it, or the new step will only ever run on the cron.

Risk: command output none; unsafe none and CLAUDE.md allowlist unchanged; memory, queue, and backpressure policy none.

Fix: Run Miri on relevant pull requests while retaining daily regression coverage.

  • Add path-filtered pull_request coverage for crates/fgumi-raw-bam/** and .github/workflows/miri.yml.
  • Keep scheduled failure reporting limited to cron runs.
  • actionlint and path checks pass.
  • Per-PR Miri run passed 30 tests in 1m26s.

@nh13
nh13 temporarily deployed to github-actions August 4, 2026 04:12 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0627a796-fb79-404d-8d4b-02a4ad6dad23

📥 Commits

Reviewing files that changed from the base of the PR and between c55489f and 1b1305d.

📒 Files selected for processing (1)
  • .github/workflows/miri.yml

Walkthrough

The Miri workflow now runs for changes under fgumi-raw-bam and for workflow edits. It retains scheduled and manual runs, supports scheduled failure reporting with issue-write permission, and documents concurrency cancellation and the unchanged 20-minute timeout.

Changes

Miri workflow updates

Layer / File(s) Summary
Miri triggers and execution controls
.github/workflows/miri.yml
The workflow adds path-filtered pull-request triggers, scheduled failure reporting with the workflow token, and issue-write permission. It documents cancellation behavior and the 20-minute timeout rationale.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: raw-bam, continuous-integration

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title uses valid Conventional Commit syntax and accurately describes the Miri workflow change for pull requests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@nh13

nh13 commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

@codecov

codecov Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.08%. Comparing base (3d83a55) to head (1b1305d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #712      +/-   ##
==========================================
- Coverage   94.08%   94.08%   -0.01%     
==========================================
  Files         180      180              
  Lines      109210   109210              
==========================================
- Hits       102751   102750       -1     
- Misses       6459     6460       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nh13

nh13 commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/actions/report-cron-failure/action.yml:
- Around line 51-53: Update the gh issue list lookup that assigns existing to
request enough results for all relevant open issues by adding an explicit limit
of 1000, preserving the existing repository, label, state, JSON fields, and jq
title matching behavior.

In @.github/workflows/miri.yml:
- Around line 114-124: Move cron failure reporting out of the test-job steps
because timeouts prevent later steps from running. In .github/workflows/miri.yml
lines 114-124, add a dependent reporting job with needs: miri and the specified
schedule/failure condition; in .github/workflows/stress.yml lines 58-68, add the
equivalent job with needs: stress-tests. Have each job check out the repository
before invoking report-cron-failure, grant only these reporting jobs contents:
read and issues: write, and keep the test jobs limited to contents: read.
- Around line 39-44: Update the pull_request trigger in the Miri workflow to run
for every pull request instead of relying on the paths filter. If scoped
execution is still needed, move changed-path detection into a dedicated job and
use its result to control subsequent Miri jobs, ensuring the required gate is
not skipped for large pull requests.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 33ff2a31-335f-4b56-84dc-122e8de48fce

📥 Commits

Reviewing files that changed from the base of the PR and between a954af9 and c55489f.

📒 Files selected for processing (3)
  • .github/actions/report-cron-failure/action.yml
  • .github/workflows/miri.yml
  • .github/workflows/stress.yml

Comment thread .github/actions/report-cron-failure/action.yml Outdated
Comment thread .github/workflows/miri.yml
Comment thread .github/workflows/miri.yml Outdated
Miri ran only on a daily cron, so the earliest a UB regression could surface
was the next morning, attributed to a whole day of merges rather than to the
change that introduced it. Bisecting UB is expensive; naming the commit is
most of Miri's value.

Add a `pull_request` trigger filtered to `crates/fgumi-raw-bam/**` and this
workflow file. The filter is what preserves the reason the workflow was
cron-only in the first place — a nightly-Miri regression should not block
unrelated work — because a PR that does not touch the covered crate never
starts the workflow and so cannot be blocked by it. What it can block is
exactly the set of PRs able to introduce UB in the code Miri checks.

Cost was the other objection and does not survive the current scope: the
`sort` tests run in seconds under Miri, against a `test` job that takes
minutes. The recompile dominates and is still not the long pole.

No `push:` on `main`. A `pull_request` run tests the simulated merge commit,
so a merged PR was already covered, and the cron re-checks `main` daily.
Adding it would double every Miri run to shave hours off drift the cron
already catches.

The cron stays, with a different job: it covers a nightly/toolchain
regression against unchanged code, and `main` between merges — neither of
which a PR run can see. It is also where scope widens (the `fgumi-sort` FFI
exclusion) without charging every PR for it.

The failure-reporting step needs no change: it is already gated to
`github.event_name == 'schedule'`, so a PR failure stays in that PR's checks
instead of filing an issue.

Verified with `actionlint`, and by checking the filter against nine paths —
the covered crate and this workflow trigger it; `fgumi-sort`, `fgumi-umi`,
`src/`, `Cargo.lock`, `README.md` and `check.yml` do not.

Note for the runall stack: `feat-runall` adds `fgumi-pipeline-core` and a
second Miri step for its `erased` module. That crate is not on `main`, so it
is deliberately absent from the filter here; whichever branch lands that step
must add `crates/fgumi-pipeline-core/**` alongside it or the new step will
only ever run on the cron.
@nh13
nh13 force-pushed the nh/miri-gate-unsafe-crates branch from c55489f to 1b1305d Compare August 8, 2026 17:28
@nh13
nh13 temporarily deployed to github-actions August 8, 2026 17:28 — with GitHub Actions Inactive
@nh13

nh13 commented Aug 9, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nh13
nh13 merged commit 47ecef0 into main Aug 9, 2026
18 checks passed
@nh13
nh13 deleted the nh/miri-gate-unsafe-crates branch August 9, 2026 17:25
This was referenced Aug 9, 2026

This branch was previously deployed

1 inactive deployment
github-actions — 1b1305d7 Deployed Aug 8, 2026 by nh13 via coverage #3381
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.

1 participant