From bdef41ec61d4175bb66ff95b5b94df559a238731 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 16 Oct 2026 03:49:39 -0500 Subject: [PATCH 1/2] ci(aien-verification): phase 3, the Spark bundle is the test verdict ADR 0033 phase 3 for aien-sovereign-core, copied from the aienos phase-3 workflow: - a base ref without .aien/verify.pub fails (exit 1); - a missing bundle is NOT_RUN (::error::, exit 2) until the pipeline reruns the check; - a trust-surface head passes only when the verified bundle's signed plan has blocked == null (an operator run); the portable smoke set is skipped for such heads; - the pinned aien-test source is built outside the tree under test. Gates for the hosted job "Workspace Verification & Invariant Audit": - new SC-NO-PYTHON (scripts/check-no-python.sh), portable, always-run; - inputs widened to what the scripts read: SC-INSTALL (install.sh, Cargo.lock), SC-RELEASE-GATE-NEGATIVES (install.sh, docs/release/, Cargo.lock, omega.lock), SC-AIEN-VERIFY-TESTS (docs/campaigns/whole-system-e2e/), SC-SCORING-V5 (docs/campaigns/next-phase-2/), SC-STRICT-MODE (crates/, rust-toolchain.toml: its path dependencies reach many crates). docs/PIPELINE.md: how a pull request is tested and merged, and the step-to-gate map. Co-Authored-By: Claude Opus 5.5 --- .aien/always | 1 + .github/workflows/aien-verification.yml | 59 +++++++++++++-------- docs/PIPELINE.md | 60 ++++++++++++++++++++++ tests/gates/run.sh | 1 + tests/gates/sc-aien-verify-tests.gate | 1 + tests/gates/sc-install.gate | 2 + tests/gates/sc-no-python.gate | 21 ++++++++ tests/gates/sc-release-gate-negatives.gate | 4 ++ tests/gates/sc-scoring-v5.gate | 1 + tests/gates/sc-strict-mode.gate | 4 +- 10 files changed, 132 insertions(+), 22 deletions(-) create mode 100644 docs/PIPELINE.md create mode 100644 tests/gates/sc-no-python.gate diff --git a/.aien/always b/.aien/always index ed58dc1a..cd1bdde1 100644 --- a/.aien/always +++ b/.aien/always @@ -4,3 +4,4 @@ CRUMB-VERIFY SC-ZERO-CUDA SC-ZERO-DISK-SECRETS SC-ANTI-SLOP +SC-NO-PYTHON diff --git a/.github/workflows/aien-verification.yml b/.github/workflows/aien-verification.yml index 95e19a7f..0bc8f337 100644 --- a/.github/workflows/aien-verification.yml +++ b/.github/workflows/aien-verification.yml @@ -1,9 +1,10 @@ # AIEN Verification: the GitHub thin gate (ADR 0033 Decision 11, inventory contract C5). # -# PHASE 2 DRAFT (2026-10-11, lane REPOS). This workflow is NOT a required check yet. It runs -# beside the existing hosted workflows so that, for N >= 3 commits, the hosted verdict and the -# locally signed bundle verdict can be compared (advisor amendment A7). Nothing here changes -# the repository's required contexts; that switch is phase 3 and needs Drake's agreement. +# PHASE 3 (2026-10-16, Drake's agreement 2026-10-15: "the Spark becomes the only test judge"). +# This is a required check. The Spark worker (aien-test worker) runs the tests and signs a +# bundle; tools/aien-local-ci/pipeline.sh in aien-sovereign-core publishes it to aien-receipts +# and reruns this workflow once it is there. A missing bundle fails this check (NOT_RUN) until +# the rerun. Pull requests labeled ready-to-merge are merged by the pipeline (docs/PIPELINE.md). # # What it does: checkout; read the trust anchors from the BASE ref (origin/main), never from # the head under test (amendment A1); crumb verify; fetch //bundle.json from @@ -14,9 +15,9 @@ # checker, and aien-test once the repository is enrolled). It never builds or tests this # repository's own code; the portable smoke set is text scans and format checks only. # -# PHASE 3 FLIPS (marked "PHASE3" below): a missing bundle becomes NOT_RUN (status pending with -# a retry window) instead of a neutral note, and a trust-surface change becomes a failure -# unless the operator ran it by hand (BLOCKED_OPERATOR). +# PHASE 3 rules (marked "PHASE3" below): a missing bundle is NOT_RUN (this check fails; the +# pipeline reruns it after publication), and a trust-surface change fails unless the verified +# bundle's signed plan shows the operator ran it by hand (plan.blocked == null). name: AIEN Verification on: @@ -68,14 +69,16 @@ jobs: echo "verify.pub (base): $(cat "$RUNNER_TEMP/anchors/verify.pub")" else echo "enrolled=false" >> "$GITHUB_OUTPUT" - echo "::notice::.aien/verify.pub is not on the base ref yet: this repository is not enrolled. Phase 2: neutral." + # PHASE3: an enrolled repository whose base ref lost its key cannot verify anything. + echo "::error::.aien/verify.pub is not on the base ref: no trusted key, nothing can be verified." + exit 1 fi # Trust-surface changes are run by the operator by hand (A1): BLOCKED_OPERATOR. changed=$(git diff --name-only "$base...${{ steps.ids.outputs.sha }}" -- .aien tests/gates .github/workflows .forgejo tools/aien-test || true) if [ -n "$changed" ]; then echo "blocked=true" >> "$GITHUB_OUTPUT" - echo "::notice::BLOCKED_OPERATOR: this head changes the trust surface:"; echo "$changed" - # PHASE3: fail here unless an operator attestation for this sha is present. + echo "::notice::BLOCKED_OPERATOR: this head changes the trust surface (the bundle must show an operator run):"; echo "$changed" + # PHASE3: enforced in the verify step: the verified bundle's signed plan must say blocked == null. else echo "blocked=false" >> "$GITHUB_OUTPUT" fi @@ -111,6 +114,12 @@ jobs: ref: ${{ env.AIEN_TEST_PIN }} path: .aien-test-src + - name: Move the pinned source out of the tree under test + if: steps.anchors.outputs.enrolled == 'true' + # cargo reads .cargo/config.toml from the working directory upward, and the build of the + # verifier must never be configurable by the head under test (it could add one). + run: mv .aien-test-src "$RUNNER_TEMP/aien-test-src" + - name: Cache the pinned aien-test build if: steps.anchors.outputs.enrolled == 'true' uses: actions/cache@v4 @@ -118,16 +127,16 @@ jobs: path: | ~/.cargo/registry ~/.cargo/git - .aien-test-src/target + ${{ runner.temp }}/aien-test-src/target key: aien-test-${{ runner.os }}-${{ env.AIEN_TEST_PIN }} - - name: Build aien-test from the pin (never from the tree under test), then remove the source + - name: Build aien-test from the pin outside the tree under test (the target dir stays for the cache) if: steps.anchors.outputs.enrolled == 'true' run: | - cargo build --release -p aien-test --manifest-path .aien-test-src/Cargo.toml - cp .aien-test-src/target/release/aien-test "$RUNNER_TEMP/bin/aien-test" 2>/dev/null || { mkdir -p "$RUNNER_TEMP/bin"; cp .aien-test-src/target/release/aien-test "$RUNNER_TEMP/bin/aien-test"; } + cd "$RUNNER_TEMP/aien-test-src" && cargo build --release -p aien-test + mkdir -p "$RUNNER_TEMP/bin" && cp "$RUNNER_TEMP/aien-test-src/target/release/aien-test" "$RUNNER_TEMP/bin/aien-test" echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH" - rm -rf .aien-test-src + cd "$GITHUB_WORKSPACE" git status --porcelain --untracked-files=normal - name: Fetch the signed verification bundle for this commit @@ -139,8 +148,9 @@ jobs: echo "present=true" >> "$GITHUB_OUTPUT" else echo "present=false" >> "$GITHUB_OUTPUT" - echo "::notice::bundle not published yet for ${{ steps.ids.outputs.sha }} (phase 2: neutral)." - # PHASE3: exit 2 here (NOT_RUN, status pending with a retry window) instead of a neutral note. + # PHASE3: NOT_RUN. The Spark pipeline reruns this workflow after it publishes the bundle. + echo "::error::NOT_RUN: no signed Spark bundle for ${{ steps.ids.outputs.sha }} yet. The Spark pipeline reruns this check once the bundle is published." + exit 2 fi - name: Verify the bundle with the base-ref public key @@ -157,6 +167,15 @@ jobs: set -e echo "verify-bundle exit $rc (0 PASS, 1 FAIL, 2 NOT_RUN, 3 REJECTED)" [ "$rc" = 0 ] || exit "$rc" + # PHASE3: a trust-surface head passes only on an operator run: the plan member is inside + # the signed bytes just verified, and only an operator run of such a head has blocked == null. + if [ "${{ steps.anchors.outputs.blocked }}" = true ]; then + if jq -e '.plan.blocked == null' "$RUNNER_TEMP/bundle.json" >/dev/null; then + echo "trust-surface change: the signed bundle shows an operator run (plan.blocked == null)" + else + echo "::error::BLOCKED_OPERATOR: this head changes the trust surface and the bundle is not from an operator run"; exit 1 + fi + fi - name: Portable smoke set (gates whose requires is only portable, named at the base ref) if: steps.anchors.outputs.enrolled == 'true' && steps.anchors.outputs.blocked == 'false' @@ -180,7 +199,7 @@ jobs: done exit $fail - - name: "Not enrolled or blocked: nothing to verify in this phase" - if: steps.anchors.outputs.enrolled != 'true' || steps.anchors.outputs.blocked == 'true' + - name: "Trust-surface change: the portable smoke set is skipped (the operator ran this head on the Spark)" + if: steps.anchors.outputs.blocked == 'true' run: | - echo "AIEN Verification: neutral (enrolled=${{ steps.anchors.outputs.enrolled }}, blocked=${{ steps.anchors.outputs.blocked }}). PHASE3 turns this into a failure." + echo "AIEN Verification: trust-surface head, accepted on the verified operator-run bundle above." diff --git a/docs/PIPELINE.md b/docs/PIPELINE.md new file mode 100644 index 00000000..c33a5001 --- /dev/null +++ b/docs/PIPELINE.md @@ -0,0 +1,60 @@ +# The Spark pipeline: how a pull request gets tested and merged + +Since 2026-10-16 the DGX Spark is the only test judge for this repository (ADR 0033 Decision 11, +phase 3, agreed by Drake on 2026-10-15). GitHub's heavy test jobs are retired one by one as a +Spark gate is proven to cover each of them. + +## What happens to every pull request + +1. The Spark worker (`aien-test worker --github`, built from `tools/aien-test` in this repository) sees the + new head, runs the gates in `tests/gates/` that the change touches plus `.aien/always`, inside + the Spark sandbox, and signs a bundle with the Spark key. It posts the commit status + `AIEN Verification (Spark)`. +2. The pipeline (`tools/aien-local-ci/pipeline.sh` in this repository, every 2 minutes) + checks the bundle against `.aien/verify.pub` on `main` and publishes it to + `aien-dev/aien-receipts` at `aien-sovereign-core//bundle.json`. +3. It then reruns the `AIEN Verification` workflow on that head. That workflow downloads the + bundle and verifies it on GitHub. Until the bundle is published the check is red with + `NOT_RUN`; that is expected and clears on the rerun. + +## How to get a pull request merged + +Add the label **`ready-to-merge`** when the pull request is finished. The pipeline merges it +(merge commit) only when all of these hold for the current head: + +- the label is exactly `ready-to-merge` and the pull request is not a draft; +- the Spark bundle for that head verifies as PASS, including every gate in `.aien/always`; +- the published copy in aien-receipts is byte-identical to the Spark's copy; +- every required check on `main` is green on that head, and no `AIEN Verification` run is pending. + +Pushing a new commit moves the head; the pipeline tests the new head before it merges anything. +Without the label nothing is merged. Remove the label to stop a merge. + +To add the label from a terminal use the REST call (`gh pr edit --add-label` can fail with a +Projects (classic) error, as it does on aienos): +`gh api -X POST repos/aien-dev/aien-sovereign-core/issues//labels -f 'labels[]=ready-to-merge'`. + +## Changes to the pipeline itself + +A head that changes `.aien/`, `tests/gates/`, `.github/workflows/`, `.forgejo/` or +`tools/aien-test/` is `BLOCKED_OPERATOR`: the worker does not run it on its own. The operator runs +it by hand on the Spark (`aien-local-ci once aien-sovereign-core --operator`); the signed bundle then +records the operator run and the checks pass. + +## Where to look + +- Spark state: `aien-local-ci status`, journal `~/.local/state/aien-local-ci/journal.jsonl`, + pipeline journal `~/.local/state/aien-local-ci/pipeline.jsonl`. +- Published bundles: . + +## Which gate covers which hosted step + +Each manifest in `tests/gates/` names, in its `Mirrors hosted:` line, the hosted step it replaces; +`tests/gates/run.sh` runs the same command. The heavy hosted job `Workspace Verification & +Invariant Audit` (`.github/workflows/ci.yml`, job `verify`) is covered step by step: +SC-NO-PYTHON, SC-FMT, SC-RELEASE-GATE-NEGATIVES (five release scripts), SC-AIEN-VERIFY-TESTS, +SC-PINS-SELFTEST, SC-NATIVE-IDENTITY, SC-INSTALL, SC-SCORING-V5, SC-CHECK, SC-CLIPPY, SC-TEST, +SC-STRICT-MODE, SC-ZERO-CUDA, SC-PREFLIGHT-GUARD, SC-AGENT-PREFLIGHT, SC-ZERO-DISK-SECRETS and +SC-ANTI-SLOP. Known gap: `scripts/agent-preflight.sh` scans the whole tree (secret-looking files, +dashes in the diff), but SC-AGENT-PREFLIGHT runs only when its listed inputs change and is not in +`.aien/always`, so a commit touching only other paths skips that scan. diff --git a/tests/gates/run.sh b/tests/gates/run.sh index 3514e894..c9033a30 100755 --- a/tests/gates/run.sh +++ b/tests/gates/run.sh @@ -57,6 +57,7 @@ pin() { # pin case "$step" in crumb-verify) "${CRUMB:-crumb}" verify . ;; # ci.yml job verify ("Workspace Verification & Invariant Audit") + no-python) sh scripts/check-no-python.sh ;; fmt) cargo fmt --all -- --check ;; release-gate-negatives) bash scripts/test-install-release.sh diff --git a/tests/gates/sc-aien-verify-tests.gate b/tests/gates/sc-aien-verify-tests.gate index e98ca012..4195a99a 100644 --- a/tests/gates/sc-aien-verify-tests.gate +++ b/tests/gates/sc-aien-verify-tests.gate @@ -7,6 +7,7 @@ requires: - host inputs: - tools/aien-verify/ + - docs/campaigns/whole-system-e2e/ - tests/gates/ run: exec: tests/gates/run.sh diff --git a/tests/gates/sc-install.gate b/tests/gates/sc-install.gate index c23f26ff..7ee9a6a8 100644 --- a/tests/gates/sc-install.gate +++ b/tests/gates/sc-install.gate @@ -7,6 +7,8 @@ requires: - host inputs: - scripts/ + - install.sh + - Cargo.lock - tests/gates/ run: exec: tests/gates/run.sh diff --git a/tests/gates/sc-no-python.gate b/tests/gates/sc-no-python.gate new file mode 100644 index 00000000..c150c240 --- /dev/null +++ b/tests/gates/sc-no-python.gate @@ -0,0 +1,21 @@ +# tests/gates/sc-no-python.gate +# Mirrors hosted: ci.yml verify 'No Python guard (fails if any Python file is tracked)': sh scripts/check-no-python.sh (always-run) +# Always-run because the guard scans every tracked file, so no input list can name what it reads. +gate: SC-NO-PYTHON +manifest_version: 2 +owner: aien-sovereign-core +requires: + - portable +inputs: + - scripts/check-no-python.sh + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["no-python"] +expects: + exit: 0 + verdict: PASS +timeout: 2m +exactness: EXACT +cache_scope: portable +cache: never diff --git a/tests/gates/sc-release-gate-negatives.gate b/tests/gates/sc-release-gate-negatives.gate index 8ba67a2d..1050aac7 100644 --- a/tests/gates/sc-release-gate-negatives.gate +++ b/tests/gates/sc-release-gate-negatives.gate @@ -9,6 +9,10 @@ inputs: - scripts/ - tools/ - release/ + - install.sh + - docs/release/ + - Cargo.lock + - omega.lock - tests/gates/ run: exec: tests/gates/run.sh diff --git a/tests/gates/sc-scoring-v5.gate b/tests/gates/sc-scoring-v5.gate index 351f227a..4e48ec89 100644 --- a/tests/gates/sc-scoring-v5.gate +++ b/tests/gates/sc-scoring-v5.gate @@ -7,6 +7,7 @@ requires: - portable inputs: - docs/campaigns/scoring/ + - docs/campaigns/next-phase-2/ - tests/gates/ run: exec: tests/gates/run.sh diff --git a/tests/gates/sc-strict-mode.gate b/tests/gates/sc-strict-mode.gate index 12fdbd5f..b8192c3b 100644 --- a/tests/gates/sc-strict-mode.gate +++ b/tests/gates/sc-strict-mode.gate @@ -8,8 +8,8 @@ requires: inputs: - Cargo.toml - Cargo.lock - - crates/aien-inference-abi/ - - crates/aien-inference-runtime/ + - rust-toolchain.toml + - crates/ - tests/gates/ run: exec: tests/gates/run.sh From c099f4e1168731bf91c6dfa2105c6fd4d581e9f3 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 16 Oct 2026 15:31:53 -0500 Subject: [PATCH 2/2] crumb: recompile after rebase onto main Co-Authored-By: Claude Opus 5.5 --- .crumb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.crumb b/.crumb index f1d77dbe..527b1f19 100644 --- a/.crumb +++ b/.crumb @@ -119,14 +119,14 @@ } ], "children_root": "sha256:7d8cf5937a13dd896fe511aee80a0873f4917a0a5eb07cbe0fe3690c0c878cbb", - "compiled_at": "2026-10-16T15:26:31Z", + "compiled_at": "2026-10-16T20:31:53Z", "compiler": "crumb-compile/1", - "digest": "sha256:5c3262fb97f4051b7780f820f039da497a16ac9d1cf8d077e593d3b2e786ba89", + "digest": "sha256:1446b16f7b8dec18219ac57a350c6e567bfde706af6838c2fb6d9b4f2ffd8d02", "evidence_files": 1578, "evidence_root": "sha256:135e27a1a0704c4a8371cd2c1eb555f2b5beec61c212949b029a5457418a7160", - "files": 5889, - "generated_at_commit": "228809d2f65ded6e8bbc011bc817209d82255bb5", - "source_tree": "sha256:7bdcd0cf99ffd24054c17de9287bf4506d8059c855d566eab42a2280024ec2a2" + "files": 5891, + "generated_at_commit": "bdef41ec61d4175bb66ff95b5b94df559a238731", + "source_tree": "sha256:c132aebdb9fb0c285f601f1d52a23823c1d400fb1984d1b54f01d8de99b18983" } }, "history": [],