From 835005153c8bca4b27af1389c42c4559ea187f12 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 18:06:39 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20Intel=20macOS=20runs=20on=20the=20line,?= =?UTF-8?q?=20not=20on=20every=20pull=20request=20(=C2=A78.3,=20=C2=A79.4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The repository has about one hosted macos-15-intel runner and the host's workload takes about three hours of it per run, so whole-gate pull requests queued six hours and more for it. ci-plan.sh now writes `intel`: a ready pull request into a release line runs the whole gate without the Intel construction, lanes and aggregate, unless its head is a release cut (cut/v*) or its base is main; pushes and requests run them. A push landing a tree whose pull request run passed every job but the skipped Intel jobs (Intel context once and skipped) runs honesty and the Intel jobs only. Such a run never counts as the whole gate for the plan, a dispatch, or release-gate.sh, whose four-context rule already refuses a skipped Intel context. RP-14 pins the new plan cases and the Intel jobs' `intel` condition; RP-18 plants a non-Intel run as release evidence and refuses it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Asa3QVAsEzzaQPMzJnNz1 --- .github/ci-plan.sh | 103 ++++++-- .github/workflows/ci.yml | 20 +- CHANGELOG.md | 12 + SPEC.md | 8 +- crates/conformance/src/cases/repository.rs | 281 ++++++++++++++++++++- 5 files changed, 386 insertions(+), 38 deletions(-) diff --git a/.github/ci-plan.sh b/.github/ci-plan.sh index 6592f78b02..52778a17b6 100755 --- a/.github/ci-plan.sh +++ b/.github/ci-plan.sh @@ -5,8 +5,9 @@ # pull request, draft honesty then the `rest` leg only: a development signal # pull request, ready, base honesty then the `rest` leg only, the same signal: only a pull # not main or release/* request into a line can land on it -# pull request, ready, base the whole gate -# main or release/* +# pull request, ready, base the whole gate, without the Intel macOS jobs +# main or release/* unless the head is a release cut (`cut/v*`) or +# the base is `main` # workflow_dispatch on the planned as that pull request, by the rows above # head branch of one open (`regenerate.yml` dispatches this after it # pull request commits to the head) @@ -16,7 +17,9 @@ # tree is the tree of its second parent and the # whole gate passed on that parent as a pull # request or dispatched run: then nothing, and the run says -# which run verified the tree +# which run verified the tree; or when that run +# passed every job but the Intel macOS jobs it did +# not run, honesty and the Intel jobs only # # Why: a pull request is pushed to several times before its head is final, a # merge of a head that already contains main lands that head's tree @@ -27,9 +30,18 @@ # carries the stack into `main` or a release line runs the whole gate on the # tree that lands. # +# Intel macOS (§8.3) has about one hosted runner for this repository and the +# whole of its workload takes about three hours of it, so pull requests that +# each waited for it queued for six hours and more. A pull request into a line +# runs every other job and leaves the Intel jobs to the line: the push that +# lands it runs them on the tree it lands. A release cut, and a pull request +# into `main`, run them as part of their own gate, so the run a tag's evidence +# names (`release-gate.sh`) is still one run with every host. +# # Inputs, all from the environment: EVENT, DRAFT, BASE (the base branch of a -# pull request), REPO, and REF (the branch a dispatch names). The jobs read `full` -# and `rows` from GITHUB_OUTPUT. `LEXLEAN_CI_ROWS` names the legs file +# pull request), HEAD (the head branch of a pull request), REPO, and REF (the +# branch a dispatch names). The jobs read `full`, `rows` and `intel` from +# GITHUB_OUTPUT. `LEXLEAN_CI_ROWS` names the legs file # when a test runs the script elsewhere. set -euo pipefail @@ -39,20 +51,30 @@ draft=${DRAFT:-} base=${BASE:-} repo=${REPO:?REPO names owner/name} ref=${REF:-} +head=${HEAD:-} out=${GITHUB_OUTPUT:-/dev/stdout} summary=${GITHUB_STEP_SUMMARY:-/dev/null} +# full, rows, and whether the Intel macOS jobs run (default: with the whole gate). emit() { - printf 'full=%s\nrows=%s\nhonesty=%s\nfanout=%s\n' "$1" "$2" \ + printf 'full=%s\nrows=%s\nhonesty=%s\nfanout=%s\nintel=%s\n' "$1" "$2" \ "$(jq -c '[.[] | select(.part == "honesty")]' <<< "$2")" \ - "$(jq -c '[.[] | select(.part != "honesty")]' <<< "$2")" >> "$out" + "$(jq -c '[.[] | select(.part != "honesty")]' <<< "$2")" "${3:-$1}" >> "$out" } +# The whole gate; INTEL (default true) says whether its Intel macOS jobs run. whole_gate() { - emit true "$(jq -c . "$rows_file")" + emit true "$(jq -c . "$rows_file")" "${2:-true}" printf '%s\n' "$1" >> "$summary" } +# A pull request whose run carries the Intel macOS jobs: a release cut, whose +# run is the evidence of its tag, and a pull request into `main`. +intel_pull_request() { + case "$head" in cut/v*) return 0 ;; esac + [ "$base" = main ] +} + # These are the four auxiliary §8.3 contexts, not the number of matrix rows. # Linux x86-64 is the normative gate; Intel macOS is a static aggregate. Every # required context must occur exactly once, so a duplicate or foreign context @@ -74,18 +96,61 @@ hosts_passed() { }' } +# Whether a jobs listing (`nameconclusion`) is the whole gate without its +# Intel macOS jobs, passed: every job concluded `success` but those Intel jobs, +# which were skipped, and the run holds the Intel context exactly once and +# skipped, the join of Atlas, the three other supported-host contexts exactly +# once, and every leg of the rows file. +linux_passed() { + local names=$1 part job + printf '%s\n' "$names" | awk -F'\t' ' + $1 == "build and non-Lean tests (x86_64-apple-darwin)" { intel++ } + $1 == "Intel test construction and local targets" || $1 ~ /^Intel conformance \(/ \ + || $1 == "build and non-Lean tests (x86_64-apple-darwin)" { + if ($2 != "skipped") bad = 1 + next + } + $2 != "success" { bad = 1 } + END { exit bad || intel != 1 }' || return 1 + printf '%s\n' "$names" | grep -xF $'atlas (join)\tsuccess' >/dev/null || return 1 + printf '%s\n' "$names" | awk -F'\t' ' + BEGIN { + expected["build and non-Lean tests (aarch64-unknown-linux-gnu)"] = 1 + expected["build and non-Lean tests (aarch64-apple-darwin)"] = 1 + expected["build and non-Lean tests (x86_64-pc-windows-msvc)"] = 1 + } + /^build and non-Lean tests \(/ { + if ($1 == "build and non-Lean tests (x86_64-apple-darwin)") next + if (!($1 in expected) || ++seen[$1] != 1 || $2 != "success") bad = 1 + } + END { + for (host in expected) if (seen[host] != 1) bad = 1 + exit bad + }' || return 1 + for part in $(jq -r '.[].part' "$rows_file"); do + job="just vv ($part)" + [ "$part" != honesty ] || job=honesty + printf '%s\n' "$names" | grep -xF "$job"$'\tsuccess' >/dev/null || return 1 + done +} + # The id of a pull request run, or a dispatched run, of this workflow on # COMMIT that ran every job of the gate and passed every one. A draft run has # honesty and the `rest` leg, so it is never one: the run must hold the join of # Atlas, every exact supported-host context, and every leg of the rows file, -# and no job that did not conclude `success`. +# and no job that did not conclude `success`. With MODE `linux`, a run that +# passed every job but the Intel macOS jobs it skipped counts as well. full_run_of() { - local commit=$1 runs id names part job + local commit=$1 mode=${2:-whole} runs id names part job runs=$(gh api "repos/$repo/actions/workflows/ci.yml/runs?head_sha=$commit&status=success&per_page=30" \ --jq ".workflow_runs[] | select(.head_repository.full_name == \"$repo\") | select(.event == \"pull_request\" or .event == \"workflow_dispatch\") | .id") || return 1 for id in $runs; do names=$(gh api "repos/$repo/actions/runs/$id/jobs?per_page=100" --paginate \ --jq '.jobs[] | "\(.name)\t\(.conclusion)"') || continue + if [ "$mode" = linux ] && linux_passed "$names"; then + printf '%s\n' "$id" + return 0 + fi if printf '%s\n' "$names" | awk -F'\t' '$2 != "success" { bad = 1 } END { exit bad }' \ && printf '%s\n' "$names" | grep -xF $'atlas (join)\tsuccess' >/dev/null \ && printf '%s\n' "$names" | hosts_passed; then @@ -108,9 +173,9 @@ full_run_of() { # release merge lands the regenerated head's tree, and the pull request that # carries the line to `main` lands the release merge's. verified_tree_run() { - local commit=$1 depth=${2:-0} + local commit=$1 depth=${2:-0} mode=${3:-whole} while :; do - if full_run_of "$commit"; then + if full_run_of "$commit" "$mode"; then return 0 fi [ "$depth" -lt 4 ] || return 1 @@ -125,14 +190,14 @@ verified_tree_run() { } # The verified run of the second parent of HEAD, when HEAD is a merge of that -# parent with the same tree. +# parent with the same tree (MODE as for `full_run_of`). verified_parent_run() { local parent parent=$(git rev-parse --verify --quiet 'HEAD^2') || return 1 [ "$(git rev-parse 'HEAD^{tree}')" = "$(git rev-parse "$parent^{tree}")" ] || return 1 # HEAD to its parent is the first of the four merges `release-gate.sh` # walks from the tagged commit. - verified_tree_run "$parent" 1 + verified_tree_run "$parent" 1 "${1:-whole}" } # A pull request's run: honesty then `rest` for a draft or a stacked base, @@ -145,7 +210,11 @@ pull_request_plan() { case "$base" in # An unknown base is not known to be stacked: the whole gate. main | release/* | '') - whole_gate 'Pull request ready for review: the whole gate.' + if intel_pull_request; then + whole_gate 'Pull request ready for review: the whole gate.' + else + whole_gate 'Pull request ready for review: the whole gate but its Intel macOS jobs, which the push that lands it runs.' false + fi ;; *) emit false "$(jq -c '[.[] | select(.part == "honesty" or .part == "rest")]' "$rows_file")" @@ -175,6 +244,9 @@ case "$event" in if run=$(verified_parent_run); then emit false '[]' printf 'This push merges a head whose tree it equals, and the whole gate passed on that head: run %s of %s. Nothing is run again.\n' "$run" "$repo" >> "$summary" + elif run=$(verified_parent_run linux); then + emit false "$(jq -c '[.[] | select(.part == "honesty")]' "$rows_file")" true + printf 'This push merges a head whose tree it equals, and run %s of %s passed the whole gate on it but the Intel macOS jobs: honesty and the Intel jobs only.\n' "$run" "$repo" >> "$summary" else whole_gate 'Push: the whole gate.' fi @@ -183,6 +255,7 @@ case "$event" in if found=$(dispatched_pull_request); then draft=${found%%$'\t'*} base=${found#*$'\t'} + head=$ref printf 'Dispatched on the head of an open pull request into `%s`: planned as that pull request.\n' "$base" >> "$summary" # A ready head whose tree a full run already verified (the line a cut # carries to `main`) is not verified again. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54ed2b0f97..c0eea6a00b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,8 +102,12 @@ jobs: # pull request into one of those, a request (planned as the pull request whose # head it names, when there is one), and a push to `main` run the whole # gate, except a push that merges a head whose tree it equals and whose whole - # gate passed (it runs nothing and names the run). `.github/ci-plan.sh` is the - # decision, and RP-14 runs it against planted events. + # gate passed (it runs nothing and names the run). A pull request into a + # line runs the Intel macOS jobs only when it is a release cut (`cut/v*`) or + # its base is `main`; the push that lands any other runs them, alone after + # honesty when its tree is the one the pull request verified (`intel`). + # `.github/ci-plan.sh` is the decision, and RP-14 runs it against planted + # events. plan: name: plan runs-on: ubuntu-24.04 @@ -116,6 +120,7 @@ jobs: rows: ${{ steps.plan.outputs.rows }} honesty: ${{ steps.plan.outputs.honesty }} fanout: ${{ steps.plan.outputs.fanout }} + intel: ${{ steps.plan.outputs.intel }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -128,6 +133,7 @@ jobs: EVENT: ${{ github.event_name }} DRAFT: ${{ github.event.pull_request.draft }} BASE: ${{ github.event.pull_request.base.ref }} + HEAD: ${{ github.event.pull_request.head.ref }} REPO: ${{ github.repository }} REF: ${{ github.ref_name }} run: .github/ci-plan.sh @@ -1184,10 +1190,14 @@ jobs: # conformance binary embeds its checkout path and builds generated packages # offline, so its same-run handoff includes those explicit dependencies. # No build cache, credentials, or evidence from another run is admitted. + # + # Intel macOS has about one hosted runner here, and these jobs take about + # three hours of it, so they run when the plan's `intel` is set: on the line, + # on a release cut, and on a pull request into `main` (§9.4). intel-construction: name: Intel test construction and local targets needs: [plan, honesty] - if: ${{ needs.plan.outputs.full == 'true' }} + if: ${{ needs.plan.outputs.intel == 'true' }} runs-on: macos-15-intel timeout-minutes: 240 outputs: @@ -1210,7 +1220,7 @@ jobs: intel-part: name: Intel conformance (${{ matrix.lane }}) needs: [plan, intel-construction] - if: ${{ needs.plan.outputs.full == 'true' }} + if: ${{ needs.plan.outputs.intel == 'true' }} strategy: fail-fast: false matrix: @@ -1241,7 +1251,7 @@ jobs: intel-join: name: build and non-Lean tests (x86_64-apple-darwin) needs: [plan, intel-construction, intel-part] - if: ${{ always() && needs.plan.outputs.full == 'true' }} + if: ${{ always() && needs.plan.outputs.intel == 'true' }} runs-on: ubuntu-24.04 timeout-minutes: 15 steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b88dae65c..841d026355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,18 @@ workspace carried at those versions without a tag. ## Unreleased +- Intel macOS runs on the line, not on every pull request (SPEC.md §8.3, + §9.4). The repository has about one hosted Intel runner and the host's + workload takes about three hours of it, so pull requests queued six hours + and more for it. `ci-plan.sh` writes `intel`: a ready pull request into a + release line runs the whole gate without the Intel construction, lanes and + aggregate, unless its head is a release cut (`cut/v*`) or its base is + `main`; a push and a request run them. A push landing a tree whose pull + request run passed every job but the skipped Intel jobs runs honesty and the + Intel jobs only. Such a run never counts as the whole gate for the plan, a + dispatch or `release-gate.sh`, so a tag's evidence is still one run with + every host. `RP-14` and `RP-18` pin the new cases. + - Canonical JSON refuses duplicate keys that differ only in their escapes (SPEC.md §21.7, `AR-11`, #475). The duplicate check compared each key as written, so `{"a":1,"\u0061":2}` passed it and `Json::parse` returned `{"a":2}`, dropping the first member; keys are now diff --git a/SPEC.md b/SPEC.md index c2d7da9cc7..b4380a9f5f 100644 --- a/SPEC.md +++ b/SPEC.md @@ -557,13 +557,13 @@ The Rust crate MUST build and its non-Lean tests MUST pass on: - macOS AArch64; - Windows x86-64. -`ci.yml` checks these hosts in every run that is the whole gate (§9.4). The normative full verification and reproducibility gate runs on Linux x86-64. The Linux AArch64 and macOS AArch64 legs each run one `cargo test --locked --workspace --all-features --no-fail-fast`, which builds the library and binary in the same locked, all-features test profile and reports every failing test binary rather than stopping at the first. These two legs are unchanged by the partitions below. Each execution job MUST check the actual Rust host triple against the host it claims. Other hosts produce platform-bound attestations and MUST obey the same source, manifest, and policy formats. +`ci.yml` checks these hosts in every run that is the whole gate (§9.4), except macOS x86-64 on a pull request into a release line that is not a release cut, which the push that lands it checks instead (§9.4). The normative full verification and reproducibility gate runs on Linux x86-64. The Linux AArch64 and macOS AArch64 legs each run one `cargo test --locked --workspace --all-features --no-fail-fast`, which builds the library and binary in the same locked, all-features test profile and reports every failing test binary rather than stopping at the first. These two legs are unchanged by the partitions below. Each execution job MUST check the actual Rust host triple against the host it claims. Other hosts produce platform-bound attestations and MUST obey the same source, manifest, and policy formats. On macOS x86-64, one construction job and one conformance execution job per committed lane partition that same complete workspace test workload. Construction MUST compile all workspace test targets once from a clean checkout with the pinned Rust toolchain, locked dependencies, all features and the default test profile, and discover the executable test targets from Cargo's machine-readable output. It MUST execute every non-conformance test target, including the `repo-conformance` library, complete `bdd` meta target and other integration targets, and all workspace doctests. It MUST record each execution's outcome and continue independent executions after a test failure. A local test or doctest failure MUST NOT prevent the conformance jobs from running after successful construction; it remains a failure of the host aggregate. All conformance execution jobs MUST run the same constructed `repo-conformance` conformance executable, without rebuilding it. `.github/intel-host-lanes.json` defines a nonempty set of lanes, grouping complete existing parts of `.github/bdd-parts.json`; no fixture-sharing part is split. The conformance executable's actual harness inventory and its filtered inventories MUST prove that each test belongs to exactly one lane and that their union is the complete executable's inventory. Unknown, empty, duplicate or overlapping assignments MUST fail. The remainder owns future conformance tests until assigned, rather than a copied fixed test-name list omitting them. The constructed artifact MUST bind the repository, source commit and tree, workflow run and attempt, checkout path, actual Rust version and pin, native target, profile, features, lockfile, both plans, executable bytes and mode, and exact inventories and filters. Only the executable, its actual runtime dynamic-library closure, and dependency data required by its tests may be transferred; no target build cache, proof result or artifact from another run or attempt is accepted. Consumers MUST verify this custody and inventory before executing their filters, record the subprocess outcome and complete harness results, and bind their receipts and logs to the construction identity. -The aggregate MUST require the construction result and exactly one successful receipt for each committed lane, reject missing, duplicate, foreign, changed, failed or incomplete evidence, and run even when a prerequisite failed or was cancelled so absence cannot become success. Its check context MUST remain exactly `build and non-Lean tests (x86_64-apple-darwin)`. The other auxiliary contexts remain exactly `build and non-Lean tests (aarch64-unknown-linux-gnu)`, `build and non-Lean tests (aarch64-apple-darwin)` and `build and non-Lean tests (x86_64-pc-windows-msvc)`. Previous-run and release evidence MUST require each of these four exact contexts once, not infer complete coverage from the number of matrix rows or accept a partition context in place of a host. The partition changes scheduling and custody only: it reduces no test, changes no assertion or corpus, and raises no host timeout. +The aggregate MUST require the construction result and exactly one successful receipt for each committed lane, reject missing, duplicate, foreign, changed, failed or incomplete evidence, and run even when a prerequisite failed or was cancelled so absence cannot become success. Its check context MUST remain exactly `build and non-Lean tests (x86_64-apple-darwin)`. The other auxiliary contexts remain exactly `build and non-Lean tests (aarch64-unknown-linux-gnu)`, `build and non-Lean tests (aarch64-apple-darwin)` and `build and non-Lean tests (x86_64-pc-windows-msvc)`. Previous-run and release evidence MUST require each of these four exact contexts once and passed, a skipped Intel context being absent evidence, not infer complete coverage from the number of matrix rows or accept a partition context in place of a host. The partition changes scheduling and custody only: it reduces no test, changes no assertion or corpus, and raises no host timeout. On Windows x86-64 that same complete workspace test workload runs as lanes of one run (`.github/scripts/host_lanes.py`): the conformance lanes of `.github/intel-host-lanes.json`, each running the conformance harness with that lane's filters, and a `producer` lane running every other test target of the workspace, the `repo-conformance` library, `bdd` meta target and other integration targets among them, and every doctest. Each lane is a job of its own clean checkout that builds with the pinned toolchain, locked dependencies, all features and the default test profile, checks its host triple, and records the commit, tree, run and attempt, the harness's listing, the producer's listing of the whole workspace, and every test it executed. The aggregate, whose check context remains exactly `build and non-Lean tests (x86_64-pc-windows-msvc)`, runs even when a lane failed or was cancelled, and passes only with exactly one passing receipt for each lane of the run and commit, lanes that listed the same harness, and executed tests whose union is the whole listing with each test once. It reduces no test, changes no assertion, and raises no host timeout. @@ -689,7 +689,7 @@ Its image MUST install the pinned Rust and Lean toolchains at build, so that not `ci.yml` MUST run every recipe of `just vv` from a clean checkout on Linux x86-64. It MUST install the exact Rust toolchain, Lean 4.32.1 through `elan`, `just`, and `cargo-deny`. -**What a run is.** `ci.yml` starts with the job `plan`, which decides from the event and the repository alone, through `.github/ci-plan.sh`, what the run is before any job that costs a runner starts. A pull request that is a draft runs the initial honesty part then the `rest` leg: a head pushed again before it is final costs these two jobs and not the full gate, the run is a development signal, and a draft is not mergeable on it; marking the pull request ready, and every push to it after, run the whole gate. So is a ready pull request whose base branch is neither `main` nor a `release/*` line (a stacked pull request, whose base is another feature branch): only a pull request into `main` or a release line can land on a line, that pull request runs the whole gate on the tree it lands, and the stacked run says in its step summary that the base is why it runs honesty then the `rest` leg. A ready pull request into `main` or a release line, a `workflow_dispatch`, and a push to `main` or to a release line are the whole gate, every job below. A `workflow_dispatch` on the head branch of exactly one open pull request of this repository is planned as that pull request, by its draft flag and base, because `regenerate.yml` commits to that branch with the workflow token, whose push starts no `pull_request` run, and dispatches the gate there instead; a dispatch on any other branch, or one whose pull request the plan cannot read, is the whole gate. A dispatch planned as a ready pull request whose head's tree such a run already verified, by the same walk down equal-tree merges from the head itself, runs no job but the plan, which records the run. One push to `main` or to a release line is not: when it is a merge commit whose tree is the tree of its second parent (a pull request head that already contained `main`) and a run of this workflow passed every job for that parent as a pull request of this repository or dispatched on its branch (or, while the parent is itself a merge whose tree is its second parent's, for that second parent, at most four merges down, as when a release merge that landed a regenerated head is carried to `main`), with none skipped, the join of Atlas, every host of §8.3, and every leg of `.github/vv-rows.json` among them, the push runs no job but the plan, which records the run: the tree it lands is byte for byte the tree that run verified, on the same runners and with the same pins. Any other push to `main` or to a release line, including one the plan cannot decide (a failed query, no run, a run of a draft, a merge that changed the tree, a push that is no merge), is the whole gate. `release.yml` consumes the complete same-tree gate evidence described below. `RP-14` runs the script against planted events, among them a ready pull request into a feature branch, into a release line, and into `main`, and a dispatch on a draft's head, on a ready head, and on a branch with no pull request, and a plant in it fails the case, and reads the CI and reproducibility workflows' push triggers, which name `main` and `release/**`. +**What a run is.** `ci.yml` starts with the job `plan`, which decides from the event and the repository alone, through `.github/ci-plan.sh`, what the run is before any job that costs a runner starts. A pull request that is a draft runs the initial honesty part then the `rest` leg: a head pushed again before it is final costs these two jobs and not the full gate, the run is a development signal, and a draft is not mergeable on it; marking the pull request ready, and every push to it after, run the whole gate. So is a ready pull request whose base branch is neither `main` nor a `release/*` line (a stacked pull request, whose base is another feature branch): only a pull request into `main` or a release line can land on a line, that pull request runs the whole gate on the tree it lands, and the stacked run says in its step summary that the base is why it runs honesty then the `rest` leg. A ready pull request into `main` or a release line, a `workflow_dispatch`, and a push to `main` or to a release line are the whole gate, every job below, except that a ready pull request into a release line runs no Intel macOS job (the construction, its lanes and their aggregate, §8.3) unless its head branch is a release cut, `cut/v*`: Intel macOS has about one hosted runner for this repository and its workload takes about three hours of it, so a pull request that waited for it waited for hours, and the push that lands the pull request runs those jobs on the tree it lands. The plan names this in the output `intel`, which is set on every whole gate but those pull requests, and the Intel jobs run when it is set; a pull request into `main` and a release cut run them, so the run that verified a tag's tree (§30.3) still holds every host. A `workflow_dispatch` on the head branch of exactly one open pull request of this repository is planned as that pull request, by its draft flag and base, because `regenerate.yml` commits to that branch with the workflow token, whose push starts no `pull_request` run, and dispatches the gate there instead; a dispatch on any other branch, or one whose pull request the plan cannot read, is the whole gate. A dispatch planned as a ready pull request whose head's tree such a run already verified, by the same walk down equal-tree merges from the head itself, runs no job but the plan, which records the run. One push to `main` or to a release line is not: when it is a merge commit whose tree is the tree of its second parent (a pull request head that already contained `main`) and a run of this workflow passed every job for that parent as a pull request of this repository or dispatched on its branch (or, while the parent is itself a merge whose tree is its second parent's, for that second parent, at most four merges down, as when a release merge that landed a regenerated head is carried to `main`), with none skipped, the join of Atlas, every host of §8.3, and every leg of `.github/vv-rows.json` among them, the push runs no job but the plan, which records the run: the tree it lands is byte for byte the tree that run verified, on the same runners and with the same pins. When the run of that parent passed every job but the Intel macOS jobs, which it skipped, with the Intel context once and skipped and every other host, leg and the join of Atlas passed, the push runs honesty and the Intel jobs only, and the plan records the run; such a run never counts as the whole gate, for the plan, a dispatch, or the release's evidence. Any other push to `main` or to a release line, including one the plan cannot decide (a failed query, no run, a run of a draft, a merge that changed the tree, a push that is no merge), is the whole gate. `release.yml` consumes the complete same-tree gate evidence described below. `RP-14` runs the script against planted events, among them a ready pull request into a feature branch, into a release line, and into `main`, a release cut, a dispatch on a draft's head, on a ready head, on a cut's head, and on a branch with no pull request, and a push landing a tree a run verified without the Intel jobs, and a plant in it fails the case, and reads the CI and reproducibility workflows' push triggers, which name `main` and `release/**`. **Release lines.** A release line is the branch `release/vX.Y` of the release X.Y: it is cut from `main` when work on X.Y begins, every pull request for the milestone X.Y targets it, each `vX.Y.Z` tag is made from it, and it is merged forward, by merge commit, into the next release line after each landing so that the next line carries every fix of the one before it. `main` is the newest released line: a release line is merged into `main` when its release is tagged, and nothing else lands on `main`. A release line is held to the same gate as `main`: a push to it is the whole gate under the rule above, and a pull request against it is a pull request of this repository. @@ -707,7 +707,7 @@ Every normative gate job runs on the standard GitHub-hosted runner, `ubuntu-24.0 The bootstrap production export (§24.7) is made once per run. Every bootstrap case compares the packages of the bootstrap project's export with the committed packages, and a test process that needs the export exports the project, which verifies it whole; each part that ran a bootstrap case ran that verification. In a run that is the whole gate, the job `bootstrap-export` runs `cargo xtask export-bootstrap` from its clean checkout after honesty, at the profile of the `examples` leg, requires every exported package to equal the committed package, and uploads the bundle as the artifact `bootstrap-export` with a custody record (`lexlean/ci-bootstrap-export/2`) that names the repository, the run and its attempt, the commit and its tree, the SHA-256 of `rust-toolchain.toml`, `lean-toolchain` and `Cargo.lock`, what `rustc -vV` and `lean --version` report, the SHA-256 of the pinned toolchain's `lake`, `lean` and `leanchecker` executables and the address of the `rustc` that compiled the job's own binary (§22.11), the bundle's project-relative path, and the digest of its files. The legs do not wait for that job to start: each leg of such a run starts `.github/scripts/take-bootstrap-export.sh`, which asks nothing until a case of the leg needs the export, then downloads that artifact of its own run, or records that the export job ended without it, and the case fails with that reason. The harness names the directory it waits in through `LEXLEAN_BOOTSTRAP_EXPORT`; before any case reads the bundle it requires the record to name the leg's own repository, run, commit, tree, pins, toolchains and executable addresses, an attempt at most the leg's (a rerun of failed jobs keeps the export that passed, on the same commit), the digest of the files it received, and a path below the project, and it replays the bundle (§24.7). A record that differs in any of these fails the case. Unset or empty, as in `just vv` and in a run that is not the whole gate, each process that needs the export runs it itself. The export crosses no run, as the Atlas parts do not; `RP-14` checks the job, the legs' fetcher, and the record against planted changes. -The Intel host factory is separate from the normative BDD and Atlas partitions above: it transfers only the same-run host test construction and dependency data of §8.3. Construction requires successful honesty; consumers require construction; the aggregate requires all of them and cannot skip an incomplete result. The factory's behavioral tests run in the initial honesty job, before the expensive roots, and exercise inventory completeness, custody and fail-closed result joins without needing an Intel runner. These tests do not substitute for execution of the complete workload on Intel macOS. +The Intel host factory is separate from the normative BDD and Atlas partitions above: it transfers only the same-run host test construction and dependency data of §8.3. Construction requires successful honesty and the plan's `intel`; consumers require construction; the aggregate requires all of them and cannot skip an incomplete result. A run whose plan does not set `intel` skips all three, and its Intel context is skipped, never passed, so that run is not evidence of the Intel host for the plan or the release. The factory's behavioral tests run in the initial honesty job, before the expensive roots, and exercise inventory completeness, custody and fail-closed result joins without needing an Intel runner. These tests do not substitute for execution of the complete workload on Intel macOS. `ci.yml` MUST expose the initial `honesty` job (retaining the previous check context) separately so claim drift is distinguishable from code failure. It runs the existing format, model and specification-link recipes and the complete BDD meta-gate target, without Lean. Before them it runs `cargo xtask check-freshness`, also without Lean: every input a committed build oracle (`expected/build/manifest.json`) records still has its recorded digest and length, every such project's lock passes `lexlean lock --check`, every oracle and every committed package under `tests/production-export/` names this compiler's semantics, and every such package names its project's committed semantic ID. A tree committed without regenerating what its change moves fails there in minutes, before the expensive roots; the check adds a precondition and replaces no check of the gate, which still compares every generated byte. The remaining rows, supported hosts, the bootstrap export and Atlas prefix MUST require its success; these recipes and meta tests run once in the normative gate. Both the plan's previous-run evidence and release evidence MUST require the honesty row, including its successful conclusion; missing, failed or skipped honesty never establishes full acceptance. The separate `honesty.yml` workflow is subsumed by this same-run job. diff --git a/crates/conformance/src/cases/repository.rs b/crates/conformance/src/cases/repository.rs index d7c2dd69d3..452665c63b 100644 --- a/crates/conformance/src/cases/repository.rs +++ b/crates/conformance/src/cases/repository.rs @@ -308,15 +308,18 @@ fn plan_decisions() { let path = format!("{}:{}", bin.display(), std::env::var("PATH").expect("PATH")); // (full, rows' parts) for one planted event; a dispatch names its branch // and the open pull requests `gh` lists for it, as `draftbase` lines. - let decide_with = |event: &str, - draft: &str, - base: &str, - commit: &str, - runs: &str, - jobs: &[String], - fail: bool, - branch: &str, - pulls: &str| { + // `plan_full` also names the pull request's head branch and returns + // whether the Intel macOS jobs run (`intel`). + let plan_full = |event: &str, + draft: &str, + base: &str, + head: &str, + commit: &str, + runs: &str, + jobs: &[String], + fail: bool, + branch: &str, + pulls: &str| { git(&["checkout", "-q", "--detach", commit]); let out = dir.join("out"); let _ = std::fs::remove_file(&out); @@ -328,6 +331,7 @@ fn plan_decisions() { .env("EVENT", event) .env("DRAFT", draft) .env("BASE", base) + .env("HEAD", head) .env("REPO", "owner/repo") .env("LEXLEAN_CI_ROWS", rows_file.as_std_path()) .env("GITHUB_OUTPUT", &out) @@ -373,8 +377,23 @@ fn plan_decisions() { .iter() .map(|row| row["part"].as_str().expect("a part").to_owned()) .collect::>(), + value("intel"), ) }; + let decide_with = |event: &str, + draft: &str, + base: &str, + commit: &str, + runs: &str, + jobs: &[String], + fail: bool, + branch: &str, + pulls: &str| { + let (full, parts, _) = plan_full( + event, draft, base, "", commit, runs, jobs, fail, branch, pulls, + ); + (full, parts) + }; let decide = |event: &str, draft: &str, @@ -718,6 +737,212 @@ fn plan_decisions() { decide("push", "", "main", &direct, "4242", &green, false), whole ); + // Intel macOS (§8.3, §9.4): a ready pull request into a release line runs + // the whole gate without the Intel jobs, unless its head is a release cut + // or its base is `main`; a draft never runs them; a push and a request do. + // A push that lands a tree a run verified without Intel runs honesty and + // the Intel jobs only, and a run without Intel never stands in for the + // whole gate. + let intel = |event: &str, + draft: &str, + base: &str, + head: &str, + commit: &str, + runs: &str, + jobs: &[String], + branch: &str, + pulls: &str| { + plan_full( + event, draft, base, head, commit, runs, jobs, false, branch, pulls, + ) + }; + let with_intel = |(full, parts): (String, Vec), on: &str| (full, parts, on.to_owned()); + for (what, base, head, expected) in [ + ( + "a pull request into a release line", + "release/v0.4", + "claude/x", + with_intel(whole.clone(), "false"), + ), + ( + "a release cut", + "release/v0.4", + "cut/v0.4.1", + with_intel(whole.clone(), "true"), + ), + ( + "a pull request into main", + "main", + "release/v0.4", + with_intel(whole.clone(), "true"), + ), + ( + "a branch that only starts like a cut", + "release/v0.4", + "cutv0.4.1", + with_intel(whole.clone(), "false"), + ), + ] { + assert_eq!( + intel( + "pull_request", + "false", + base, + head, + &direct, + "", + &[], + "", + "" + ), + expected, + "§9.4: Intel on {what}" + ); + } + assert_eq!( + intel( + "pull_request", + "true", + "release/v0.4", + "cut/v0.4.1", + &direct, + "", + &[], + "", + "" + ), + with_intel(draft.clone(), "false"), + "§9.4: a draft runs no Intel job" + ); + assert_eq!( + intel("push", "", "main", "", &direct, "", &[], "", ""), + with_intel(whole.clone(), "true"), + "§9.4: a push runs the Intel jobs" + ); + assert_eq!( + intel("workflow_dispatch", "", "", "", &direct, "", &[], "", ""), + with_intel(whole.clone(), "true"), + "§9.4: a request runs the Intel jobs" + ); + for (what, pulls, branch, on) in [ + ( + "a ready head into a line", + "false\trelease/v0.4", + "claude/issue-91-h7", + "false", + ), + ("a cut's head", "false\trelease/v0.4", "cut/v0.4.1", "true"), + ] { + assert_eq!( + intel( + "workflow_dispatch", + "", + "", + "", + &direct, + "", + &[], + branch, + pulls + ), + with_intel(whole.clone(), on), + "§9.4: Intel on a dispatch on {what}" + ); + } + // The jobs of a run that skipped the Intel jobs and passed every other. + let intel_job = |job: &String| { + job.starts_with("Intel ") + || job.starts_with("build and non-Lean tests (x86_64-apple-darwin)") + }; + let mut linux: Vec = green + .iter() + .filter(|job| !intel_job(job)) + .cloned() + .collect(); + linux.extend([ + "Intel test construction and local targets\tskipped".to_owned(), + "Intel conformance (${{ matrix.lane }})\tskipped".to_owned(), + "build and non-Lean tests (x86_64-apple-darwin)\tskipped".to_owned(), + ]); + let honesty_only = ( + "false".to_owned(), + vec!["honesty".to_owned()], + "true".to_owned(), + ); + assert_eq!( + intel("push", "", "main", "", &merge_equal, "4242", &linux, "", ""), + honesty_only, + "§9.4: a push landing a tree verified without Intel runs honesty and the Intel jobs" + ); + assert_eq!( + intel("push", "", "main", "", &merge_equal, "4242", &green, "", ""), + with_intel(nothing.clone(), "false"), + "§9.4: a push landing a tree verified with Intel runs nothing" + ); + assert_eq!( + decide_with( + "workflow_dispatch", + "", + "", + &carried, + &on_regenerated, + &linux, + false, + "release/v0.4", + "false\tmain" + ), + whole, + "§9.4: a run without Intel never stands in for the whole gate of a head" + ); + for (what, jobs) in [ + ( + "an Intel job that ran and failed", + linux + .iter() + .map(|job| { + job.replace( + "Intel test construction and local targets\tskipped", + "Intel test construction and local targets\tfailure", + ) + }) + .collect::>(), + ), + ("a skipped job other than Intel", { + let mut jobs = linux.clone(); + jobs.push("atlas (closure)\tskipped".to_owned()); + jobs + }), + ( + "another host missing", + linux + .iter() + .filter(|job| !job.starts_with("build and non-Lean tests (aarch64-apple-darwin)")) + .cloned() + .collect(), + ), + ( + "no Intel context", + linux + .iter() + .filter(|job| !job.starts_with("build and non-Lean tests (x86_64-apple-darwin)")) + .cloned() + .collect(), + ), + ( + "a leg missing", + linux + .iter() + .filter(|job| !job.starts_with("just vv (rest)")) + .cloned() + .collect(), + ), + ] { + assert_eq!( + intel("push", "", "main", "", &merge_equal, "4242", &jobs, "", ""), + with_intel(whole.clone(), "true"), + "§9.4: {what} is not the gate without Intel passing" + ); + } // A run of another repository's pull request is not one of this one's. let script_text = root_file(".github/ci-plan.sh"); assert!( @@ -2342,7 +2567,11 @@ pub(crate) fn run(id: &str) { "needs: [plan, intel-construction]", ), ( - "if: ${{ always() && needs.plan.outputs.full == 'true' }}", + "if: ${{ always() && needs.plan.outputs.intel == 'true' }}", + "if: ${{ needs.plan.outputs.intel == 'true' }}", + ), + ( + "if: ${{ needs.plan.outputs.intel == 'true' }}", "if: ${{ needs.plan.outputs.full == 'true' }}", ), ("runs-on: macos-15-intel", "runs-on: macos-15"), @@ -2492,6 +2721,8 @@ pub(crate) fn run(id: &str) { && plan_job.contains(" run: .github/ci-plan.sh\n") && plan_job.contains(" DRAFT: ${{ github.event.pull_request.draft }}\n") && plan_job.contains(" BASE: ${{ github.event.pull_request.base.ref }}\n") + && plan_job.contains(" HEAD: ${{ github.event.pull_request.head.ref }}\n") + && plan_job.contains(" intel: ${{ steps.plan.outputs.intel }}\n") && plan_job.contains(" EVENT: ${{ github.event_name }}\n") && plan_job.contains(" REF: ${{ github.ref_name }}\n"), "§9.4: the plan runs the script on the event and the base branch, and may read the runs of the repository" @@ -3727,19 +3958,19 @@ fn intel_host_workflow(ci: &str) -> Result<(), String> { "intel-construction", &construction, "needs: [plan, honesty]", - "if: ${{ needs.plan.outputs.full == 'true' }}", + "if: ${{ needs.plan.outputs.intel == 'true' }}", ), ( "intel-part", &part, "needs: [plan, intel-construction]", - "if: ${{ needs.plan.outputs.full == 'true' }}", + "if: ${{ needs.plan.outputs.intel == 'true' }}", ), ( "intel-join", &join, "needs: [plan, intel-construction, intel-part]", - "if: ${{ always() && needs.plan.outputs.full == 'true' }}", + "if: ${{ always() && needs.plan.outputs.intel == 'true' }}", ), ] { require(body, dependencies, key)?; @@ -3749,7 +3980,7 @@ fn intel_host_workflow(ci: &str) -> Result<(), String> { .collect(); if conditions != vec![condition.trim_start_matches("if: ")] { return Err(format!( - "RP-14: {key} does not follow its full-gate dependency policy" + "RP-14: {key} does not follow its Intel dependency policy" )); } for forbidden in [ @@ -4321,6 +4552,23 @@ fn release_gate_decisions() { .filter(|job| !job.starts_with(hosts[1].as_str())) .cloned() .collect(); + // A pull request run into a line, which skipped the Intel macOS jobs + // (§9.4): every other job passed, and it is still not the release's + // evidence. + let without_intel: Vec = green + .iter() + .map(|job| { + job.replace( + "build and non-Lean tests (x86_64-apple-darwin)\tsuccess", + "build and non-Lean tests (x86_64-apple-darwin)\tskipped", + ) + }) + .chain([ + stamp("Intel test construction and local targets", "skipped"), + stamp("Intel conformance (${{ matrix.lane }})", "skipped"), + ]) + .collect(); + assert_ne!(without_intel, green, "the plant skips the Intel context"); // Every job but one leg: only the reading of every leg refuses it. let missing_leg: Vec = green .iter() @@ -4575,6 +4823,11 @@ fn release_gate_decisions() { vec![(head.as_str(), run_line("18"))], &missing_host, ), + ( + "a run without the Intel macOS jobs", + vec![(head.as_str(), run_line("31"))], + &without_intel, + ), ] { let (code, evidence, stderr) = decide(&head, &runs, jobs); assert_eq!(code, 1, "{why}: refused ({stderr})");