ci: add weekly sharded cargo-mutants (22119) + in-diff PR advisory (follows #593) - #609
Conversation
507fc6f to
6a491d7
Compare
|
I hope all addressed above. If you want to change to other frequency just lmk. I think my bot was just worried about the cost so it is set to weekly. |
CodeQL unpinned-tag flagged 5 jobs in ci.yml (fmt, clippy, test, etc) and 1 in codeql.yml. Pin to same SHA already used in ci.yml:161,181 / macos.yml / windows.yml / release.yml (a5f673d0ba8626c3977bb416a1612774bc82181b = toolchain: 1.95.0). Keep toolchain: 1.95.0 explicit, co-bumped with Cargo.toml / rust-toolchain.toml / nixpkgs 26.05 / crane 0.23. This closes last unpinned-tag alerts after #609.
…ment 22119 baseline - default-members=[rbitcoin-node] caused 7-mutant trap, workspace has 22119 at 23a90bf - --in-diff requires diff file: git diff origin/base.. > git.diff then --in-diff git.diff (was passing git ref) - move mutants opts before -- and test opts (--skip core) after -- (was mis-routed) - 8 shards: 22119/8=2765 arithmetic per shard vs 5530 with 4 shards, needs runtime sample - At this baseline rbitcoin-node contributes 0 mutants to --workspace universe, so exclusion does not reduce workload (Bin IS eligible in general) - add Cargo.toml/Cargo.lock to paths, timeouts, artifacts, Sunday comment per reardencode#593 Baseline: 23a90bf cargo-mutants 27.1.0 rustc 1.95.0
6a491d7 to
86f65b3
Compare
Fix mutants workflow — measurements at baseline
|
|
If this 2-lane methodology looks good (PR diff informational + weekly Sunday full scan), I can add follow-up commit in this same PR:
Might be better you update the docs? |
There was a problem hiding this comment.
Thanks for the plumbing write-up — --workspace vs default-members, --in-diff needing a file, and mutants opts before -- are all real. This still is not merge-ready as a workspace-wide “PR gate.”
Please reshape this PR to match how we already run Miri (miri.yml): product rustc 1.95.0, schedule + workflow_dispatch, one crate, not --workspace.
Required changes
-
Scope to
-p rbitcoin-primitiveson both jobs. Drop--workspace. Workspace-wide (~22k mutants, store/io_uring included) is mostly timeout noise and 8×6hubuntu-latestis not a measured plan. Consensus/mempool can be a later PR if primitives actually finishes in budget. Reportcargo mutants --list -p rbitcoin-primitives | wc -lin the PR body; do not add an 8-shard matrix until that count plus a timed sample (--shard 0/Nwall-clock) say you need it. One weekly job is enough if the list is hundreds, not thousands. -
Delete
-- --skip core. That is a libtest name filter, not an FFI crate skip. It drops any test whose name containscore:core_analogs,core_vectors,core_tx_vectors,core_bip341,core_fixture,core_sighash,run_builder_core. Those are the script corpus and analog journeys — the tests you want if you mutate anything near consensus. There is nobitcoinconsensussys crate to skip here. -
Match existing workflow pins (copy from
ci.yml/fuzz.yml/miri.yml). Do not keep checkout v4,dtolnay/rust-toolchain@6c977a6+toolchain: '1.95', unpinnedcargo-mutants, or upload-artifact v4.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: false
# fetch-depth: 0 only on the PR-diff job
- uses: dtolnay/rust-toolchain@a5f673d0ba8626c3977bb416a1612774bc82181b # rustc 1.95.0
# no `with: toolchain:` — this SHA *is* the 1.95.0 snapshot (#620). Adding
# `toolchain: '1.95'` is a different action pin and floats.
- uses: taiki-e/install-action@9534c84618278caac52cb373bb164ed464dbd8af # v2.87.11
with:
tool: cargo-mutants@27.1.0 # pin the version you measured; same pattern as cargo-fuzz@0.13.2
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1Also add, same as miri.yml:
on:
schedule:
- cron: "0 3 * * 0" # weekly Sunday is fine
workflow_dispatch:
# pull_request: only if you keep the advisory in-diff job
concurrency:
group: mutants-${{ github.ref }}
cancel-in-progress: true- Do not call this a gate.
continue-on-error: truemeans it never blocks merge. Either drop the PR job (Miri is schedule-only) or keep it advisory, retitle, and leavecontinue-on-error: true. This PR’smutants-diffsuccess in ~26s is because the diff is only this workflow + toml — not a product-code runtime.
If the PR job stays, narrow paths: to crates/rbitcoin-primitives/** (plus Cargo.toml / lock / this workflow / mutants.toml). The cargo line:
cargo mutants -p rbitcoin-primitives --in-diff git.diff -j 2
Weekly:
cargo mutants -p rbitcoin-primitives -j 2
-
.cargo/mutants.toml: delete the baseline essay. One-fact-one-owner — measurements belong in the PR body, not a config file. If both exclude lists are empty, omit the file. -
Do not add
TESTING.md/docs/quality.md/CHANGELOG.mdin this PR. We will write that row if we take the job. Also rewrite the PR title/body so they match the YAML (Sunday cron, not Monday /origin/main/ 30min / consensus+primitives+mempool shards). -
Rebase onto current
origin/master. Head is still on23a90bfcfrom 17 Sep; that is far behind.git fetch origin && git rebase origin/masterthen force-push your topic branch.
Sketch of the weekly job once scoped (pins as above):
mutants-weekly:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 60 # tighten after you time `cargo mutants -p rbitcoin-primitives`
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: false
- uses: dtolnay/rust-toolchain@a5f673d0ba8626c3977bb416a1612774bc82181b # rustc 1.95.0
- uses: taiki-e/install-action@9534c84618278caac52cb373bb164ed464dbd8af # v2.87.11
with:
tool: cargo-mutants@27.1.0
- run: cargo mutants -p rbitcoin-primitives -j 2
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: mutants-weekly-out
path: mutants.out/
if-no-files-found: ignore--workspace stays a hard no until primitives has a measured green weekly run.
- cargo mutants --list -p rbitcoin-primitives = 292 at baseline - Single weekly job Sunday 0 3 * * 0, 60min, not 8x2765 workspace - Delete -- --skip core (was dropping core_analogs/core_vectors) - Pins match miri.yml reardencode#620: checkout@3d3c42e, toolchain@a5f673d, install@9534c84, upload@043fb46 - Add workflow_dispatch + concurrency group mutants-ref - Delete empty .cargo/mutants.toml - PR diff advisory continue-on-error:true with fetch-depth:0
|
Correction on the review above: keep Still please:
|
6969838 to
d847a6a
Compare
|
Addressed review feedback — now at This is a clean rework of
Previous run Ready for re-review. @reardencode |
|
Title / description update proposal — keeping body as-is, posting delta here for review: From (current #609 title):
To (what it actually is at
Why: From (current body implied):
To (actual at
leaving original PR's description/body untouched so reviewers see the delta here. |
|
oh looks like bot changed mind on what design decisions so I need to restore some stuff give me some time |
Final per 5747845488: keep --workspace, keep 8 shards, drop -- --skip core, crates/** paths, workflow_dispatch + concurrency, pins from miri.yml reardencode#620
|
Updated the codes again to address this [rearden-grok] bot correction comment #609 (comment) Weekly mutants + PR in-diff advisory. Follows #593. Schedule
Jobs
Why --workspace (22119) not -p primitives (292)
Baseline
Fixes per final review
|
|
This branch adds one extra commit on top of the CI job (
Result: Also added If you want #609 to stay infra-only, happy to revert this from this branch and open it as separate |
…owercase per docs convention
…20 16:14 ET, enforce lowercase
|
@reardencode Proposing docs update as comment first for review — not pushing yet since TESTING.md/quality.md are agent-critical so little bit wary not touch it myself: Current code in this PR:
Proposed docs if this 2-lane looks good:
## Mutation testing
Two lanes, same pattern as fuzz.yml (fuzz nightly 20 stays 20):
- PR (advisory): `mutants-pr` if: pull_request, `continue-on-error: true`, `git diff origin/${{base_ref}}.. --unified=0 > git.diff` then `cargo mutants --workspace --in-diff git.diff -j 2` — only mutants touching diff.
- Weekly (source of truth): `mutants-weekly` if: schedule `0 3 * * 0` Sunday 03:00 UTC, `cargo mutants --workspace --shard ${{matrix.shard}}/8 -j 2` — 8 jobs, 22119 mutants / 8 = 2765 arithmetic per shard at baseline 23a90bfc9a36c9dfc7aaa4638475a13512039943 cargo-mutants 27.1.0 rustc 1.95.0.
- Last reaudit: 2026-09-15. Schema 24. Core functional 71 run / 196 skip. Findings 001-023 fixed. Nightly fuzz 20 jobs.
+ Last reaudit: 2026-09-20. Schema 24. Core functional 71 run / 196 skip. Findings 001-023 fixed. Nightly fuzz 20 jobs. Weekly mutants 8 jobs (workspace 22119 mutants, 8 shards).
Let me know if you want me to push that, or you adjust wording and push yourself. |
There was a problem hiding this comment.
Merge-blocking items from the last pass are done: --workspace, no -- --skip core, pins match ci.yml/miri.yml (checkout@3d3c42e, rust-toolchain@a5f673d0 with no toolchain: input, install-action@9534c84 + cargo-mutants@27.1.0, upload-artifact@043fb46), persist-credentials: false, workflow_dispatch, PR-only concurrency so weekly shards do not cancel each other, advisory continue-on-error on the in-diff step (not a gate), no empty mutants.toml, no TESTING/quality/CHANGELOG in this PR. Required checks are green.
Non-blocking follow-ups (do not need to land here):
- Rewrite the PR body so it matches the YAML (Sunday
0 3 * * 0, not Monday /origin/main/ 30min shards). Title is already right. docs/mutants/is a generated missed-mutant dump. Fine as a snapshot; we will own the TESTING.md / quality.md row. Do not treat that directory as a second quality book.- Fold
sigop_count_covers_pushdata_and_truncationinto the existingtruncated_pushdata_does_not_count_leftover_checksigtest and drop the// 21 -=comments (master already pins truncated PUSHDATA). - First Sunday 8×360min run is still a measurement. If shards timeout we can raise timeout or shard further.
Follows up #593 as requested.
Weekly: Sunday
0 3 * * 0, 8 shards,--workspacebaseline 22119 at 23a90bf, cargo-mutants 27.1.0 rustc 1.95.0, 360min per shard,crates/**+ Cargo.toml/lock paths,workflow_dispatch+concurrency: mutants-refso weekly shards don't cancel each other.PR advisory:
in-diffviagit diff origin/base.. > git.diff, opts before--, test opts after--,continue-on-error: trueadvisory not gate,fetch-depth: 0, pins frommiri.yml#620.Closes #591
Follows up #593 as requested.Implements nightly mutants job modeled on fuzz.yml (matrix + artifact pattern) and core-functional.yml (cron + workflow_dispatch + warn-not-fail):- Weekly Monday 03:00 UTC, 8 shards on rbitcoin-consensus/primitives/mempool, uploads mutants.out/- PR fast lane via --in-diff origin/main with baseline=skip (30min)- .cargo/mutants.toml minimal excludesLocal check: cargo mutants --list works, --in-diff --list works.Set full sweep to weekly instead of nightly — happy to switch to nightly if you prefer.~~fuzz.yml/core-functional.yml are nightly because they're ~50min and ~20min.cargo mutants is ~500-1000 cargo test runs—even sharded 8x it's ~60-120min per shard.~~
Upstreamrust-bitcoindoes the same and calls itcron-weekly-cargo-mutants.ymlfor that reason.PR job (--in-diff) still gives fast feedback on every PR, which catches cases like #593.If you want true nightly, I can change cron to17 7 * * *(same as fuzz). Just say the word.Closes #591