From 589a09d2b0864efbeb56fd119b5e4e3d07a807c9 Mon Sep 17 00:00:00 2001 From: Noah Gift Date: Wed, 21 Oct 2026 18:56:08 +0200 Subject: [PATCH 01/12] ci(mg-reuse): merge_group skips workspace-test-shard on an identical-tree green PR run (PMAT-5884) Noah 16:28Z #3: skip the MQ re-test only when the merge-group tree sha equals the tree sha of a green PR run; any difference runs the full shards. - ci_mg_reuse.sh: decide() computes wt (K1-K5 + the head run's workspace-test succeeded); the queue override carries wt only when exactly 1 (fail closed). x86-main/determinism/mac stay un-reused on the queue. - ci.yml: new mg-reuse-wt job (merge_group only); workspace-test-shard skips on wt=1; the workspace-test verdict requires shard==skipped under the key, else success, and skips the Sigma step only under the key. - --self-test: RED->GREEN falsifier rows (changed tree / non-ancestor base / failed or missing head verdict -> wt=0; identical tree -> wt=1). Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++-- docs/roadmaps/entries/PMAT-5884.yaml | 20 ++++++++++ docs/roadmaps/roadmap.yaml | 20 ++++++++++ scripts/ci_mg_reuse.sh | 50 +++++++++++++++++++++++-- 4 files changed, 138 insertions(+), 7 deletions(-) create mode 100644 docs/roadmaps/entries/PMAT-5884.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bf828a5b4..d8910a9d0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,6 +137,41 @@ jobs: printf '%s\n' "$out" printf '%s\n' "$out" | grep -E '^(x86|det|cite|pr_head)=' >> "$GITHUB_OUTPUT" + # T43b (#5884, Noah 16:28Z #3, extends mg-reuse): on merge_group, workspace-test-shard is skipped ONLY when the queue + # entry's tree sha == the tree sha of a green PR run's head (K1-K5: queue head has one parent, the base; the base + # has one parent; the base is an ancestor of the head; M^{tree} == H^{tree}; the head's newest ci.yml pull_request + # run is complete and every job is that run's) AND that run's `workspace-test` verdict succeeded. Any difference + # (changed main, another tree, a lookup that failed) leaves wt=0 and the full shards run. x86-main and determinism + # are NOT read here: they stay un-reused on the queue (20X r2), so x86-main still never waits for this job. + mg-reuse-wt: + if: github.event_name == 'merge_group' + runs-on: [self-hosted, Linux, X64, clean-room] + timeout-minutes: 10 + permissions: + contents: read + actions: read + pull-requests: read + outputs: + wt: ${{ steps.key.outputs.wt }} + wt_cite: ${{ steps.key.outputs.wt_cite }} + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - name: Read the workspace-test reuse key for this queue entry (3 API calls) + id: key + env: + GH_TOKEN: ${{ github.token }} + QREF: ${{ github.event.merge_group.head_ref }} + QHEAD: ${{ github.event.merge_group.head_sha }} + QBASE: ${{ github.event.merge_group.base_sha }} + REPO: ${{ github.repository }} + run: | + set -euo pipefail + out=$(bash scripts/ci_mg_reuse.sh resolve --event merge_group --ref "$QREF" --queue-head "$QHEAD" --base "$QBASE" --repo "$REPO") + printf '%s\n' "$out" + printf '%s\n' "$out" | grep -E '^(wt|wt_cite)=' >> "$GITHUB_OUTPUT" + # The same case table on every event, so a change that breaks the key is RED on # its own PR, not first in the queue. gate requires it. mg-reuse-self-test: @@ -440,6 +475,9 @@ jobs: # explicit runner's round-robin N/12), in parallel on the X64 clean-room pool. # The section body is ci/sections.yml `workspace-test-shard`, unchanged. workspace-test-shard: + # T43b: a merge_group entry whose tree equals a green PR run's skips the shards (mg-reuse-wt); anything else runs them + needs: [mg-reuse-wt] + if: ${{ !cancelled() && needs.mg-reuse-wt.outputs.wt != '1' }} # same lanes as x86-main: clean-room for pull_request/push, mq for a merge_group entry runs-on: ${{ github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","X64","mq"]') || fromJSON('["self-hosted","Linux","X64","clean-room"]') }} timeout-minutes: 180 @@ -491,18 +529,28 @@ jobs: workspace-test: runs-on: [self-hosted, Linux, clean-room] timeout-minutes: 10 - needs: [workspace-test-shard] + needs: [workspace-test-shard, mg-reuse-wt] if: always() steps: - - name: Every shard passed + - name: Every shard passed (or the whole set was reused from an identical-tree green PR run) env: SHARD_RESULT: ${{ needs.workspace-test-shard.result }} + WT_REUSE: ${{ needs.mg-reuse-wt.outputs.wt }} + WT_CITE: ${{ needs.mg-reuse-wt.outputs.wt_cite }} run: | set -euo pipefail - echo "workspace-test-shard matrix result: $SHARD_RESULT" + echo "workspace-test-shard matrix result: $SHARD_RESULT (reuse key wt='${WT_REUSE:-}')" + if [ "${WT_REUSE:-}" = 1 ]; then + # T43b: the shards are skipped ONLY under the key; a shard that ran anyway is a contradiction, never a pass + [ "$SHARD_RESULT" = skipped ] || { echo "::error::workspace-test: reuse key wt=1 but the shard matrix result is '$SHARD_RESULT'"; exit 1; } + [ -n "${WT_CITE:-}" ] || { echo "::error::workspace-test: reuse key wt=1 without a citation"; exit 1; } + echo "workspace-test reused: merge-group tree == tree of a green PR run (${WT_CITE})" + exit 0 + fi [ "$SHARD_RESULT" = success ] || { echo "::error::workspace-test: shard matrix result is '$SHARD_RESULT' (a cancelled or skipped shard is not a pass)"; exit 1; } - uses: actions/checkout@v7 - uses: actions/download-artifact@v4 + if: ${{ needs.mg-reuse-wt.outputs.wt != '1' }} with: pattern: sigma-shard-* path: ${{ runner.temp }}/sigma @@ -511,6 +559,7 @@ jobs: # ids is compared with the universe shard 1 listed. A shard whose ids did # not arrive is RED, never a smaller universe. - name: "Σ-executed: the union of the shards is exactly the owed set (#4433)" + if: ${{ needs.mg-reuse-wt.outputs.wt != '1' }} run: | set -euo pipefail d="$RUNNER_TEMP/sigma" diff --git a/docs/roadmaps/entries/PMAT-5884.yaml b/docs/roadmaps/entries/PMAT-5884.yaml new file mode 100644 index 0000000000..100b0c6db1 --- /dev/null +++ b/docs/roadmaps/entries/PMAT-5884.yaml @@ -0,0 +1,20 @@ +- id: PMAT-5884 + github_issue: 5884 + item_type: task + title: 'mg-reuse: merge_group skips workspace-test-shard when its tree == a green PR run''s tree (Noah 16:28Z #3)' + status: planned + priority: high + assigned_to: null + created: 2026-10-21T17:05:00Z + updated: 2026-10-21T17:05:00Z + spec: null + acceptance_criteria: + - 'merge_group skips workspace-test-shard only when K1-K5 hold and the PR head run workspace-test succeeded; any difference runs the full shards' + - 'ci_mg_reuse.sh --self-test falsifier: changed main/tree -> wt=0, identical tree -> wt=1, override carries wt only when exactly 1' + phases: [] + subtasks: [] + estimated_effort: null + labels: + - kind:code + notes: null + epic: 5510 diff --git a/docs/roadmaps/roadmap.yaml b/docs/roadmaps/roadmap.yaml index ef47935f92..d070423a7b 100644 --- a/docs/roadmaps/roadmap.yaml +++ b/docs/roadmaps/roadmap.yaml @@ -25359,3 +25359,23 @@ Not done, pending the ruling: moving the 31 fixture files to an obviously synthe - kind:code notes: null epic: 5510 +- id: PMAT-5884 + github_issue: 5884 + item_type: task + title: 'mg-reuse: merge_group skips workspace-test-shard when its tree == a green PR run''s tree (Noah 16:28Z #3)' + status: planned + priority: high + assigned_to: null + created: 2026-10-21T17:05:00Z + updated: 2026-10-21T17:05:00Z + spec: null + acceptance_criteria: + - 'merge_group skips workspace-test-shard only when K1-K5 hold and the PR head run workspace-test succeeded; any difference runs the full shards' + - 'ci_mg_reuse.sh --self-test falsifier: changed main/tree -> wt=0, identical tree -> wt=1, override carries wt only when exactly 1' + phases: [] + subtasks: [] + estimated_effort: null + labels: + - kind:code + notes: null + epic: 5510 diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index 86573f5aff..3ce82032b0 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -49,7 +49,7 @@ set -uo pipefail CI_WORKFLOW_PATH=".github/workflows/ci.yml" PRH="" -emit() { printf 'x86=%s\ndet=%s\nmac=%s\ncite=%s\npr_head=%s\nreason=%s\n' "$1" "$2" "$3" "$4" "$5" "$6"; } +emit() { printf 'x86=%s\ndet=%s\nmac=%s\ncite=%s\npr_head=%s\nreason=%s\nwt=%s\nwt_cite=%s\n' "$1" "$2" "$3" "$4" "$5" "$6" "${7:-0}" "${8:-}"; } refuse() { emit 0 0 0 "" "$PRH" "$1"; } usage() { echo "usage: ci_mg_reuse.sh decide|resolve|decide-push|resolve-push [opts] | --self-test [--workflow FILE]" >&2; exit 2; } @@ -112,17 +112,30 @@ decide() { [ "$(concl "$jobs" 'ci / gate')" = success ] || why="${why:+$why; }ci / gate is $(concl "$jobs" 'ci / gate')" # R:k6-cigate x=1 [ -z "$why" ] || x=0 + # T43b (#5884, operator 16:28Z #3): workspace-test is its own unit. K1-K5 held, so the queue entry's tree IS the tree + # the head's run tested; reuse that run's `workspace-test` verdict (it is the Σ-executed fan-in over every shard). + # Not tied to x86-main/determinism: a red x86-main on the head does not make a green workspace-test stale. + wt=0 + [ "$(concl "$jobs" workspace-test)" = success ] && wt=1 # R:k6-wt mc=1 [ "$(concl "$jobs" mac-check)" = success ] || mc=0 # R:k6-mac emit "$x" "$x" "$mc" "run $rid attempt $att on ${h:0:10}" "$h" \ - "K1-K5 hold; x86-main+determinism: $([ "$x" = 1 ] && echo reuse || echo "run ($why)"); mac-check: $([ "$mc" = 1 ] && echo reuse || echo "run ($(concl "$jobs" mac-check))")" + "K1-K5 hold; x86-main+determinism: $([ "$x" = 1 ] && echo reuse || echo "run ($why)"); mac-check: $([ "$mc" = 1 ] && echo reuse || echo "run ($(concl "$jobs" mac-check))"); workspace-test: $([ "$wt" = 1 ] && echo reuse || echo "run ($(concl "$jobs" workspace-test))")" \ + "$wt" "$([ "$wt" = 1 ] && echo "run $rid attempt $att on ${h:0:10}")" } # The queue-entry override, FORCED: drop whatever decide said for these keys (or omitted) and write # the values explicitly, so a decide that leaves a key out cannot fail open (r6). force_no_reuse() { - { grep -v -E '^(x86|det|mac|cite|pr_head)=' || true; } - printf 'x86=0\ndet=0\nmac=0\ncite=\npr_head=\n' + local in wt=0 wc="" + in=$(cat) + # T43b (#5884): workspace-test reuse crosses the override ONLY as exactly wt=1 with its citation; anything else is 0. + if [ "$(printf '%s\n' "$in" | sed -n 's/^wt=//p' | tail -n 1)" = 1 ]; then + wt=1 + wc=$(printf '%s\n' "$in" | sed -n 's/^wt_cite=//p' | tail -n 1) + fi + { printf '%s\n' "$in" | grep -v -E '^(x86|det|mac|cite|pr_head|wt|wt_cite)=' || true; } + printf 'x86=0\ndet=0\nmac=0\ncite=\npr_head=\nwt=%s\nwt_cite=%s\n' "$wt" "$wc" } resolve() { @@ -382,6 +395,35 @@ self_test() { dr k6-x86-main-twice "0 0 1" merge_group "$M" "$B" "$H" runs.ok jobs.dup-x86 dr k6-mac-failed "1 1 0" merge_group "$M" "$B" "$H" runs.ok jobs.fail-mac-check + # T43b (#5884, Noah 16:28Z #3): workspace-test reuse. RED->GREEN falsifier: a changed main must run, an identical tree may skip. + sed '/^workspace-test /d' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.no-wt" + sed 's|^workspace-test success$|workspace-test failure|' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.fail-wt" + wrow() { # wrow NAME WANT decide-args... + local n="$1" want="$2" out; shift 2 + out=$(decide "$@" --repo-root "$R") + if [ "$(kv wt "$out")" = "$want" ]; then pass=$((pass + 1)); else + fail=$((fail + 1)); echo "FAIL wt-$n: want wt=$want got '$(kv wt "$out")' -- $(kv reason "$out")"; fi + } + wd() { local n="$1" want="$2" m="$3" b="$4" h="$5" r="$6" j="$7" + wrow "$n" "$want" --event merge_group --queue-head "$m" --base "$b" --pr-head "$h" --runs "$F/$r" --jobs "$F/$j"; } + wd identical-tree-skips 1 "$M" "$B" "$H" runs.ok jobs.ok + wd changed-tree-runs 0 "$M_TREE" "$B" "$H" runs.ok jobs.ok + wd changed-main-not-ancestor 0 "$M_K3" "$B2" "$H" runs.ok jobs.ok + wd base-is-a-merge-runs 0 "$M_K2" "$BM" "$H2" runs.h2 jobs.h2 + wd head-wt-failed-runs 0 "$M" "$B" "$H" runs.ok jobs.fail-wt + wd head-wt-missing-runs 0 "$M" "$B" "$H" runs.ok jobs.no-wt + wd run-in-progress-runs 0 "$M" "$B" "$H" runs.newer-running jobs.ok + wd head-x86-failed-still-skips 1 "$M" "$B" "$H" runs.ok jobs.fail-determinism + wrow push-never-skips 0 --event push --queue-head "$M" --base "$B" --pr-head "$H" --runs "$F/runs.ok" --jobs "$F/jobs.ok" + # the override passes wt only as exactly 1, with its citation + local wo + wo=$(force_no_reuse <<< $'wt=1\nwt_cite=run 7\nx86=1') + [ "$(kv wt "$wo")|$(kv wt_cite "$wo")|$(kv x86 "$wo")" = "1|run 7|0" ] && pass=$((pass + 1)) || { fail=$((fail + 1)); echo "FAIL wt-override-pass: $wo"; } + for wo in $'wt=2' $'wt=' $'wt=0\nwt_cite=run 7' $'reason=x'; do + wo=$(force_no_reuse <<< "$wo") + [ "$(kv wt "$wo")|$(kv wt_cite "$wo")" = "0|" ] && pass=$((pass + 1)) || { fail=$((fail + 1)); echo "FAIL wt-override-closed: $wo"; } + done + # resolve, end to end, through a stub gh serving canned JSON. A failed lookup never reuses. local SB="$T/bin"; mkdir -p "$SB" cat > "$SB/gh" <<'STUB' From 5247a32c293c21dbedc1e99e7a493ad8b4dae9d5 Mon Sep 17 00:00:00 2001 From: Noah Gift Date: Wed, 21 Oct 2026 22:31:38 +0200 Subject: [PATCH 02/12] fix(mg-reuse): wt=1 needs >=1 workspace-test-shard job, all success; a draft run's green verdict ran no tests (PMAT-5884) Opus lane-b on fe1d367ed8: a draft PR run reports workspace-test green with the shard matrix skipped (ci.yml draft guard), so reuse of it skipped the queue's tests with none ever run. shards() counts the `workspace-test-shard (N)` jobs; wt=1 requires count>=1 and zero non-success. Self-test rows: draft run (no shards), green verdict with zero shards, one failed shard -> wt=0. Co-Authored-By: Claude Sonnet 5.5 --- scripts/ci_mg_reuse.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index 45381faba1..54a018b1de 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -67,6 +67,13 @@ concl() { | if length == 1 then (.[0].conclusion // "none") else "count=\(length)" end' "$1" 2> /dev/null } +# The matrix jobs `workspace-test-shard (N)` in jobs file $1: prints " ". A draft PR run (or a +# reused one) has green `workspace-test` and NO such jobs; that green says no test ran, so it is never reusable (#5885 lane-b). +shards() { + jq -r '[.jobs[]? | select(.name | test("^workspace-test-shard \\([0-9]+\\)$"))] + | "\(length) \([.[] | select(.conclusion != "success")] | length)"' "$1" 2> /dev/null || echo "0 1" +} + decide() { local ev="" m="" b="" h="" runs="" jobs="" root="." while [ $# -gt 0 ]; do @@ -116,7 +123,9 @@ decide() { # the head's run tested; reuse that run's `workspace-test` verdict (it is the Σ-executed fan-in over every shard). # Not tied to x86-main/determinism: a red x86-main on the head does not make a green workspace-test stale. wt=0 - [ "$(concl "$jobs" workspace-test)" = success ] && wt=1 # R:k6-wt + # wt=1 needs the verdict green AND >=1 shard job, all success: a draft run is green with zero shards (#5885 lane-b). + read -r nsh nbad <<< "$(shards "$jobs")" + [ "$(concl "$jobs" workspace-test)" = success ] && [ "${nsh:-0}" -ge 1 ] 2> /dev/null && [ "${nbad:-1}" = 0 ] && wt=1 # R:k6-wt mc=1 [ "$(concl "$jobs" mac-check)" = success ] || mc=0 # R:k6-mac emit "$x" "$x" "$mc" "run $rid attempt $att on ${h:0:10}" "$h" \ @@ -397,6 +406,10 @@ self_test() { # T43b (#5884, Noah 16:28Z #3): workspace-test reuse. RED->GREEN falsifier: a changed main must run, an identical tree may skip. sed '/^workspace-test /d' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.no-wt" + { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard (1)\tsuccess\nworkspace-test-shard (2)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-ok" + sed "s|^determinism\tsuccess\$|determinism\tfailure|" <<< "$GREEN_JOBS" | { cat; printf 'workspace-test-shard (1)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-x86fail" + { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard (1)\tsuccess\nworkspace-test-shard (2)\tfailure\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-shard-failed" + { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard\tskipped\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-draft" sed 's|^workspace-test success$|workspace-test failure|' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.fail-wt" wrow() { # wrow NAME WANT decide-args... local n="$1" want="$2" out; shift 2 @@ -406,14 +419,17 @@ self_test() { } wd() { local n="$1" want="$2" m="$3" b="$4" h="$5" r="$6" j="$7" wrow "$n" "$want" --event merge_group --queue-head "$m" --base "$b" --pr-head "$h" --runs "$F/$r" --jobs "$F/$j"; } - wd identical-tree-skips 1 "$M" "$B" "$H" runs.ok jobs.ok + wd identical-tree-skips 1 "$M" "$B" "$H" runs.ok jobs.wt-ok + wd draft-run-no-shards-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-draft + wd greenverdict-zero-shards 0 "$M" "$B" "$H" runs.ok jobs.ok + wd one-shard-failed-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-shard-failed wd changed-tree-runs 0 "$M_TREE" "$B" "$H" runs.ok jobs.ok wd changed-main-not-ancestor 0 "$M_K3" "$B2" "$H" runs.ok jobs.ok wd base-is-a-merge-runs 0 "$M_K2" "$BM" "$H2" runs.h2 jobs.h2 wd head-wt-failed-runs 0 "$M" "$B" "$H" runs.ok jobs.fail-wt wd head-wt-missing-runs 0 "$M" "$B" "$H" runs.ok jobs.no-wt wd run-in-progress-runs 0 "$M" "$B" "$H" runs.newer-running jobs.ok - wd head-x86-failed-still-skips 1 "$M" "$B" "$H" runs.ok jobs.fail-determinism + wd head-x86-failed-still-skips 1 "$M" "$B" "$H" runs.ok jobs.wt-x86fail wrow push-never-skips 0 --event push --queue-head "$M" --base "$B" --pr-head "$H" --runs "$F/runs.ok" --jobs "$F/jobs.ok" # the override passes wt only as exactly 1, with its citation local wo From 1b7f02cded01b4d84341bd20e7855255e0db182a Mon Sep 17 00:00:00 2001 From: Noah Gift Date: Wed, 21 Oct 2026 22:34:09 +0200 Subject: [PATCH 03/12] fix(mg-reuse): shard job names are 'workspace-test-shard (N, M)'; the (N) regex never matched, so wt was never 1 (PMAT-5884) Fixtures now use real names from MG run 39666213701. The old regex fails 2 rows (120/2). Co-Authored-By: Claude Sonnet 5.5 --- scripts/ci_mg_reuse.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index 54a018b1de..14b3ed290e 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -67,10 +67,10 @@ concl() { | if length == 1 then (.[0].conclusion // "none") else "count=\(length)" end' "$1" 2> /dev/null } -# The matrix jobs `workspace-test-shard (N)` in jobs file $1: prints " ". A draft PR run (or a +# The matrix jobs `workspace-test-shard (N, M)` in jobs file $1: prints " ". A draft PR run (or a # reused one) has green `workspace-test` and NO such jobs; that green says no test ran, so it is never reusable (#5885 lane-b). shards() { - jq -r '[.jobs[]? | select(.name | test("^workspace-test-shard \\([0-9]+\\)$"))] + jq -r '[.jobs[]? | select(.name | test("^workspace-test-shard \\([0-9]+, [0-9]+\\)$"))] | "\(length) \([.[] | select(.conclusion != "success")] | length)"' "$1" 2> /dev/null || echo "0 1" } @@ -293,7 +293,7 @@ resolve_push() { # The jobs of run 37040341824, #4655's only PR-head run (db86acf021), verbatim # from the API (two GPU-host leg job names replaced; the key never reads them): # x86-main failed while gate and ci / gate passed. -PLANTED_4655_JOBS=$'gpu-touched\tsuccess\nmutants-table-scope\tsuccess\ndeterminism\tsuccess\nworkspace-test-shard (1)\tsuccess\nmac-check\tsuccess\nworkspace-test-shard (3)\tsuccess\nworkspace-test-shard (2)\tsuccess\nx86-main\tfailure\nmutants-table\tskipped\nmutants-shard\tskipped\ngpu-host-leg-a\tsuccess\ngpu-host-leg-b\tsuccess\nworkspace-test\tsuccess\nci / gate\tsuccess\ngate\tsuccess' +PLANTED_4655_JOBS=$'gpu-touched\tsuccess\nmutants-table-scope\tsuccess\ndeterminism\tsuccess\nworkspace-test-shard (1, 4)\tsuccess\nmac-check\tsuccess\nworkspace-test-shard (3, 4)\tsuccess\nworkspace-test-shard (2, 4)\tsuccess\nx86-main\tfailure\nmutants-table\tskipped\nmutants-shard\tskipped\ngpu-host-leg-a\tsuccess\ngpu-host-leg-b\tsuccess\nworkspace-test\tsuccess\nci / gate\tsuccess\ngate\tsuccess' GREEN_JOBS=$'x86-main\tsuccess\ndeterminism\tsuccess\nmac-check\tsuccess\nworkspace-test\tsuccess\nci / gate\tsuccess\ngate\tsuccess' # jobs_json HEAD RUN_ID EXTRA_TOTAL < "nameconclusion" lines @@ -406,9 +406,9 @@ self_test() { # T43b (#5884, Noah 16:28Z #3): workspace-test reuse. RED->GREEN falsifier: a changed main must run, an identical tree may skip. sed '/^workspace-test /d' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.no-wt" - { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard (1)\tsuccess\nworkspace-test-shard (2)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-ok" - sed "s|^determinism\tsuccess\$|determinism\tfailure|" <<< "$GREEN_JOBS" | { cat; printf 'workspace-test-shard (1)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-x86fail" - { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard (1)\tsuccess\nworkspace-test-shard (2)\tfailure\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-shard-failed" + { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard (1, 4)\tsuccess\nworkspace-test-shard (2, 4)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-ok" + sed "s|^determinism\tsuccess\$|determinism\tfailure|" <<< "$GREEN_JOBS" | { cat; printf 'workspace-test-shard (1, 4)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-x86fail" + { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard (1, 4)\tsuccess\nworkspace-test-shard (2, 4)\tfailure\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-shard-failed" { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard\tskipped\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-draft" sed 's|^workspace-test success$|workspace-test failure|' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.fail-wt" wrow() { # wrow NAME WANT decide-args... From 197ee71bbb04e92bfcb40ed929640a0703d17f22 Mon Sep 17 00:00:00 2001 From: Noah Gift Date: Wed, 21 Oct 2026 22:44:45 +0200 Subject: [PATCH 04/12] fix(mg-reuse): wt=1 needs every shard of the matrix present (nsh==M) and a non-empty citation (PMAT-5884) Real-name fixtures; one RED mutant row each (partial-shards 124/1, empty-attempt cite 124/1). Self-test 125/0. Co-Authored-By: Claude Sonnet 5.5 --- scripts/ci_mg_reuse.sh | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index 14b3ed290e..fef1db2644 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -67,11 +67,12 @@ concl() { | if length == 1 then (.[0].conclusion // "none") else "count=\(length)" end' "$1" 2> /dev/null } -# The matrix jobs `workspace-test-shard (N, M)` in jobs file $1: prints " ". A draft PR run (or a -# reused one) has green `workspace-test` and NO such jobs; that green says no test ran, so it is never reusable (#5885 lane-b). +# The matrix jobs `workspace-test-shard (N, M)` in jobs file $1: prints " ", M = the shard total every +# name agrees on (0 if they disagree). A draft PR run (or a reused one) has green `workspace-test` and NO such jobs (#5885 lane-b). shards() { - jq -r '[.jobs[]? | select(.name | test("^workspace-test-shard \\([0-9]+, [0-9]+\\)$"))] - | "\(length) \([.[] | select(.conclusion != "success")] | length)"' "$1" 2> /dev/null || echo "0 1" + jq -r '[.jobs[]? | select(.name | test("^workspace-test-shard \\([0-9]+, [0-9]+\\)$"))] as $s + | ([$s[].name | capture(", (?[0-9]+)\\)$").m | tonumber] | unique) as $m + | "\($s | map(.name) | unique | length) \([$s[] | select(.conclusion != "success")] | length) \(if ($m | length) == 1 then $m[0] else 0 end)"' "$1" 2> /dev/null || echo "0 1 0" } decide() { @@ -124,13 +125,17 @@ decide() { # Not tied to x86-main/determinism: a red x86-main on the head does not make a green workspace-test stale. wt=0 # wt=1 needs the verdict green AND >=1 shard job, all success: a draft run is green with zero shards (#5885 lane-b). - read -r nsh nbad <<< "$(shards "$jobs")" - [ "$(concl "$jobs" workspace-test)" = success ] && [ "${nsh:-0}" -ge 1 ] 2> /dev/null && [ "${nbad:-1}" = 0 ] && wt=1 # R:k6-wt + read -r nsh nbad msh <<< "$(shards "$jobs")" + wcite="run $rid attempt $att on ${h:0:10}" + # ...and EVERY shard of the matrix is present: (N, M) names must agree on M and number M (a partial list is not a run). + [ "$(concl "$jobs" workspace-test)" = success ] && [ "${msh:-0}" -ge 1 ] 2> /dev/null && [ "${nsh:-0}" = "${msh:-0}" ] && [ "${nbad:-1}" = 0 ] && wt=1 # R:k6-wt-all-shards + # a reuse with nothing to cite is not a reuse + [[ "$wcite" =~ ^run\ [0-9]+\ attempt\ [0-9]+\ on\ [0-9a-f]{10}$ ]] || wt=0 # R:k6-wt-cite mc=1 [ "$(concl "$jobs" mac-check)" = success ] || mc=0 # R:k6-mac emit "$x" "$x" "$mc" "run $rid attempt $att on ${h:0:10}" "$h" \ "K1-K5 hold; x86-main+determinism: $([ "$x" = 1 ] && echo reuse || echo "run ($why)"); mac-check: $([ "$mc" = 1 ] && echo reuse || echo "run ($(concl "$jobs" mac-check))"); workspace-test: $([ "$wt" = 1 ] && echo reuse || echo "run ($(concl "$jobs" workspace-test))")" \ - "$wt" "$([ "$wt" = 1 ] && echo "run $rid attempt $att on ${h:0:10}")" + "$wt" "$([ "$wt" = 1 ] && echo "$wcite")" } # The queue-entry override, FORCED: drop whatever decide said for these keys (or omitted) and write @@ -406,9 +411,14 @@ self_test() { # T43b (#5884, Noah 16:28Z #3): workspace-test reuse. RED->GREEN falsifier: a changed main must run, an identical tree may skip. sed '/^workspace-test /d' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.no-wt" - { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard (1, 4)\tsuccess\nworkspace-test-shard (2, 4)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-ok" - sed "s|^determinism\tsuccess\$|determinism\tfailure|" <<< "$GREEN_JOBS" | { cat; printf 'workspace-test-shard (1, 4)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-x86fail" - { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard (1, 4)\tsuccess\nworkspace-test-shard (2, 4)\tfailure\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-shard-failed" + # shard job names are the real matrix names, "workspace-test-shard (N, M)" (MG run 39666213701); sh4 N... = those N of 4, success + sh4() { local n; for n in "$@"; do printf 'workspace-test-shard (%s, 4)\tsuccess\n' "$n"; done; } + { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-ok" + sed "s|^determinism\tsuccess\$|determinism\tfailure|" <<< "$GREEN_JOBS" | { cat; sh4 1 2 3 4; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-x86fail" + { cat <<< "$GREEN_JOBS"; sh4 1 3 4; printf 'workspace-test-shard (2, 4)\tfailure\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-shard-failed" + { cat <<< "$GREEN_JOBS"; sh4 1 2 3; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-partial" + { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; printf 'workspace-test-shard (5, 12)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-mixed-m" + run_obj 1001 "$H" completed | jq '.run_attempt = ""' | runs_json 0 > "$F/runs.no-attempt" { cat <<< "$GREEN_JOBS"; printf 'workspace-test-shard\tskipped\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-draft" sed 's|^workspace-test success$|workspace-test failure|' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.fail-wt" wrow() { # wrow NAME WANT decide-args... @@ -423,6 +433,9 @@ self_test() { wd draft-run-no-shards-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-draft wd greenverdict-zero-shards 0 "$M" "$B" "$H" runs.ok jobs.ok wd one-shard-failed-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-shard-failed + wd partial-shards-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-partial + wd mixed-shard-totals-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-mixed-m + wd empty-attempt-no-cite-runs 0 "$M" "$B" "$H" runs.no-attempt jobs.wt-ok wd changed-tree-runs 0 "$M_TREE" "$B" "$H" runs.ok jobs.ok wd changed-main-not-ancestor 0 "$M_K3" "$B2" "$H" runs.ok jobs.ok wd base-is-a-merge-runs 0 "$M_K2" "$BM" "$H2" runs.h2 jobs.h2 From 5ce1079ffaebbab735a2fe2718d2c45f0c5e95d2 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 22 Oct 2026 03:09:20 +0200 Subject: [PATCH 05/12] Revert "ci: drop X64 from arch-neutral runs-on, pin the FULL tier's shards to X64 ... (#5891)" REVERT RULE (operator, 2026-10-18): merged/h below 0.46 for 2 consecutive hours after the change went live. 0 merges from 23:29:35Z (#5891 merged) to 01:30Z. Plain revert of the squash b410374203. Restores ci/sections.yml and removes scripts/ci/decide_tier.sh and scripts/ci/sigma_arch_uniform.sh. #5906 (ci_test_tier row 67 retargeted to decide_tier.sh) must be DROPPED if this lands: row 67 asserts the old ci/sections.yml text again. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 36 +------- ci/sections.yml | 62 ++++++++++++- .../src/kernel_registry_parity.rs | 22 +---- evidence/kreg/parity/cpu.matvec.apr_q4.json | 9 -- evidence/kreg/parity/cpu.matvec.apr_q8.json | 9 -- evidence/kreg/parity/cpu.matvec.bf16.json | 9 -- evidence/kreg/parity/cpu.matvec.f16.json | 9 -- evidence/kreg/parity/cpu.matvec.f32.json | 9 -- evidence/kreg/parity/cpu.matvec.q4_0.json | 9 -- evidence/kreg/parity/cpu.matvec.q4_k.json | 9 -- evidence/kreg/parity/cpu.matvec.q5_k.json | 9 -- evidence/kreg/parity/cpu.matvec.q6_k.json | 9 -- evidence/kreg/parity/cpu.matvec.q8_0.json | 9 -- scripts/check_ci_push_reuse.sh | 7 +- scripts/ci/decide_tier.sh | 66 -------------- scripts/ci/sigma_arch_uniform.sh | 91 ------------------- scripts/ci_mg_reuse.sh | 13 +-- 17 files changed, 72 insertions(+), 315 deletions(-) delete mode 100755 scripts/ci/decide_tier.sh delete mode 100755 scripts/ci/sigma_arch_uniform.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d3fa6f001..905ae731c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,7 +102,7 @@ jobs: # its own. It runs on push only; on merge_group it is skipped at t=0, which the verdict blocks # below read as `skipped:::skipped` = "x86-main + determinism ran". if: github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: [self-hosted, Linux, clean-room] + runs-on: [self-hosted, Linux, X64, clean-room] timeout-minutes: 10 permissions: contents: read @@ -316,7 +316,7 @@ jobs: x86-main-advisories: needs: [mg-reuse] if: ${{ !cancelled() && needs.mg-reuse.outputs.x86 == '1' }} - runs-on: [self-hosted, Linux, clean-room] + runs-on: [self-hosted, Linux, X64, clean-room] timeout-minutes: 30 permissions: contents: read @@ -439,35 +439,12 @@ jobs: # failure, never a pass. # ========================================================================== # The workspace tests, one shard per job (nextest hash partition N/12 plus the - # explicit runner's round-robin N/12), in parallel on the clean-room pool (arch-neutral, PMAT-3138). + # explicit runner's round-robin N/12), in parallel on the X64 clean-room pool. # The section body is ci/sections.yml `workspace-test-shard`, unchanged. - # #5882: which tier this run owes decides WHERE the shards may run. The full tier's Σ-executed fan-in - # compares every shard with ONE universe list, and arch-gated tests (target_arch cfgs) differ per - # arch, so a full tier needs one architecture: X64. The quick/PR tier owes no Σ and stays - # arch-neutral. The tier is only knowable from the diff, so it is decided HERE, by the same script - # the shards run (scripts/ci/decide_tier.sh), and workspace-test-shard reads it in its runs-on. - # scripts/ci/sigma_arch_uniform.sh in the fan-in is the backstop: a mixed full tier is RED. - workspace-test-arch: - runs-on: [self-hosted, Linux, clean-room] - timeout-minutes: 15 - outputs: - tier: ${{ steps.tier.outputs.tier }} - steps: - - uses: actions/checkout@v7 - with: - fetch-depth: 0 - - name: Decide the test tier (the shards' own step, one script) - id: tier - env: - GH_TOKEN: ${{ github.token }} - MG_BASE_SHA: ${{ github.event.merge_group.base_sha }} - run: bash scripts/ci/decide_tier.sh workspace-test-shard: - needs: [workspace-test-arch] if: ${{ github.event.pull_request.draft != true }} - # arch-neutral (operator 2026-10-21 14:18Z) EXCEPT the full tier, which needs one arch for the Σ (#5882, workspace-test-arch) - # clean-room for pull_request/push, mq for a merge_group entry - runs-on: ${{ needs.workspace-test-arch.outputs.tier == 'full' && (github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","X64","mq"]') || fromJSON('["self-hosted","Linux","X64","clean-room"]')) || (github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","mq"]') || fromJSON('["self-hosted","Linux","clean-room"]')) }} + # same lanes as x86-main: clean-room for pull_request/push, mq for a merge_group entry + runs-on: ${{ github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","X64","mq"]') || fromJSON('["self-hosted","Linux","X64","clean-room"]') }} timeout-minutes: 180 strategy: fail-fast: false @@ -546,7 +523,6 @@ jobs: set -euo pipefail d="$RUNNER_TEMP/sigma" python3 scripts/ci/sigma_executed.py --self-test - bash scripts/ci/sigma_arch_uniform.sh --self-test # ONE shard count: the pins in ci/sections.yml (check_shard_count_single_source.sh) SHARDS="$(awk -v ev="$GITHUB_EVENT_NAME" '/^matrix-pins:/{p=1;next} p&&/^ workspace-test-shard:/{k="pr";next} p&&/^ workspace-test-shard-merge_group:/{k="mg";next} p&&/^ [a-z]/{k=""} k&&/^ - \{shard:/{c[k]++} END{print (ev=="merge_group"&&c["mg"]?c["mg"]:c["pr"])+0}' ci/sections.yml)" [ "${SHARDS:-0}" -ge 1 ] 2>/dev/null || { echo "::error::Σ: no workspace-test-shard pins"; exit 1; } @@ -563,8 +539,6 @@ jobs: [ "$#" -eq "$SHARDS" ] || { echo "::error::Σ: $# tier files for $SHARDS shards:$tiers"; exit 1; } for t in "$@"; do [ "$t" = "$1" ] || { echo "::error::Σ: the shards disagree on the tier:$tiers"; exit 1; }; done [ "$1" = full ] || { echo "every shard ran tier '$1': the lib/explicit Σ is not owed"; exit 0; } - # #5882: a full tier on two architectures is RED (arch-gated tests, one universe): placement is workspace-test-arch's, this is the backstop - bash scripts/ci/sigma_arch_uniform.sh "$d" "$SHARDS" j=() l=() for n in $(seq 1 "$SHARDS"); do j+=(--junit "$d/sigma-shard-$n/lib.junit.xml") diff --git a/ci/sections.yml b/ci/sections.yml index 4632770e37..4cc17744ef 100644 --- a/ci/sections.yml +++ b/ci/sections.yml @@ -378,7 +378,66 @@ jobs: GH_TOKEN: ${{ github.token }} MG_BASE_SHA: ${{ github.event.merge_group.base_sha }} run: | - bash scripts/ci/decide_tier.sh + set -euo pipefail + args=(--event "${GITHUB_EVENT_NAME}") + # PMAT-1098 67-E2: the queue and a push to main re-derive their own + # diff from HEAD's FIRST PARENT (HEAD^1..HEAD is the PR's diff on the + # new base). actions/checkout is shallow, so that parent is not in the + # object store until we deepen -- and without it ci_test_tier.sh falls + # closed to `full` every single time, which would make the whole + # optimisation inert while looking like it worked. Best effort by + # design: if the deepen fails the decision still falls closed, and the + # warning below says so instead of the run silently paying the hour. + case "${GITHUB_EVENT_NAME}" in + merge_group) + # Operator 2026-10-17: the queue runs the quick tier over the entry's diff (base_sha = prior entry's head), + # MG_BASE_SHA..HEAD. Fetch the base; if that fails the tier falls closed to full. + bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "${GITHUB_SHA}" "${MG_BASE_SHA}" 2>/dev/null \ + || bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "${MG_BASE_SHA}" 2>/dev/null \ + || true + git cat-file -e "${MG_BASE_SHA}^{commit}" 2>/dev/null \ + || printf '::warning::merge_group base sha unavailable -- the tier falls closed to full\n' + ;; + push) + bash scripts/ci/fetch_p6.sh --no-tags --depth=2 origin "${GITHUB_SHA}" 2>/dev/null \ + || bash scripts/ci/fetch_p6.sh --no-tags --deepen=1 origin 2>/dev/null \ + || true + if git rev-parse -q --verify 'HEAD^1' >/dev/null 2>&1; then + printf 'first parent available: %s\n' "$(git rev-parse HEAD^1)" + else + printf '::warning::first parent unavailable after deepen -- the tier falls closed to full\n' + fi + ;; + esac + case "${GITHUB_EVENT_NAME}" in + pull_request) + bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "+refs/heads/${GITHUB_BASE_REF}:refs/remotes/origin/${GITHUB_BASE_REF}" + # #5391: the PR's change is the diff from merge-base(base, HEAD), not the + # base tip -- main's later commits are not the PR's. --no-renames (#3664) + # lives in the helper. + bash scripts/ci/pr_touched_paths.sh "origin/${GITHUB_BASE_REF}" HEAD > "$RUNNER_TEMP/touched.txt" + args+=(--diff-from "$RUNNER_TEMP/touched.txt") + ;; + merge_group) + # Operator 2026-10-17 (cop window), verbatim: "only gating on tags/release". + # ci_test_tier.sh diffs MG_BASE_SHA..HEAD (env above) and selects like a PR. + ;; + push) + # T36: the merge queue already tested this very sha. Hand its + # workspace-test result to the tier script, which reuses it only + # on a success for HEAD itself. A failed lookup is the push's own + # tier, as before -- never a reuse, never a red step. + mg=$(bash scripts/ci_mg_workspace_result.sh "${GITHUB_REPOSITORY}" "${GITHUB_SHA}") || mg="" + if [ -n "$mg" ]; then + mapfile -t mgargs <<<"$mg" + args+=("${mgargs[@]}") + else + printf 'no merge_group workspace-test result for %s: the tier is decided from the push diff\n' "${GITHUB_SHA}" + fi + ;; + esac + bash scripts/ci_test_tier.sh "${args[@]}" | tee "$RUNNER_TEMP/tier.txt" + grep -E '^(tier|crates|targets|check_workspace|reason|cite)=' "$RUNNER_TEMP/tier.txt" >> "$GITHUB_OUTPUT" # #4502 row 2: lint_passes_on_real_contracts (aprender-contracts) requires the # refinement gate to RUN whenever CI is set, and that gate compares HEAD with # merge-base(HEAD, origin/main), else the origin/main tip. This section clones at @@ -715,7 +774,6 @@ jobs: sig="$RUNNER_TEMP/sigma" mkdir -p sigma-shard printf '%s\n' "$TIER" > sigma-shard/tier - uname -m > sigma-shard/arch if [ "$TIER" = full ]; then cp "$sig/lib.junit.xml" sigma-shard/lib.junit.xml cp "${FAT_SECTION_LOG:?the fat driver sets FAT_SECTION_LOG}" sigma-shard/section.log diff --git a/crates/aprender-serve/src/kernel_registry_parity.rs b/crates/aprender-serve/src/kernel_registry_parity.rs index bdb6e3a798..0f47c86e85 100644 --- a/crates/aprender-serve/src/kernel_registry_parity.rs +++ b/crates/aprender-serve/src/kernel_registry_parity.rs @@ -743,7 +743,6 @@ fn committed() -> Vec<(serde_json::Value, serde_json::Value)> { #[test] fn committed_parity_receipts_hold_on_this_host() { let r = registry().expect("registry"); - let mut no_arch_receipt = Vec::new(); for (entry, rc) in committed() { let id = rc["kernel_id"].as_str().expect("kernel_id"); let path = entry["receipt"].as_str().expect("receipt path"); @@ -790,22 +789,8 @@ fn committed_parity_receipts_hold_on_this_host() { seed: wl["seed"].as_u64().expect("seed"), trials: dim("trials"), }; + let bound = rc["tolerance_rel"].as_f64().expect("tolerance_rel"); let now = measure(kernel(id), w, false); - // A receipt's `tolerance_rel` is the bound measured on its own `host_arch`; libm and FMA - // contraction move the last ulps between architectures. Any other arch must carry its own - // measured bound under `per_arch..tolerance_rel` -- never a borrowed one, never a skip. - let bound = if rc["host_arch"] == host_arch() { - rc["tolerance_rel"].as_f64().expect("tolerance_rel") - } else if let Some(b) = rc["per_arch"][host_arch()]["tolerance_rel"].as_f64() { - b - } else { - no_arch_receipt.push(format!( - "{path}: no {} receipt (host measured max_rel_err {})", - host_arch(), - now.max_rel_err - )); - continue; - }; assert_eq!( rc["margin"]["verdict"], "pass", "{path}: KTEST-02 margin verdict (max ≤ 1 under EM-DOT)" @@ -857,11 +842,6 @@ fn committed_parity_receipts_hold_on_this_host() { p => panic!("{id}: no precision check for {p}"), } } - assert!( - no_arch_receipt.is_empty(), - "committed receipts lack a bound for this arch:\n{}", - no_arch_receipt.join("\n") - ); } /// `KREG_INPUT_SETS_OUT`: the input-set hashes recomputed from the tree at `KREG_GIT_SHA`, one diff --git a/evidence/kreg/parity/cpu.matvec.apr_q4.json b/evidence/kreg/parity/cpu.matvec.apr_q4.json index da9c1fc945..e7929dfd71 100644 --- a/evidence/kreg/parity/cpu.matvec.apr_q4.json +++ b/evidence/kreg/parity/cpu.matvec.apr_q4.json @@ -35,15 +35,6 @@ }, "oracle": "apr_format_decode_f64", "oracle_independent": true, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 5.568608963671898e-07, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 2e-6, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": null, "registry_precision": "f32", "schema": "kernel-parity-receipt/v1", diff --git a/evidence/kreg/parity/cpu.matvec.apr_q8.json b/evidence/kreg/parity/cpu.matvec.apr_q8.json index 9f6f4ac2cf..e95fb4c5c9 100644 --- a/evidence/kreg/parity/cpu.matvec.apr_q8.json +++ b/evidence/kreg/parity/cpu.matvec.apr_q8.json @@ -35,15 +35,6 @@ }, "oracle": "apr_format_decode_f64", "oracle_independent": true, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 5.982009671170112e-07, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 2e-6, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": null, "registry_precision": "f32", "schema": "kernel-parity-receipt/v1", diff --git a/evidence/kreg/parity/cpu.matvec.bf16.json b/evidence/kreg/parity/cpu.matvec.bf16.json index 57309f51c6..e6aa4240c0 100644 --- a/evidence/kreg/parity/cpu.matvec.bf16.json +++ b/evidence/kreg/parity/cpu.matvec.bf16.json @@ -33,15 +33,6 @@ }, "oracle": "le_decode_half_f64", "oracle_independent": true, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 4.068146011742945e-07, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 9e-7, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": null, "registry_precision": "f32", "schema": "kernel-parity-receipt/v1", diff --git a/evidence/kreg/parity/cpu.matvec.f16.json b/evidence/kreg/parity/cpu.matvec.f16.json index af25b8ed9d..17b3754d5a 100644 --- a/evidence/kreg/parity/cpu.matvec.f16.json +++ b/evidence/kreg/parity/cpu.matvec.f16.json @@ -33,15 +33,6 @@ }, "oracle": "le_decode_half_f64", "oracle_independent": true, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 3.920968817889049e-07, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 8e-7, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": null, "registry_precision": "f32", "schema": "kernel-parity-receipt/v1", diff --git a/evidence/kreg/parity/cpu.matvec.f32.json b/evidence/kreg/parity/cpu.matvec.f32.json index a41e599001..9926666b94 100644 --- a/evidence/kreg/parity/cpu.matvec.f32.json +++ b/evidence/kreg/parity/cpu.matvec.f32.json @@ -33,15 +33,6 @@ }, "oracle": "le_decode_half_f64", "oracle_independent": true, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 7.356022484897627e-07, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 2e-6, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": null, "registry_precision": "f32", "schema": "kernel-parity-receipt/v1", diff --git a/evidence/kreg/parity/cpu.matvec.q4_0.json b/evidence/kreg/parity/cpu.matvec.q4_0.json index d1a94f3c46..38ab583a76 100644 --- a/evidence/kreg/parity/cpu.matvec.q4_0.json +++ b/evidence/kreg/parity/cpu.matvec.q4_0.json @@ -35,15 +35,6 @@ }, "oracle": "in_tree_dequant_f64", "oracle_independent": false, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 0.003859434297246209, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 0.008, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": { "max_rel_err": 1.69613194525447e-7 }, diff --git a/evidence/kreg/parity/cpu.matvec.q4_k.json b/evidence/kreg/parity/cpu.matvec.q4_k.json index 0e1ccc3ba7..501b8c768a 100644 --- a/evidence/kreg/parity/cpu.matvec.q4_k.json +++ b/evidence/kreg/parity/cpu.matvec.q4_k.json @@ -36,15 +36,6 @@ }, "oracle": "in_tree_dequant_f64", "oracle_independent": false, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 0.005569836531516333, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 0.02, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": { "max_rel_err": 1.3720446505396093e-7 }, diff --git a/evidence/kreg/parity/cpu.matvec.q5_k.json b/evidence/kreg/parity/cpu.matvec.q5_k.json index d65c8a5ca9..01913cf231 100644 --- a/evidence/kreg/parity/cpu.matvec.q5_k.json +++ b/evidence/kreg/parity/cpu.matvec.q5_k.json @@ -36,15 +36,6 @@ }, "oracle": "in_tree_dequant_f64", "oracle_independent": false, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 1.3110594897372703e-06, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 3e-6, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": null, "registry_precision": "f32", "schema": "kernel-parity-receipt/v1", diff --git a/evidence/kreg/parity/cpu.matvec.q6_k.json b/evidence/kreg/parity/cpu.matvec.q6_k.json index ce60279cc6..220f53b4a7 100644 --- a/evidence/kreg/parity/cpu.matvec.q6_k.json +++ b/evidence/kreg/parity/cpu.matvec.q6_k.json @@ -36,15 +36,6 @@ }, "oracle": "in_tree_dequant_f64", "oracle_independent": false, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 1.6505971099429934e-6, - "source": "CI job 119280981403 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 4e-6, - "ts": "2026-10-21T14:37:43Z" - } - }, "quantized_activation_oracle": null, "registry_precision": "f32", "schema": "kernel-parity-receipt/v1", diff --git a/evidence/kreg/parity/cpu.matvec.q8_0.json b/evidence/kreg/parity/cpu.matvec.q8_0.json index 0f6306509e..b69febb636 100644 --- a/evidence/kreg/parity/cpu.matvec.q8_0.json +++ b/evidence/kreg/parity/cpu.matvec.q8_0.json @@ -36,15 +36,6 @@ }, "oracle": "in_tree_dequant_f64", "oracle_independent": false, - "per_arch": { - "aarch64": { - "host": "gx10-pool1", - "max_rel_err": 0.003738839019401381, - "source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload", - "tolerance_rel": 0.008, - "ts": "2026-10-21T14:51:19Z" - } - }, "quantized_activation_oracle": { "max_rel_err": 2.0240994602880252e-7 }, diff --git a/scripts/check_ci_push_reuse.sh b/scripts/check_ci_push_reuse.sh index a62bb9021d..0532c5d4e3 100755 --- a/scripts/check_ci_push_reuse.sh +++ b/scripts/check_ci_push_reuse.sh @@ -285,13 +285,10 @@ hasnt "D11 pull_request ignores --mg-*: never reuse" "tier=reuse" "$OUT" # -- W: the CI wiring ------------------------------------------------------------------------------ SEC="$ROOT/ci/sections.yml" -DT="$ROOT/scripts/ci/decide_tier.sh" # the tier step body lives in one script (#5882): the section step and workspace-test-arch both run it -want "W0 the section step runs the shared decide_tier.sh" 1 \ - "$(grep -cF "bash scripts/ci/decide_tier.sh" "$SEC")" want "W1 the tier step's push arm calls the lookup for GITHUB_SHA" 1 \ - "$(grep -cF 'bash scripts/ci_mg_workspace_result.sh "${GITHUB_REPOSITORY}" "${GITHUB_SHA}"' "$DT")" + "$(grep -cF 'bash scripts/ci_mg_workspace_result.sh "${GITHUB_REPOSITORY}" "${GITHUB_SHA}"' "$SEC")" want "W2 a failed lookup is not fatal to the step (it falls to today's tier)" 1 \ - "$(grep -cF '"${GITHUB_SHA}") || mg=""' "$DT")" + "$(grep -cF '"${GITHUB_SHA}") || mg=""' "$SEC")" W3PAT="push) printf 'cited merge_group run: %s" if grep -qF "$W3PAT" "$SEC"; then w3=1; else w3=0; fi want "W3 the reuse step labels a push citation as a merge_group run, not a PR head" 1 "$w3" diff --git a/scripts/ci/decide_tier.sh b/scripts/ci/decide_tier.sh deleted file mode 100755 index 5cfa8a6d5d..0000000000 --- a/scripts/ci/decide_tier.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash -# decide_tier.sh -- which test tier this run owes (BSE-17, PMAT-1077); the one body of the -# "Decide the test tier" step, shared by the workspace-test-shard section and by the -# workspace-test-arch job that places the shards (a full tier needs ONE architecture: the -# cross-shard Σ compares every shard with one universe list). Env: GITHUB_EVENT_NAME, -# GITHUB_SHA, GITHUB_REPOSITORY, GITHUB_BASE_REF, MG_BASE_SHA, GH_TOKEN, RUNNER_TEMP, GITHUB_OUTPUT. -set -euo pipefail -args=(--event "${GITHUB_EVENT_NAME}") -# PMAT-1098 67-E2: the queue and a push to main re-derive their own -# diff from HEAD's FIRST PARENT (HEAD^1..HEAD is the PR's diff on the -# new base). actions/checkout is shallow, so that parent is not in the -# object store until we deepen -- and without it ci_test_tier.sh falls -# closed to `full` every single time, which would make the whole -# optimisation inert while looking like it worked. Best effort by -# design: if the deepen fails the decision still falls closed, and the -# warning below says so instead of the run silently paying the hour. -case "${GITHUB_EVENT_NAME}" in - merge_group) - # Operator 2026-10-17: the queue runs the quick tier over the entry's diff (base_sha = prior entry's head), - # MG_BASE_SHA..HEAD. Fetch the base; if that fails the tier falls closed to full. - bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "${GITHUB_SHA}" "${MG_BASE_SHA}" 2>/dev/null \ - || bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "${MG_BASE_SHA}" 2>/dev/null \ - || true - git cat-file -e "${MG_BASE_SHA}^{commit}" 2>/dev/null \ - || printf '::warning::merge_group base sha unavailable -- the tier falls closed to full\n' - ;; - push) - bash scripts/ci/fetch_p6.sh --no-tags --depth=2 origin "${GITHUB_SHA}" 2>/dev/null \ - || bash scripts/ci/fetch_p6.sh --no-tags --deepen=1 origin 2>/dev/null \ - || true - if git rev-parse -q --verify 'HEAD^1' >/dev/null 2>&1; then - printf 'first parent available: %s\n' "$(git rev-parse HEAD^1)" - else - printf '::warning::first parent unavailable after deepen -- the tier falls closed to full\n' - fi - ;; -esac -case "${GITHUB_EVENT_NAME}" in - pull_request) - bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "+refs/heads/${GITHUB_BASE_REF}:refs/remotes/origin/${GITHUB_BASE_REF}" - # #5391: the PR's change is the diff from merge-base(base, HEAD), not the - # base tip -- main's later commits are not the PR's. --no-renames (#3664) - # lives in the helper. - bash scripts/ci/pr_touched_paths.sh "origin/${GITHUB_BASE_REF}" HEAD > "$RUNNER_TEMP/touched.txt" - args+=(--diff-from "$RUNNER_TEMP/touched.txt") - ;; - merge_group) - # Operator 2026-10-17 (cop window), verbatim: "only gating on tags/release". - # ci_test_tier.sh diffs MG_BASE_SHA..HEAD (env above) and selects like a PR. - ;; - push) - # T36: the merge queue already tested this very sha. Hand its - # workspace-test result to the tier script, which reuses it only - # on a success for HEAD itself. A failed lookup is the push's own - # tier, as before -- never a reuse, never a red step. - mg=$(bash scripts/ci_mg_workspace_result.sh "${GITHUB_REPOSITORY}" "${GITHUB_SHA}") || mg="" - if [ -n "$mg" ]; then - mapfile -t mgargs <<<"$mg" - args+=("${mgargs[@]}") - else - printf 'no merge_group workspace-test result for %s: the tier is decided from the push diff\n' "${GITHUB_SHA}" - fi - ;; -esac -bash scripts/ci_test_tier.sh "${args[@]}" | tee "$RUNNER_TEMP/tier.txt" -grep -E '^(tier|crates|targets|check_workspace|reason|cite)=' "$RUNNER_TEMP/tier.txt" >> "$GITHUB_OUTPUT" diff --git a/scripts/ci/sigma_arch_uniform.sh b/scripts/ci/sigma_arch_uniform.sh deleted file mode 100755 index 29b0b7bf26..0000000000 --- a/scripts/ci/sigma_arch_uniform.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash -# sigma_arch_uniform.sh -- the FULL-tier Σ needs every shard on ONE architecture (#5882). -# -# The fan-in compares the union of every shard's executed ids with ONE universe, the list shard 1 -# made on ITS machine. Tests gated on target_arch (crates/aprender-zram-core/src/zstd/avx2.rs has 18 -# x86_64-only ones, 141 files carry a cfg) exist in one arch's list and not the other's, so a mixed -# x86 + aarch64 shard set is red or green by PLACEMENT, and a test owed on x86 whose hash slice drew -# an aarch64 shard runs nowhere. A per-arch compare cannot fix that: each arch's shards run only -# their own slices, so each arch would be owed tests it was never given. The sound rule is -# placement: ci.yml job workspace-test-arch decides the tier first and pins the full tier's shards to -# X64. This script is the backstop that keeps the rule true after the fact: at tier full, every shard -# must have staged x86_64; a missing, blank or other arch, or a blank tier, is RED. Any other agreed -# tier owes no Σ: not checked. -# -# sigma_arch_uniform.sh DIR SHARDS DIR/sigma-shard-N/{tier,arch}, N = 1..SHARDS -# sigma_arch_uniform.sh --self-test the case table (incl. the mixed placement that went red) -set -euo pipefail - -check() { # check DIR SHARDS - local d=$1 n=$2 i t tier arch first="" tiers="" arches="" - for i in $(seq 1 "$n"); do - [ -f "$d/sigma-shard-$i/tier" ] || { echo "::error::Σ arch: shard $i staged no tier file"; return 1; } - tier=$(tr -d '[:space:]' < "$d/sigma-shard-$i/tier") - [ -n "$tier" ] || { echo "::error::Σ arch: shard $i staged a blank tier (fail closed, never read as 'not full')"; return 1; } - tiers="$tiers $tier" - done - for t in $tiers; do [ "$t" = full ] || { echo "Σ arch: tier '$t' in this run, the lib/explicit Σ is not owed, arch not checked"; return 0; }; done - # Agreement alone is not enough: 12 aarch64 shards agree and avx2.rs's x86-only tests run nowhere. - # The full tier is pinned to X64, so every shard must say x86_64. - for i in $(seq 1 "$n"); do - [ -f "$d/sigma-shard-$i/arch" ] || { echo "::error::Σ arch: shard $i staged no arch at the full tier (a missing arch is RED, never uniform)"; return 1; } - arch=$(tr -d '[:space:]' < "$d/sigma-shard-$i/arch") - [ -n "$arch" ] || { echo "::error::Σ arch: shard $i staged a blank arch at the full tier (fail closed)"; return 1; } - arches="$arches $i=$arch" - if [ "$arch" != x86_64 ]; then - echo "::error::Σ arch: full tier shard $i ran on $arch, not x86_64:$arches" - echo "::error::Σ arch: x86_64-gated tests are owed and would run nowhere; workspace-test-arch must pin the full tier to X64" - return 1 - fi - done - echo "Σ arch: every shard of the full tier ran on x86_64" -} - -self_test() { - local td rows=0 bad=0 want got - td=$(mktemp -d) - mk() { # mk TIER ARCH... -> one shard dir per arch argument ("-" = no arch file) - local t=$1 i=0 a; shift; rm -rf "${td:?}/s"; mkdir -p "$td/s" - for a in "$@"; do - i=$((i + 1)); mkdir -p "$td/s/sigma-shard-$i"; printf '%s\n' "$t" > "$td/s/sigma-shard-$i/tier" - [ "$a" = - ] || printf '%s\n' "$a" > "$td/s/sigma-shard-$i/arch" - done - } - row() { # row WANT LABEL TIER ARCH... - want=$1; local label=$2; shift 2; mk "$@" - set +e; check "$td/s" "$(($# - 1))" > /dev/null 2>&1; got=$?; set -e - rows=$((rows + 1)); [ "$got" = "$want" ] || bad=$((bad + 1)) - printf '%s want_rc=%s got_rc=%s %s\n' "$([ "$got" = "$want" ] && echo 'ok ' || echo 'BAD')" "$want" "$got" "$label" - } - row 0 "full, 12 shards all x86_64" full x86_64 x86_64 x86_64 x86_64 x86_64 x86_64 x86_64 x86_64 x86_64 x86_64 x86_64 x86_64 - row 1 "full, 12 shards all aarch64: they agree, but x86-only tests run nowhere" full aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 - row 1 "full, one shard staged a BLANK arch" full x86_64 "" x86_64 - row 1 "full, every shard staged a blank arch" full "" "" - row 1 "full, one shard staged a whitespace-only arch" full x86_64 " " x86_64 - row 1 "a blank tier refuses (never read as 'not full')" "" x86_64 x86_64 - row 1 "full, MIXED: shard 3 x86_64, the rest aarch64 (run 39620701544's placement)" full aarch64 aarch64 x86_64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 aarch64 - row 1 "full, MIXED: shard 1 x86_64, the rest aarch64" full x86_64 aarch64 aarch64 aarch64 - row 1 "full, one shard staged no arch" full x86_64 - x86_64 - row 0 "quick, MIXED: no Σ owed, not checked (the PR tier stays arch-neutral)" quick aarch64 x86_64 aarch64 - mk full x86_64; rm -f "${td:?}/s/sigma-shard-1/tier" - set +e; check "$td/s" 1 > /dev/null 2>&1; got=$?; set -e - rows=$((rows + 1)); [ "$got" = 1 ] || bad=$((bad + 1)) - printf '%s want_rc=1 got_rc=%s a missing tier file refuses\n' "$([ "$got" = 1 ] && echo 'ok ' || echo 'BAD')" "$got" - # Why a per-arch compare is not the fix, on the real comparator: shard 1's list is aarch64 (no - # avx2 test), the x86 shard executed one -> "executed but not in the universe". - local j="$td/j.xml" l="$td/l.json" - printf '' > "$j" - printf '{"rust-suites":{"z":{"testcases":{"a::neon":{"filter-match":{"status":"matches"}}}}}}' > "$l" - set +e; python3 "$(dirname "$0")/sigma_executed.py" nextest --junit "$j" --list-json "$l" > /dev/null 2>&1; got=$?; set -e - rows=$((rows + 1)); [ "$got" = 1 ] || bad=$((bad + 1)) - printf '%s want_rc=1 got_rc=%s sigma_executed over a mixed-arch pair (x86 test, aarch64 universe) is RED\n' "$([ "$got" = 1 ] && echo 'ok ' || echo 'BAD')" "$got" - rm -rf "${td:?}" - echo "Σ arch self-test: $((rows - bad))/$rows rows as expected" - [ "$bad" = 0 ] -} - -case "${1:-}" in - --self-test) self_test ;; - "" | -h | --help) sed -n 2,16p "$0" ;; - *) check "$1" "${2:?SHARDS}" ;; -esac diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index 5f133ce19e..03aa3c1e37 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -528,13 +528,11 @@ STUB # Each row is compared as the EXACT line (trailing comment stripped), so a third state cannot slip in. poolrows() { # poolrows WF -> one line per violated pool row local j l want - local plain="runs-on: [self-hosted, Linux, clean-room]" # arch-neutral job: cargo-deny, no X64 pin + local plain="runs-on: [self-hosted, Linux, X64, clean-room]" local lane="runs-on: \${{ github.event_name == 'merge_group' && fromJSON('[\"self-hosted\",\"Linux\",\"X64\",\"mq\"]') || fromJSON('[\"self-hosted\",\"Linux\",\"X64\",\"clean-room\"]') }}" - # #5882: the full tier is pinned X64 (one universe for the Σ), every other tier stays arch-neutral - local nlane="runs-on: \${{ needs.workspace-test-arch.outputs.tier == 'full' && (github.event_name == 'merge_group' && fromJSON('[\"self-hosted\",\"Linux\",\"X64\",\"mq\"]') || fromJSON('[\"self-hosted\",\"Linux\",\"X64\",\"clean-room\"]')) || (github.event_name == 'merge_group' && fromJSON('[\"self-hosted\",\"Linux\",\"mq\"]') || fromJSON('[\"self-hosted\",\"Linux\",\"clean-room\"]')) }}" - for j in x86-main x86-main-advisories workspace-test-arch workspace-test-shard; do + for j in x86-main x86-main-advisories workspace-test-shard; do l=$(awk -v j=" $j:" '$0 == j {f = 1; next} f && /^ [A-Za-z0-9_-]+:$/ {exit} f' "$1" 2> /dev/null | grep -m1 '^ runs-on:' | sed -E 's/^ +//; s/ +#.*$//') - want=$plain; case $j in x86-main) want=$lane ;; workspace-test-shard) want=$nlane ;; esac + want=$plain; case $j in x86-main | workspace-test-shard) want=$lane ;; esac if [ "$l" != "$want" ]; then echo "$j does not land on the clean-room pool (mq on merge_group for x86-main/workspace-test-shard) (runs-on: $l)"; fi done @@ -554,11 +552,8 @@ STUB poolmut pool-advisories-event-conditional "does not land on the clean-room pool" '/^ x86-main-advisories:$/,/^ steps:/{s/^ runs-on: .*/ runs-on: ${{ github.event_name == '"'"'merge_group'"'"' \&\& fromJSON('"'"'["clean-room"]'"'"') || fromJSON('"'"'["clean-room"]'"'"') }}/}' poolmut mq-lane-lost-on-x86-main "does not land on the clean-room pool" '/^ x86-main:$/,/^ steps:/{s/"mq"/"clean-room"/}' poolmut mq-lane-dropped-on-shard "does not land on the clean-room pool" '/^ workspace-test-shard:$/,/^ steps:/{s/^ runs-on: .*/ runs-on: [self-hosted, Linux, X64, clean-room]/}' - poolmut pr-path-takes-mq "does not land on the clean-room pool" '/^ workspace-test-shard:$/,/^ steps:/{s/\|\| fromJSON\(.\["self-hosted","Linux","clean-room"\].\)/|| fromJSON('"'"'["self-hosted","Linux","mq"]'"'"')/}' + poolmut pr-path-takes-mq "does not land on the clean-room pool" '/^ workspace-test-shard:$/,/^ steps:/{s/\|\| fromJSON\(.\["self-hosted","Linux","X64","clean-room"\].\)/|| fromJSON('"'"'["self-hosted","Linux","X64","mq"]'"'"')/}' poolmut mq-lane-third-label "does not land on the clean-room pool" '/^ x86-main:$/,/^ steps:/{s/"X64","mq"/"X64","mq","pr-only"/}' - poolmut full-tier-loses-x64-pin "does not land on the clean-room pool" '/^ workspace-test-shard:$/,/^ steps:/{s/"Linux","X64",/"Linux",/g}' - poolmut every-tier-pinned-x64 "does not land on the clean-room pool" '/^ workspace-test-shard:$/,/^ steps:/{s/^ runs-on: .*/ runs-on: ${{ github.event_name == '"'"'merge_group'"'"' \&\& fromJSON('"'"'["self-hosted","Linux","X64","mq"]'"'"') || fromJSON('"'"'["self-hosted","Linux","X64","clean-room"]'"'"') }}/}' - poolmut tier-job-off-the-pool "does not land on the clean-room pool" '/^ workspace-test-arch:$/,/^ steps:/{s/clean-room/build/}' # S1 (20X): mg-reuse runs on push only, so on merge_group it is SKIPPED and every dependent # runs only because its own `if:` carries !cancelled()/always() (a skipped need otherwise skips From f84b26ed603e0a2039ee46874bee4e54b4e0ef28 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 22 Oct 2026 03:17:25 +0200 Subject: [PATCH 06/12] ci(shard): !cancelled() must not hide a failed workspace-test-arch (Refs #5885) Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df1e99a3e3..0c9b3463cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -500,7 +500,7 @@ jobs: workspace-test-shard: # T43b: a merge_group entry whose tree equals a green PR run's skips the shards (mg-reuse-wt); anything else runs them needs: [workspace-test-arch, mg-reuse-wt] - if: ${{ !cancelled() && needs.mg-reuse-wt.outputs.wt != '1' && github.event.pull_request.draft != true }} + if: ${{ !cancelled() && needs.workspace-test-arch.result == 'success' && needs.mg-reuse-wt.outputs.wt != '1' && github.event.pull_request.draft != true }} # arch-neutral (operator 2026-10-21 14:18Z) EXCEPT the full tier, which needs one arch for the Σ (#5882, workspace-test-arch) # clean-room for pull_request/push, mq for a merge_group entry runs-on: ${{ needs.workspace-test-arch.outputs.tier == 'full' && (github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","X64","mq"]') || fromJSON('["self-hosted","Linux","X64","clean-room"]')) || (github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","mq"]') || fromJSON('["self-hosted","Linux","clean-room"]')) }} From aa6fd1f7e63542989e102320535867ed0420706a Mon Sep 17 00:00:00 2001 From: t Date: Thu, 22 Oct 2026 03:29:08 +0200 Subject: [PATCH 07/12] ci(mg-reuse): refuse wt=1 unless the cited PR run really ran tests (receipt-reuse runs are green over zero tests) Adds workspace-test-ran marker (skipped when tier=reuse), refusal R:k6-wt-ran, receipt 12/12-green row expecting wt=0, missing-marker row. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 10 ++++++++++ scripts/ci_mg_reuse.sh | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c9b3463cc..26ebfb3cd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -497,6 +497,16 @@ jobs: GH_TOKEN: ${{ github.token }} MG_BASE_SHA: ${{ github.event.merge_group.base_sha }} run: bash scripts/ci/decide_tier.sh + # mg-reuse-wt may cite a PR run only if that run really tested the tree. A receipt-reuse run (#5850, tier=reuse) + # runs no test step, so its shards are green over zero tests: this marker is skipped there, and ci_mg_reuse.sh + # refuses wt=1 unless it succeeded (R:k6-wt-ran). + workspace-test-ran: + needs: [workspace-test-arch] + if: ${{ github.event_name == 'pull_request' && needs.workspace-test-arch.result == 'success' && needs.workspace-test-arch.outputs.tier != 'reuse' && github.event.pull_request.draft != true }} + runs-on: [self-hosted, Linux, clean-room] + timeout-minutes: 5 + steps: + - run: echo "this run owes and runs the test suite (tier=${{ needs.workspace-test-arch.outputs.tier }})" workspace-test-shard: # T43b: a merge_group entry whose tree equals a green PR run's skips the shards (mg-reuse-wt); anything else runs them needs: [workspace-test-arch, mg-reuse-wt] diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index 57b15a66d4..be40036306 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -129,6 +129,9 @@ decide() { wcite="run $rid attempt $att on ${h:0:10}" # ...and EVERY shard of the matrix is present: (N, M) names must agree on M and number M (a partial list is not a run). [ "$(concl "$jobs" workspace-test)" = success ] && [ "${msh:-0}" -ge 1 ] 2> /dev/null && [ "${nsh:-0}" = "${msh:-0}" ] && [ "${nbad:-1}" = 0 ] && wt=1 # R:k6-wt-all-shards + # ...and the run owed and ran a test suite: a receipt-reuse PR run (#5850 tier=reuse) skips the test step, so its 12/12 shards are green over ZERO tests; + # `workspace-test-ran` runs only when the tier is not reuse, so only a run that tested the tree may be cited. + [ "$(concl "$jobs" workspace-test-ran)" = success ] || wt=0 # R:k6-wt-ran # a reuse with nothing to cite is not a reuse [[ "$wcite" =~ ^run\ [0-9]+\ attempt\ [0-9]+\ on\ [0-9a-f]{10}$ ]] || wt=0 # R:k6-wt-cite mc=1 @@ -413,8 +416,11 @@ self_test() { sed '/^workspace-test /d' <<< "$GREEN_JOBS" | jobs_json "$H" 1001 0 > "$F/jobs.no-wt" # shard job names are the real matrix names, "workspace-test-shard (N, M)" (MG run 39666213701); sh4 N... = those N of 4, success sh4() { local n; for n in "$@"; do printf 'workspace-test-shard (%s, 4)\tsuccess\n' "$n"; done; } - { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-ok" - sed "s|^determinism\tsuccess\$|determinism\tfailure|" <<< "$GREEN_JOBS" | { cat; sh4 1 2 3 4; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-x86fail" + ran() { printf 'workspace-test-ran\t%s\n' "$1"; } + { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; ran success; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-ok" + { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; ran skipped; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-receipt" + { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-noran" + sed "s|^determinism\tsuccess\$|determinism\tfailure|" <<< "$GREEN_JOBS" | { cat; sh4 1 2 3 4; ran success; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-x86fail" { cat <<< "$GREEN_JOBS"; sh4 1 3 4; printf 'workspace-test-shard (2, 4)\tfailure\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-shard-failed" { cat <<< "$GREEN_JOBS"; sh4 1 2 3; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-partial" { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; printf 'workspace-test-shard (5, 12)\tsuccess\n'; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-mixed-m" @@ -431,6 +437,8 @@ self_test() { wrow "$n" "$want" --event merge_group --queue-head "$m" --base "$b" --pr-head "$h" --runs "$F/$r" --jobs "$F/$j"; } wd identical-tree-skips 1 "$M" "$B" "$H" runs.ok jobs.wt-ok wd draft-run-no-shards-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-draft + wd receipt-reuse-12of12-green-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-receipt + wd ran-job-missing-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-noran wd greenverdict-zero-shards 0 "$M" "$B" "$H" runs.ok jobs.ok wd one-shard-failed-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-shard-failed wd partial-shards-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-partial From e8bc5fe5531b16723f5e73e70c6010d99845375c Mon Sep 17 00:00:00 2001 From: t Date: Thu, 22 Oct 2026 03:32:11 +0200 Subject: [PATCH 08/12] ci(mg-reuse): once receipt-judge exists the test-ran marker must need it and key on its verdict mgshape rule + 2 mutants (marker ignores judge; needs it but if ignores it). Red on the merge of #5850 until the marker is wired to receipt-judge.outputs.ok. Co-Authored-By: Claude Sonnet 5.5 --- scripts/ci_mg_reuse.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index be40036306..e97cfc811f 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -648,12 +648,15 @@ STUB awk -v tok='(^|[^A-Za-z0-9_-])mg-reuse($|[^A-Za-z0-9_-])' -v want="if: github.event_name == 'push' && github.ref == 'refs/heads/main'" ' /^ [A-Za-z0-9_-]+:$/ { j = $1; sub(/:$/, "", j); seen[j] = 1; next } /^ if:/ { jif[j] = $0; sub(/^ /, "", jif[j]) } + /^ needs:/ || (inn && /^ /) { jneeds[j] = jneeds[j] $0 } /^ needs:/ { inn = 1; if ($0 ~ tok) dep[j] = 1; next } inn && /^ / { if ($0 ~ tok) dep[j] = 1; next } /^ [A-Za-z]/ { inn = 0 } END { if (jif["mg-reuse"] != want) print "mg-reuse job-level if is not the push-only key: [" jif["mg-reuse"] "]" if (jif["mg-reuse"] ~ /merge_group/) print "mg-reuse if names merge_group: a queue entry could reuse" + # once the receipt judge exists, the test-ran marker must be keyed on its verdict, else a receipt run reads as tested + if (("receipt-judge" in seen) && (jneeds["workspace-test-ran"] !~ /receipt-judge/ || jif["workspace-test-ran"] !~ /receipt-judge\.outputs\.ok/)) print "workspace-test-ran ignores receipt-judge: a receipt-reuse run would read as tested" n = split("x86-main determinism x86-main-advisories ci-gate gate", must, " ") for (i = 1; i <= n; i++) { if (!(must[i] in seen)) print "job " must[i] " is missing from the workflow" @@ -681,6 +684,9 @@ STUB mgmut x86-main-needs-lookalike "job x86-main no longer needs mg-reuse" '/^ x86-main:$/,/^ if:/{s/^ needs: \[mg-reuse\]$/ needs: [mg-reuse-self-test]/}' mgmut x86-main-drops-needs "job x86-main no longer needs mg-reuse" '/^ x86-main:$/,/^ if:/{/^ needs: \[mg-reuse\]$/d}' mgmut gate-if-loses-always "job gate needs mg-reuse but its if lacks" "/^ gate:\$/,/^ steps:/{s/^ if: always\(\)/ if: success()/}" + # once a receipt-judge job exists (#5850), the marker must need it and key its if on the verdict + mgmut ran-marker-ignores-receipt-judge "workspace-test-ran ignores receipt-judge" 's#^ workspace-test-ran:$# receipt-judge:\n runs-on: x\n workspace-test-ran:#' + mgmut ran-marker-needs-judge-but-if-ignores-it "workspace-test-ran ignores receipt-judge" '/^ workspace-test-ran:$/,/^ runs-on:/{s#^ needs: \[workspace-test-arch\]$# needs: [workspace-test-arch, receipt-judge]#};s#^ workspace-test-ran:$# receipt-judge:\n runs-on: x\n workspace-test-ran:#' # Positive control for wire itself: one job of more than 64 KiB (a pipe buffer) whose # wanted line comes first. A pipe from job into grep -q takes SIGPIPE on this every From 1c8098954c1710ebe51f0fbc1de934066a6459c4 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 22 Oct 2026 07:02:06 +0200 Subject: [PATCH 09/12] fix(ci): regenerate roadmap aggregate after merge; rewrite shards() jq without $s[] so the bashrs ratchet holds at 6 x86-main guard-tree: check_roadmap_fragment_required (aggregate drift) and check_shell_lint_ratchet (6 -> 9: SC1087 on the jq array expansions). Co-Authored-By: Claude Sonnet 5.5 --- docs/roadmaps/roadmap.yaml | 7 +++++++ scripts/ci_mg_reuse.sh | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/roadmaps/roadmap.yaml b/docs/roadmaps/roadmap.yaml index d26fe5e4f2..abbeef5d40 100644 --- a/docs/roadmaps/roadmap.yaml +++ b/docs/roadmaps/roadmap.yaml @@ -25449,6 +25449,13 @@ Not done, pending the ruling: moving the 31 fixture files to an obviously synthe acceptance_criteria: - 'merge_group skips workspace-test-shard only when K1-K5 hold and the PR head run workspace-test succeeded; any difference runs the full shards' - 'ci_mg_reuse.sh --self-test falsifier: changed main/tree -> wt=0, identical tree -> wt=1, override carries wt only when exactly 1' + phases: [] + subtasks: [] + estimated_effort: null + labels: + - kind:code + notes: null + epic: 5510 - id: PMAT-5888 github_issue: 5888 item_type: task diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index e4d5569ab6..75ef965fb8 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -71,8 +71,8 @@ concl() { # name agrees on (0 if they disagree). A draft PR run (or a reused one) has green `workspace-test` and NO such jobs (#5885 lane-b). shards() { jq -r '[.jobs[]? | select(.name | test("^workspace-test-shard \\([0-9]+, [0-9]+\\)$"))] as $s - | ([$s[].name | capture(", (?[0-9]+)\\)$").m | tonumber] | unique) as $m - | "\($s | map(.name) | unique | length) \([$s[] | select(.conclusion != "success")] | length) \(if ($m | length) == 1 then $m[0] else 0 end)"' "$1" 2> /dev/null || echo "0 1 0" + | ($s | map(.name | capture(", (?[0-9]+)\\)$").m | tonumber) | unique) as $m + | "\($s | map(.name) | unique | length) \($s | map(select(.conclusion != "success")) | length) \(if ($m | length) == 1 then ($m | first) else 0 end)"' "$1" 2> /dev/null || echo "0 1 0" } decide() { From a12b8296166f7503fa17e6b11156d516e5f65a71 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 22 Oct 2026 07:21:50 +0200 Subject: [PATCH 10/12] =?UTF-8?q?fix(ci):=20#5885=20re-seat=20findings=20?= =?UTF-8?q?=E2=80=94=20non-vacuous=20mg-reuse=20rows,=20no=20transitive=20?= =?UTF-8?q?T36=20reuse,=20ran-marker=20after=20shards?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. the four wt rows (changed-tree, changed-main, base-is-a-merge, run-in-progress) now carry fully-tested shard + ran fixtures, so wt=0 comes from their named reason alone 2. ci_mg_workspace_result.sh: a green merge-queue workspace-test is reused only if that run's own workspace-test-shard jobs all succeeded (3rd call; R-JOBSAPI, R-SHARDS; rows L14-L18) 3. mg-reuse-wt runs on the mq lane (same as the shards it gates), 5 min timeout 4. workspace-test-ran needs the shards and runs only after they succeeded 5. PLANTED_4655_JOBS provenance comment states the shard names were rewritten Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 14 ++++++++---- scripts/check_ci_push_reuse.sh | 38 +++++++++++++++++++++++++++++-- scripts/ci_mg_reuse.sh | 17 ++++++++------ scripts/ci_mg_workspace_result.sh | 17 ++++++++++++-- 4 files changed, 70 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cedf82b57c..35025bb6ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,8 +147,9 @@ jobs: # are NOT read here: they stay un-reused on the queue (20X r2), so x86-main still never waits for this job. mg-reuse-wt: if: github.event_name == 'merge_group' - runs-on: [self-hosted, Linux, X64, clean-room] - timeout-minutes: 10 + # same lane as the shards it gates (mq on a queue entry); the job only runs on merge_group, the clean-room arm just names the pool for the label guard + runs-on: ${{ github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","X64","mq"]') || fromJSON('["self-hosted","Linux","X64","clean-room"]') }} + timeout-minutes: 5 permissions: contents: read actions: read @@ -159,6 +160,7 @@ jobs: steps: - uses: actions/checkout@v7 with: + # full history: K3 (merge-base --is-ancestor) walks the PR head back to the base; the mq runner keeps a warm clone fetch-depth: 0 - name: Read the workspace-test reuse key for this queue entry (3 API calls) id: key @@ -510,11 +512,13 @@ jobs: # explicit runner's round-robin N/12), in parallel on the X64 clean-room pool. # The section body is ci/sections.yml `workspace-test-shard`, unchanged. # mg-reuse-wt may cite a PR run only if that run really tested the tree. A receipt-reuse run (#5850, tier=reuse) - # runs no test step, so its shards are green over zero tests: this marker is skipped there, and ci_mg_reuse.sh - # refuses wt=1 unless it succeeded (R:k6-wt-ran). Once #5850's receipt-judge job exists, ci_mg_reuse.sh --self-test + # runs no test step, so its shards are green over zero tests. This marker needs the shards and runs only after + # they SUCCEEDED, so a run whose shards were skipped or failed never has it; ci_mg_reuse.sh refuses wt=1 unless it + # succeeded (R:k6-wt-ran). Once #5850's receipt-judge job exists, ci_mg_reuse.sh --self-test # (mgshape) is RED until this job needs it and keys its if on receipt-judge.outputs.ok. workspace-test-ran: - if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft != true }} + needs: [workspace-test-shard] + if: ${{ !cancelled() && needs.workspace-test-shard.result == 'success' && github.event_name == 'pull_request' && github.event.pull_request.draft != true }} runs-on: [self-hosted, Linux, clean-room] timeout-minutes: 5 steps: diff --git a/scripts/check_ci_push_reuse.sh b/scripts/check_ci_push_reuse.sh index 0532c5d4e3..303a3e6544 100755 --- a/scripts/check_ci_push_reuse.sh +++ b/scripts/check_ci_push_reuse.sh @@ -137,10 +137,14 @@ OTHER=2222222222222222222222222222222222222222 QUEUE=gh-readonly-queue/main/pr-4700-0000000000000000000000000000000000000000 suite() { printf '{"id":%s,"head_branch":"%s","app":{"slug":"%s"}}' "$1" "$2" "${3:-github-actions}"; } crun() { printf '{"status":"%s","conclusion":%s,"head_sha":"%s","completed_at":"%s","check_suite":{"id":%s},"details_url":"https://github.com/o/r/actions/runs/%s/job/9"}' "$1" "$2" "$3" "$4" "$5" "$6"; } +sjobs() { # sjobs ... -> a jobs body whose workspace-test-shard (n, 4) jobs all succeeded (the queue run really tested) + local n; { for n in "$@"; do printf '{"name":"workspace-test-shard (%s, 4)","conclusion":"success"}\n' "$n"; done; printf '{"name":"gate","conclusion":"success"}\n'; } | jq -s '{jobs: .}' +} canned() { # canned - rm -f "${T:?}/canned/suites.FAIL" "${T:?}/canned/runs.FAIL" "${T:?}/canned/calls" + rm -f "${T:?}/canned/suites.FAIL" "${T:?}/canned/runs.FAIL" "${T:?}/canned/mgjobs.FAIL" "${T:?}/canned/calls" printf '{"check_suites":[%s]}' "$1" >"$T/canned/suites.json" printf '{"check_runs":[%s]}' "$2" >"$T/canned/runs.json" + sjobs 1 2 3 4 >"$T/canned/mgjobs.json" } look() { OUT="$(bash "$LOOKUP" o/r "${1:-$SHA}" 2>"$T/err")"; RC=$?; ERR="$(cat "$T/err")"; } flat() { tr '\n' ' ' <<<"$1" | sed 's/ $//'; } @@ -154,7 +158,7 @@ look want "L1 a merge-queue workspace-test success on the sha -> found, exit 0" 0 "$RC" want "L1 prints the run, the sha the API reports, the conclusion (the push suite's later failure is not the queue's)" \ "--mg-run 7001 --mg-sha $SHA --mg-conclusion success" "$(flat "$OUT")" -want "L1 costs exactly 2 API calls" 2 "$(wc -l <"$T/canned/calls" | tr -d ' ')" +want "L1 costs exactly 3 API calls (suites, check-runs, the run's jobs)" 3 "$(wc -l <"$T/canned/calls" | tr -d ' ')" canned "$(suite 50 "$QUEUE")" "$(crun completed '"failure"' $SHA 2026-10-04T10:00:00Z 50 7003)" look @@ -213,6 +217,36 @@ canned "$(suite 50 "$QUEUE")" "$(crun completed '"success"' abc 2026-10-04T10:00 look want "L13 the check run reports a head_sha that is not a sha -> nothing, exit 1" "1:" "$RC:$OUT" +# L14-L18: a queue run whose green `workspace-test` did not run its own shards is a citation, not a measurement (finding: transitive reuse) +canned "$(suite 50 "$QUEUE")" "$(crun completed '"success"' $SHA 2026-10-04T10:00:00Z 50 7015)" +sjobs 1 2 | jq '.jobs += [{"name":"workspace-test-shard (3, 4)","conclusion":"skipped"},{"name":"workspace-test-shard (4, 4)","conclusion":"skipped"}]' >"$T/canned/mgjobs.json" +look +want "L14 the queue run skipped its shards (it cited a PR run) -> nothing, exit 1" "1:" "$RC:$OUT" +has "L14 says why" "did not run and pass its own workspace-test shards" "$ERR" + +canned "$(suite 50 "$QUEUE")" "$(crun completed '"success"' $SHA 2026-10-04T10:00:00Z 50 7016)" +sjobs 1 2 3 | jq '.jobs += [{"name":"workspace-test-shard (4, 4)","conclusion":"failure"}]' >"$T/canned/mgjobs.json" +look +want "L15 one shard failed under a green verdict -> nothing, exit 1" "1:" "$RC:$OUT" + +canned "$(suite 50 "$QUEUE")" "$(crun completed '"success"' $SHA 2026-10-04T10:00:00Z 50 7017)" +sjobs >"$T/canned/mgjobs.json" +look +want "L16 the queue run has no shard job at all -> nothing, exit 1" "1:" "$RC:$OUT" + +canned "$(suite 50 "$QUEUE")" "$(crun completed '"success"' $SHA 2026-10-04T10:00:00Z 50 7018)" +: >"$T/canned/mgjobs.FAIL" +look +want "L17 the jobs call fails -> nothing, exit 1" "1:" "$RC:$OUT" +has "L17 names the failed call" "jobs lookup failed" "$ERR" + +canned "$(suite 50 "$QUEUE")" "$(crun completed '"failure"' $SHA 2026-10-04T10:00:00Z 50 7019)" +sjobs >"$T/canned/mgjobs.json" +look +want "L18 a failed verdict is still printed without a jobs call (only a success is checked for citation)" \ + "--mg-run 7019 --mg-sha $SHA --mg-conclusion failure" "$(flat "$OUT")" +want "L18 and it cost 2 API calls" 2 "$(wc -l <"$T/canned/calls" | tr -d ' ')" + # -- D: the decision ------------------------------------------------------------------------------- mkrepo() { # mkrepo -> a two-commit repo whose push diff is docs-only (today's tier: none, no cargo) git init -q -b main "$1" diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index 75ef965fb8..9d7ff2ef0f 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -298,9 +298,10 @@ resolve_push() { } # ---------------------------------------------------------------- case table -# The jobs of run 37040341824, #4655's only PR-head run (db86acf021), verbatim -# from the API (two GPU-host leg job names replaced; the key never reads them): -# x86-main failed while gate and ci / gate passed. +# The jobs of run 37040341824, #4655's only PR-head run (db86acf021), from the API: two GPU-host leg job names +# replaced (the key never reads them), and the workspace-test-shard names rewritten from the run's old names to the +# live matrix form "workspace-test-shard (N, M)" (MG run 39666213701), so this is NOT verbatim. The verdict shape is +# the planted one: x86-main failed while gate and ci / gate passed. PLANTED_4655_JOBS=$'gpu-touched\tsuccess\nmutants-table-scope\tsuccess\ndeterminism\tsuccess\nworkspace-test-shard (1, 4)\tsuccess\nmac-check\tsuccess\nworkspace-test-shard (3, 4)\tsuccess\nworkspace-test-shard (2, 4)\tsuccess\nx86-main\tfailure\nmutants-table\tskipped\nmutants-shard\tskipped\ngpu-host-leg-a\tsuccess\ngpu-host-leg-b\tsuccess\nworkspace-test\tsuccess\nci / gate\tsuccess\ngate\tsuccess' GREEN_JOBS=$'x86-main\tsuccess\ndeterminism\tsuccess\nmac-check\tsuccess\nworkspace-test\tsuccess\nci / gate\tsuccess\ngate\tsuccess' @@ -418,6 +419,8 @@ self_test() { sh4() { local n; for n in "$@"; do printf 'workspace-test-shard (%s, 4)\tsuccess\n' "$n"; done; } ran() { printf 'workspace-test-ran\t%s\n' "$1"; } { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; ran success; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-ok" + # the same fully-tested jobs on the other head, so a row whose reason is the K1-K5 key reaches wt=0 for that reason alone + { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; ran success; } | jobs_json "$H2" 1001 0 > "$F/jobs.wt-ok-h2" { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; ran skipped; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-receipt" { cat <<< "$GREEN_JOBS"; sh4 1 2 3 4; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-noran" sed "s|^determinism\tsuccess\$|determinism\tfailure|" <<< "$GREEN_JOBS" | { cat; sh4 1 2 3 4; ran success; } | jobs_json "$H" 1001 0 > "$F/jobs.wt-x86fail" @@ -444,12 +447,12 @@ self_test() { wd partial-shards-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-partial wd mixed-shard-totals-runs 0 "$M" "$B" "$H" runs.ok jobs.wt-mixed-m wd empty-attempt-no-cite-runs 0 "$M" "$B" "$H" runs.no-attempt jobs.wt-ok - wd changed-tree-runs 0 "$M_TREE" "$B" "$H" runs.ok jobs.ok - wd changed-main-not-ancestor 0 "$M_K3" "$B2" "$H" runs.ok jobs.ok - wd base-is-a-merge-runs 0 "$M_K2" "$BM" "$H2" runs.h2 jobs.h2 + wd changed-tree-runs 0 "$M_TREE" "$B" "$H" runs.ok jobs.wt-ok + wd changed-main-not-ancestor 0 "$M_K3" "$B2" "$H" runs.ok jobs.wt-ok + wd base-is-a-merge-runs 0 "$M_K2" "$BM" "$H2" runs.h2 jobs.wt-ok-h2 wd head-wt-failed-runs 0 "$M" "$B" "$H" runs.ok jobs.fail-wt wd head-wt-missing-runs 0 "$M" "$B" "$H" runs.ok jobs.no-wt - wd run-in-progress-runs 0 "$M" "$B" "$H" runs.newer-running jobs.ok + wd run-in-progress-runs 0 "$M" "$B" "$H" runs.newer-running jobs.wt-ok wd head-x86-failed-still-skips 1 "$M" "$B" "$H" runs.ok jobs.wt-x86fail wrow push-never-skips 0 --event push --queue-head "$M" --base "$B" --pr-head "$H" --runs "$F/runs.ok" --jobs "$F/jobs.ok" # the override passes wt only as exactly 1, with its citation diff --git a/scripts/ci_mg_workspace_result.sh b/scripts/ci_mg_workspace_result.sh index 2493b96e70..844d7c6bd0 100644 --- a/scripts/ci_mg_workspace_result.sh +++ b/scripts/ci_mg_workspace_result.sh @@ -13,7 +13,10 @@ # Actions suite of a merge-queue branch (gh-readonly-queue/...). It reports what it found, a # failure included; judging it is ci_test_tier.sh's job. # -# Exactly two API calls, both on the checks endpoints (the ones the merge_group arm already reads). +# Three API calls: two on the checks endpoints (the ones the merge_group arm already reads) and, for a success, one +# on the found run's jobs. A queue run that SKIPPED its workspace-test shards (it cited a PR run, mg-reuse-wt #5884) +# also reports a green `workspace-test`; reusing that on the push would cite a citation, so the lookup refuses +# unless every `workspace-test-shard (N, M)` job of that run succeeded. # Anything that is not a clean answer prints NOTHING on stdout, one reason on stderr, and exits 1: # the caller then decides the tier from the push's own diff, as before T36. # @@ -50,4 +53,14 @@ done <<<"$runs" read -r hsha concl url <<<"$found" [[ $hsha =~ ^[0-9a-f]{40}$ ]] || no "the workspace-test check run reports no sha" # R-HEADSHA [[ $url =~ /actions/runs/([0-9]+)(/|$) ]] || no "the workspace-test details_url names no run id: $url" # R-RUNID -printf -- '--mg-run\n%s\n--mg-sha\n%s\n--mg-conclusion\n%s\n' "${BASH_REMATCH[1]}" "$hsha" "$concl" +rid=${BASH_REMATCH[1]} + +# Call 3 (a success only): the shards of that run. A skipped, failed or absent shard means the green +# `workspace-test` was a citation of another run (or tested nothing), never this tree's own measurement. +if [ "$concl" = success ]; then + jobs=$(gh api "repos/$repo/actions/runs/$rid/jobs?per_page=100&filter=latest"); rc=$? + [ "$rc" -eq 0 ] || no "the jobs lookup failed for run $rid" # R-JOBSAPI + shards=$(jq -r '[.jobs[]? | select(.name | test("^workspace-test-shard \\([0-9]+, [0-9]+\\)$"))] | if length == 0 then "none" elif all(.conclusion == "success") then "ok" else "no" end' <<<"$jobs" 2>/dev/null) + [ "$shards" = ok ] || no "run $rid did not run and pass its own workspace-test shards (${shards:-unreadable}): its green verdict may be a citation" # R-SHARDS +fi +printf -- '--mg-run\n%s\n--mg-sha\n%s\n--mg-conclusion\n%s\n' "$rid" "$hsha" "$concl" From aa8b4ba9ee43bc20c9f5472de99a02c731b1e39d Mon Sep 17 00:00:00 2001 From: t Date: Thu, 22 Oct 2026 07:34:27 +0200 Subject: [PATCH 11/12] =?UTF-8?q?test(ci):=20guard=20#5885=20fixes=203=20a?= =?UTF-8?q?nd=204=20=E2=80=94=20mgshape=20rules=20+=203=20mutants=20shown?= =?UTF-8?q?=20RED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mgshape now reports workspace-test-ran without needs: workspace-test-shard, workspace-test-ran whose if lacks the shard-success clause, and mg-reuse-wt off the mq lane; one mutant each. Co-Authored-By: Claude Sonnet 5.5 --- scripts/ci_mg_reuse.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/ci_mg_reuse.sh b/scripts/ci_mg_reuse.sh index 9d7ff2ef0f..91e3fc9158 100755 --- a/scripts/ci_mg_reuse.sh +++ b/scripts/ci_mg_reuse.sh @@ -646,6 +646,7 @@ STUB awk -v tok='(^|[^A-Za-z0-9_-])mg-reuse($|[^A-Za-z0-9_-])' -v want="if: github.event_name == 'push' && github.ref == 'refs/heads/main'" ' /^ [A-Za-z0-9_-]+:$/ { j = $1; sub(/:$/, "", j); seen[j] = 1; next } /^ if:/ { jif[j] = $0; sub(/^ /, "", jif[j]) } + /^ runs-on:/ { jrun[j] = $0 } /^ needs:/ || (inn && /^ /) { jneeds[j] = jneeds[j] $0 } /^ needs:/ { inn = 1; if ($0 ~ tok) dep[j] = 1; next } inn && /^ / { if ($0 ~ tok) dep[j] = 1; next } @@ -655,6 +656,11 @@ STUB if (jif["mg-reuse"] ~ /merge_group/) print "mg-reuse if names merge_group: a queue entry could reuse" # once the receipt judge exists, the test-ran marker must be keyed on its verdict, else a receipt run reads as tested if (("receipt-judge" in seen) && (jneeds["workspace-test-ran"] !~ /receipt-judge/ || jif["workspace-test-ran"] !~ /receipt-judge\.outputs\.ok/)) print "workspace-test-ran ignores receipt-judge: a receipt-reuse run would read as tested" + # the marker must prove the shards ran: it needs them and its if requires their success (else a run with skipped shards owns it) + if (jneeds["workspace-test-ran"] !~ /workspace-test-shard/) print "workspace-test-ran does not need workspace-test-shard: the marker no longer proves the shards ran" + if (jif["workspace-test-ran"] !~ /needs\.workspace-test-shard\.result == .success./) print "workspace-test-ran if lacks the shard success clause: skipped or failed shards would still own the marker" + # the reuse lookup gates every queue entry shard, so it shares their lane (mq), never the PR clean-room pool + if (jrun["mg-reuse-wt"] !~ /"mq"/) print "mg-reuse-wt is not on the mq lane: it would queue behind PR work ahead of every shard" n = split("x86-main determinism x86-main-advisories ci-gate gate", must, " ") for (i = 1; i <= n; i++) { if (!(must[i] in seen)) print "job " must[i] " is missing from the workflow" @@ -685,6 +691,9 @@ STUB # once a receipt-judge job exists (#5850), the marker must need it and key its if on the verdict mgmut ran-marker-ignores-receipt-judge "workspace-test-ran ignores receipt-judge" 's#^ workspace-test-ran:$# receipt-judge:\n runs-on: x\n workspace-test-ran:#' mgmut ran-marker-needs-judge-but-if-ignores-it "workspace-test-ran ignores receipt-judge" 's#^ workspace-test-ran:$# receipt-judge:\n runs-on: x\n workspace-test-ran:\n needs: [receipt-judge]#' + mgmut ran-marker-drops-shard-needs "workspace-test-ran does not need workspace-test-shard" '/^ workspace-test-ran:$/,/^ runs-on:/{/^ needs: \[workspace-test-shard\]$/d}' + mgmut ran-marker-if-drops-shard-result "workspace-test-ran if lacks the shard success clause" "/^ workspace-test-ran:\$/,/^ runs-on:/{s/ \&\& needs.workspace-test-shard.result == 'success'//}" + mgmut mg-reuse-wt-leaves-mq-lane "mg-reuse-wt is not on the mq lane" '/^ mg-reuse-wt:$/,/^ timeout-minutes:/{s/,"mq"\]/,"clean-room"]/}' # Positive control for wire itself: one job of more than 64 KiB (a pipe buffer) whose # wanted line comes first. A pipe from job into grep -q takes SIGPIPE on this every From ea4fea280764ac1fa3b7d78e86fb41085133eede Mon Sep 17 00:00:00 2001 From: t Date: Thu, 22 Oct 2026 10:55:14 +0200 Subject: [PATCH 12/12] test(ci): D1 CANON lists mg-reuse-wt, workspace-test-ran and the shard's wt gate (Refs #5884) falsify_ci_draft_gate_real_workflow_holds failed in the merge-group run 39744455801 (shard 3/4, 3 of 3 tries): #5885's own diff adds two jobs and a new shard `if:` that CANON did not know. Each now carries its draft behaviour. Co-Authored-By: Claude Sonnet 5.5 --- crates/aprender-core/tests/monorepo_invariants.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/aprender-core/tests/monorepo_invariants.rs b/crates/aprender-core/tests/monorepo_invariants.rs index 2579950bad..7ca5d9987d 100644 --- a/crates/aprender-core/tests/monorepo_invariants.rs +++ b/crates/aprender-core/tests/monorepo_invariants.rs @@ -1152,7 +1152,10 @@ fn draft_gate_canon() -> Vec<(&'static str, String)> { ("x86-main", format!("${{{{ !cancelled() && needs.mg-reuse.outputs.x86 != '1' && {DF} }}}}")), ("x86-main-advisories", format!("${{{{ !cancelled() && needs.mg-reuse.outputs.x86 == '1' && {DF} }}}}")), ("determinism", "${{ !cancelled() && needs.mg-reuse.outputs.det != '1' && github.event_name != 'pull_request' }}".into()), - ("workspace-test-shard", format!("${{{{ {DF} }}}}")), + // merge_group-only: a draft never reaches the queue, so there is nothing to skip. + ("mg-reuse-wt", "github.event_name == 'merge_group'".into()), + ("workspace-test-shard", format!("${{{{ !cancelled() && needs.mg-reuse-wt.outputs.wt != '1' && {DF} }}}}")), + ("workspace-test-ran", format!("${{{{ !cancelled() && needs.workspace-test-shard.result == 'success' && github.event_name == 'pull_request' && {DF} }}}}")), ("workspace-test", "always()".into()), ("ci-gate", "always()".into()), ("gate", "always()".into()),