diff --git a/.github/workflows/queue-build.yml b/.github/workflows/queue-build.yml index 91a8ecb52..a8656681d 100644 --- a/.github/workflows/queue-build.yml +++ b/.github/workflows/queue-build.yml @@ -28,5 +28,51 @@ jobs: with: persist-credentials: false fetch-depth: 0 + # Only main's merge queue writes the runner's persistent mbx store: a + # maintainer picked each group's PR, so nothing unreviewed writes it. The + # job's own condition already admits only merge_group; this also pins the + # caller and main's queue, as moq's rust-cache action does. + - name: Require main's merge queue + if: ${{ !(github.workflow == 'Queue' && startsWith(github.ref, 'refs/heads/gh-readonly-queue/main/')) }} + run: | + echo "::error::The persistent mbx store requires Queue on main's merge queue." >&2 + exit 1 + # mbx keys every compilation on its compiler, target, and inputs, so the + # runner's store serves every group without a cache key of ours. The host's + # ci-runners.nix supplies the store's environment and job-boundary GC. + # 1.29.2 is the floor: 1.28.0 prints no real paths for files in a build + # script's OUT_DIR (jdx/mr-boxington#896). + - uses: jdx/mr-boxington-action@88acf2bb50552c7c508cbac13e5f8c576b95b1de # v1.7.3 + id: mbx + with: + version: 1.29.2 + backend: local + # The runner keeps managed targets and learned incremental state across + # jobs, and Cargo trusts whatever outputs it finds there. State another mbx + # version left is not trusted, so it goes before the first build on a new + # version; the shared store stays. Each workspace has its own stamp. + - name: Drop another mbx version's private state + env: + VERSION: ${{ steps.mbx.outputs.mbx-version }} + run: | + : "${VERSION:?the mbx action reported no version}" + stamp="$HOME/.cache/rust2-mbx-versions$RUNNER_WORKSPACE" + if [ "$(cat "$stamp" 2>/dev/null)" != "$VERSION" ]; then + mbx clean --under "$RUNNER_WORKSPACE" + mkdir -p "${stamp%/*}" + printf '%s\n' "$VERSION" > "$stamp" + fi + # The shim is how mbx reaches Cargo; the action only puts `mbx` on PATH. + # flake.nix finds the shim through `mbx setup --status` and puts it ahead + # of the dev shell's pinned toolchain. The shim existing is the assertion: + # a setup that quietly did nothing would build cold and still pass. + - name: Cargo shim + run: | + mbx setup --yes + shim=$(mbx setup --status 2>/dev/null | sed -n '1s/.*: //p' || true) + if [ ! -e "$shim" ]; then + echo "::error::mbx setup installed no Cargo shim: $(mbx setup --status 2>&1)" + exit 1 + fi - name: Check and test the merge group run: nix develop --command quest gate just ci "$BASE" diff --git a/quest/m0/checks/README.md b/quest/m0/checks/README.md index 2385edc85..3faac112c 100644 --- a/quest/m0/checks/README.md +++ b/quest/m0/checks/README.md @@ -1,4 +1,4 @@ -# Checks at moq's cost +# [S] Checks at moq's cost ## Goal @@ -15,4 +15,6 @@ stays the rule, and costs less now that it selects by the diff ([#421](https://github.com/moq-dev/rust2/pull/421)); CONTRIBUTING.md and the skills keep their rules. All of it is m0, since every agent pays the cost now. -Each child reports its CPU saved, cold and warm, against `origin/main`. +Its children have landed; what remains is the measurement: once a queue build logs +`mbx[cache]: object cache: ...`, confirming the warm gate, report the gate's and local CPU +against the baseline above, cold and warm, and record any gap as a new quest. diff --git a/quest/m0/checks/cache.md b/quest/m0/checks/cache.md deleted file mode 100644 index 0000182f4..000000000 --- a/quest/m0/checks/cache.md +++ /dev/null @@ -1,29 +0,0 @@ -# [S] A warm gate - -## Goal - -The merge queue's `just ci` builds through mbx, as moq's does, so a run rebuilds only what -changed. - -## Plan - -Decided with the maintainer on 2026-11-01: mbx in a per-repository cache mount, as moq's -gate has. PR code can write to it, a risk moq already accepts; mbx keys each compilation on -its compiler, target, and inputs. Local worktrees share it too, where the dev shell already -can. - -The gate is no longer a `quest land` check: rust2 lands through GitHub's merge queue, whose -build (`.github/workflows/queue-build.yml`) runs on the host's `rust2-queue` runner. That -runner already has a persistent home and mbx's cache environment and job-boundary GC from -the host's `ci-runners.nix`, but nothing installs mbx or its Cargo shim, so the dev shell's -`mbx setup --status` finds no shim and the build is cold: a 2026-11-12 queue build logged -no `mbx` line and 379 `Compiling` lines. Install them in the queue build as moq's -`.github/actions/rust-cache` does on its `moq-queue` runner: `jdx/mr-boxington-action` at -mbx 1.29.2 or later (1.28.0 prints no real paths for files in a build script's `OUT_DIR`, -[jdx/mr-boxington#896](https://github.com/jdx/mr-boxington/issues/896)), then -`mbx setup --yes`, failing the job when no shim results, with its guard that only main's -merge queue writes the persistent store. [#426](https://github.com/moq-dev/rust2/pull/426) -already puts the shim ahead of the pinned toolchain in the dev shell. Done when a queue -build's log shows `mbx[cache]: object cache: ...`. - -Public API: none.