From aae9afeaaebde2b39f68dc7cd45c2575a4e8be39 Mon Sep 17 00:00:00 2001 From: Dan Draper Date: Sun, 29 Nov 2026 02:24:56 +1100 Subject: [PATCH 1/3] ci: skip the mutants gate and Go on Windows for pull requests into next The work towards the stable Stack Encrypt Rust release lands in next, through many pull requests. The mutants gate and the Go tests on Windows are the slowest jobs those pull requests run. The mutants gate now skips every pull request. A manual dispatch still tests each crate whole. The Go tests on Windows now run only on a pull request into main, a push, and a manual dispatch. #2017 turns both back on before the release. --- .github/workflows/mutants.yml | 16 +++++++++++----- .github/workflows/tests-golang.yml | 6 +++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mutants.yml b/.github/workflows/mutants.yml index df42b90b4..12393921d 100644 --- a/.github/workflows/mutants.yml +++ b/.github/workflows/mutants.yml @@ -76,11 +76,17 @@ jobs: # job per crate on a manual dispatch, which sweeps each crate whole. # The pull request's check keeps the name "Mutants gate". name: ${{ matrix.crate == 'all' && 'Mutants gate' || format('Mutants sweep ({0})', matrix.crate) }} - # Not on the release PR (next into main). Every line of its diff arrived - # through a PR into next, which this gate already mutated; the release - # diff yields thousands of mutants, hours of runner time, and cannot - # finish inside the timeout, so it would only spend money and fail. - if: github.event_name != 'pull_request' || !(github.head_ref == 'next' && github.base_ref == 'main') + # Off for every pull request for now, to save runner time while the + # milestone's work lands in next. A manual dispatch still sweeps each + # crate whole. #2017 turns the gate back on by restoring this condition: + # + # if: github.event_name != 'pull_request' || !(github.head_ref == 'next' && github.base_ref == 'main') + # + # That condition skips only the release pull request (next into main). + # Every line of the release diff arrived through a pull request into + # next, and this gate already mutated it there. The release diff gives + # thousands of mutants and cannot finish inside the timeout. + if: github.event_name != 'pull_request' runs-on: blacksmith-16vcpu-ubuntu-2204 # A crate's sweep runs four mutants at a time; vitaminc-aead (about a # thousand mutants) and stack-encrypt are the slowest. diff --git a/.github/workflows/tests-golang.yml b/.github/workflows/tests-golang.yml index 59f5e8302..4834713b3 100644 --- a/.github/workflows/tests-golang.yml +++ b/.github/workflows/tests-golang.yml @@ -408,7 +408,11 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, windows-latest] + # Windows is off for a pull request into any branch but main, to save + # runner time while the milestone's work lands in next. A pull + # request into main, a push, and a manual dispatch still run it. #2017 + # restores `os: [macos-latest, windows-latest]` for every event. + os: ${{ fromJSON((github.event_name != 'pull_request' || github.base_ref == 'main') && '["macos-latest","windows-latest"]' || '["macos-latest"]') }} runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: From 1a02a4d5391cea61751492af6da636c4551fb91b Mon Sep 17 00:00:00 2001 From: Dan Draper Date: Sun, 29 Nov 2026 02:28:11 +1100 Subject: [PATCH 2/3] ci: say what must run before the mutants gate's release skip is safe The restored condition skips the release pull request, because every line of it was mutated on its way into next. That is untrue for pull requests that merge while the gate is off. The comment now says to sweep next by hand and fix the survivors before the release pull request. The workflow headers and AGENTS.md now say that the gate and the Windows job are off for these pull requests, and point at #2017. --- .github/workflows/mutants.yml | 14 +++++++++++--- .github/workflows/tests-golang.yml | 3 ++- AGENTS.md | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mutants.yml b/.github/workflows/mutants.yml index 12393921d..f52462162 100644 --- a/.github/workflows/mutants.yml +++ b/.github/workflows/mutants.yml @@ -1,5 +1,8 @@ name: Mutants +# For now this gate is off for every pull request, and runs only on a manual +# dispatch: see the job's `if:` and #2017. +# # Gates pull requests on mutation testing of the lines they change in # stack-auth, stack-encrypt, stack-encrypt-jsonpath (the path grammar, moved # out of stack-encrypt), and vitaminc-aead, recipher-frame and @@ -83,9 +86,14 @@ jobs: # if: github.event_name != 'pull_request' || !(github.head_ref == 'next' && github.base_ref == 'main') # # That condition skips only the release pull request (next into main). - # Every line of the release diff arrived through a pull request into - # next, and this gate already mutated it there. The release diff gives - # thousands of mutants and cannot finish inside the timeout. + # It is safe only when every line of the release diff was mutated on its + # way into next. The release diff gives thousands of mutants and cannot + # finish inside the timeout. + # + # While the gate is off, pull requests merge into next untested. So + # before the release pull request, dispatch this workflow on next to + # sweep each crate whole, and fix every mutant that survives. #2017 + # lists that step. if: github.event_name != 'pull_request' runs-on: blacksmith-16vcpu-ubuntu-2204 # A crate's sweep runs four mutants at a time; vitaminc-aead (about a diff --git a/.github/workflows/tests-golang.yml b/.github/workflows/tests-golang.yml index 4834713b3..f408b087f 100644 --- a/.github/workflows/tests-golang.yml +++ b/.github/workflows/tests-golang.yml @@ -16,7 +16,8 @@ name: Tests (Go) # go-lint golangci-lint, Linux only. # go-binding-cross # the same Go tests on macOS and Windows, against the guests -# Linux built, after checking their sha256. +# Linux built, after checking their sha256. For now, a pull +# request into any branch but main runs macOS only (#2017). # eql-postgres # the Go module's PostgreSQL tests, against PostgreSQL 17 with # the EQL v4 bundle built from this tree installed: rows the Go diff --git a/AGENTS.md b/AGENTS.md index 4722cf950..45d57c28e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -811,7 +811,8 @@ which the plan schedules before the next `stack-encrypt` release. - **CI:** `tests-crates.yml` (fmt, clippy, nextest including the trybuild `tests/ui` binary, doctests, rustdoc, the node bindings and `stack-auth-wasm`), `tests-golang.yml` (WASI checks, the guests, the Go - module on Linux, macOS and Windows, its PostgreSQL tests against the EQL v4 + module on Linux, macOS and Windows (macOS only, for now, on a pull request + into any branch but `main`: #2017), its PostgreSQL tests against the EQL v4 bundle built from the tree — `mise run go:test:postgres` locally, which also runs the Rust and Go EQL/JSON conformance lane and so needs `psql` and the `MISE_ENV=test` cargo tools — and the live tests), `crap-crates.yml`, @@ -904,7 +905,8 @@ The crates that opt in (stack-auth, stack-encrypt, stack-encrypt-jsonpath, vitaminc-aead, recipher-frame, vitaminc-aead-derive) are mutation-tested with cargo-mutants; config in `.cargo/mutants.toml`. CI (`mutants.yml`) gates every PR touching them with `--in-diff`: only the lines the PR changes are mutated, and -a surviving mutant fails the job. A full sweep of every one of them is a +a surviving mutant fails the job. For now the gate is off for every pull +request, and only a manual dispatch runs it; #2017 turns it back on. A full sweep of every one of them is a manual dispatch of `mutants.yml`, one job per crate. stack-auth and stack-encrypt can also be swept locally: From 02415794fcdb02cb319ecf6425a749ae8ee7fb6f Mon Sep 17 00:00:00 2001 From: Dan Draper Date: Sun, 29 Nov 2026 02:39:52 +1100 Subject: [PATCH 3/3] ci: keep the mutants gate on pull requests into main, and name its skipped check The gate was skipped on every pull request, so a fix merged straight into main would never be mutation tested. It now runs on a pull request into main again, except the release pull request. A job its if: skips never expands its matrix, so the skipped check showed the name expression's text. The name now reads the event instead. The notes that the gate and the Windows job are off for now also go in .cargo/mutants.toml and the task exemptions in crates-ci.test.mjs. They say that a pull request moved onto main needs a new push before Windows runs. --- .cargo/mutants.toml | 5 +++-- .github/workflows/mutants.yml | 23 ++++++++++++++--------- .github/workflows/tests-golang.yml | 3 +++ AGENTS.md | 8 +++++--- scripts/__tests__/crates-ci.test.mjs | 2 +- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.cargo/mutants.toml b/.cargo/mutants.toml index d07251da8..f3cf0380a 100644 --- a/.cargo/mutants.toml +++ b/.cargo/mutants.toml @@ -7,8 +7,9 @@ # code is not asserted on — in a crypto crate, the comparisons, length checks # and context bindings a test can execute without ever checking. # -# CI runs this `--in-diff` as a per-PR gate (.github/workflows/mutants.yml): -# only the lines a PR changes are mutated, so the gate trips when a PR adds +# CI runs this `--in-diff` as a per-PR gate (.github/workflows/mutants.yml). +# For now the gate runs only on a pull request into main (#2017). +# Only the lines a PR changes are mutated, so the gate trips when a PR adds # logic its tests do not exercise. A full per-crate sweep is # `mise run mutants:` (stack-auth ~15 min, stack-encrypt ~60 min on a # laptop with four jobs); `mise run mutants` runs every crate that has one. diff --git a/.github/workflows/mutants.yml b/.github/workflows/mutants.yml index f52462162..ca12dd8e8 100644 --- a/.github/workflows/mutants.yml +++ b/.github/workflows/mutants.yml @@ -1,7 +1,7 @@ name: Mutants -# For now this gate is off for every pull request, and runs only on a manual -# dispatch: see the job's `if:` and #2017. +# For now this gate is off for every pull request except one into main, and +# a manual dispatch sweeps each crate: see the job's `if:` and #2017. # # Gates pull requests on mutation testing of the lines they change in # stack-auth, stack-encrypt, stack-encrypt-jsonpath (the path grammar, moved @@ -30,7 +30,8 @@ name: Mutants on: # No branch filter: a stacked PR (a feature branch as base) must run this - # gate too. + # gate too. For now, the job's `if:` skips it on every pull request whose + # base is not main (#2017). pull_request: paths: - packages/stack-auth/** @@ -77,11 +78,15 @@ jobs: mutants: # One job on a pull request, mutating the diff across every crate; one # job per crate on a manual dispatch, which sweeps each crate whole. - # The pull request's check keeps the name "Mutants gate". - name: ${{ matrix.crate == 'all' && 'Mutants gate' || format('Mutants sweep ({0})', matrix.crate) }} - # Off for every pull request for now, to save runner time while the - # milestone's work lands in next. A manual dispatch still sweeps each - # crate whole. #2017 turns the gate back on by restoring this condition: + # The pull request's check keeps the name "Mutants gate". The name reads + # the event, not the matrix: a job the `if:` skips never expands its + # matrix, and its check would show this expression's text as its name. + name: ${{ github.event_name == 'pull_request' && 'Mutants gate' || format('Mutants sweep ({0})', matrix.crate) }} + # For now, off for every pull request except one into main, to save + # runner time while the milestone's work lands in next. The release + # pull request (next into main) stays skipped. A manual dispatch still + # sweeps each crate whole. #2017 turns the gate back on by restoring + # this condition: # # if: github.event_name != 'pull_request' || !(github.head_ref == 'next' && github.base_ref == 'main') # @@ -94,7 +99,7 @@ jobs: # before the release pull request, dispatch this workflow on next to # sweep each crate whole, and fix every mutant that survives. #2017 # lists that step. - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' || (github.base_ref == 'main' && github.head_ref != 'next') runs-on: blacksmith-16vcpu-ubuntu-2204 # A crate's sweep runs four mutants at a time; vitaminc-aead (about a # thousand mutants) and stack-encrypt are the slowest. diff --git a/.github/workflows/tests-golang.yml b/.github/workflows/tests-golang.yml index f408b087f..c1653a44c 100644 --- a/.github/workflows/tests-golang.yml +++ b/.github/workflows/tests-golang.yml @@ -413,6 +413,9 @@ jobs: # runner time while the milestone's work lands in next. A pull # request into main, a push, and a manual dispatch still run it. #2017 # restores `os: [macos-latest, windows-latest]` for every event. + # The list is chosen when the run starts, and a change of base starts + # no run. So a pull request moved onto main needs a new push, or a + # rerun, before Windows runs for it. os: ${{ fromJSON((github.event_name != 'pull_request' || github.base_ref == 'main') && '["macos-latest","windows-latest"]' || '["macos-latest"]') }} runs-on: ${{ matrix.os }} timeout-minutes: 30 diff --git a/AGENTS.md b/AGENTS.md index 45d57c28e..27c378560 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -812,7 +812,8 @@ which the plan schedules before the next `stack-encrypt` release. `tests/ui` binary, doctests, rustdoc, the node bindings and `stack-auth-wasm`), `tests-golang.yml` (WASI checks, the guests, the Go module on Linux, macOS and Windows (macOS only, for now, on a pull request - into any branch but `main`: #2017), its PostgreSQL tests against the EQL v4 + into any branch but `main`: #2017. A pull request moved onto `main` needs a + new push before Windows runs), its PostgreSQL tests against the EQL v4 bundle built from the tree — `mise run go:test:postgres` locally, which also runs the Rust and Go EQL/JSON conformance lane and so needs `psql` and the `MISE_ENV=test` cargo tools — and the live tests), `crap-crates.yml`, @@ -905,8 +906,9 @@ The crates that opt in (stack-auth, stack-encrypt, stack-encrypt-jsonpath, vitaminc-aead, recipher-frame, vitaminc-aead-derive) are mutation-tested with cargo-mutants; config in `.cargo/mutants.toml`. CI (`mutants.yml`) gates every PR touching them with `--in-diff`: only the lines the PR changes are mutated, and -a surviving mutant fails the job. For now the gate is off for every pull -request, and only a manual dispatch runs it; #2017 turns it back on. A full sweep of every one of them is a +a surviving mutant fails the job. For now the gate runs only on a pull +request into main, and not on the release pull request. #2017 turns it +back on for every pull request. A full sweep of every one of them is a manual dispatch of `mutants.yml`, one job per crate. stack-auth and stack-encrypt can also be swept locally: diff --git a/scripts/__tests__/crates-ci.test.mjs b/scripts/__tests__/crates-ci.test.mjs index 6e2704b3e..ca8ca9aac 100644 --- a/scripts/__tests__/crates-ci.test.mjs +++ b/scripts/__tests__/crates-ci.test.mjs @@ -242,7 +242,7 @@ const CI_EXEMPT_TASKS = new Map([ ]), [ 'mutants:stack-auth', - 'The full-crate sweep, for local use (~15 min). CI runs `cargo mutants -p stack-auth -p stack-encrypt --in-diff` in mutants.yml, reading the same .cargo/mutants.toml, and sweeps both crates on workflow_dispatch.', + 'The full-crate sweep, for local use (~15 min). CI runs `cargo mutants -p stack-auth -p stack-encrypt --in-diff` in mutants.yml (for now only on a pull request into main, #2017), reading the same .cargo/mutants.toml, and sweeps both crates on workflow_dispatch.', ], [ 'mutants:stack-encrypt',