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 df42b90b4..ca12dd8e8 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 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 # out of stack-encrypt), and vitaminc-aead, recipher-frame and @@ -27,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/** @@ -74,13 +78,28 @@ 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) }} - # 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') + # 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') + # + # That condition skips only the release pull request (next into main). + # 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' || (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 59f5e8302..c1653a44c 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 @@ -408,7 +409,14 @@ 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. + # 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 steps: diff --git a/AGENTS.md b/AGENTS.md index 4722cf950..27c378560 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -811,7 +811,9 @@ 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. 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`, @@ -904,7 +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. 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',