diff --git a/.aien/always b/.aien/always new file mode 100644 index 0000000..eb2f397 --- /dev/null +++ b/.aien/always @@ -0,0 +1,3 @@ +# Gates that run on every commit regardless of changed paths (ADR 0033 Decision 12 +# allow-list; inventory contract C6). One gate name per line. Read from the base ref. +INTERPLANE-NO-PYTHON diff --git a/.aien/unmapped-ok b/.aien/unmapped-ok new file mode 100644 index 0000000..9b49bcf --- /dev/null +++ b/.aien/unmapped-ok @@ -0,0 +1,9 @@ +# Changed paths matching these globs need only the always-run set (.aien/always). +# Everything else must be covered by a manifest's inputs or the commit is NOT_RUN. +# Conservative: the hosted ci.yml jobs have no path filter, so only pure documentation is +# listed. A path a gate reads (bench/PROTOCOL-0.3.md, read by the trust-digest check) is in that +# gate's inputs, and inputs win: the gate is selected. Read from the base ref. +docs/** +*.md +LICENSE +.gitignore diff --git a/.aien/verify.pub b/.aien/verify.pub new file mode 100644 index 0000000..3e65411 --- /dev/null +++ b/.aien/verify.pub @@ -0,0 +1 @@ +01368e0b02dc1113ae7425ad6ab00fdf5aa7dd97e0690745918a52f051d5cf68 diff --git a/.github/workflows/aien-verification.yml b/.github/workflows/aien-verification.yml new file mode 100644 index 0000000..d69f864 --- /dev/null +++ b/.github/workflows/aien-verification.yml @@ -0,0 +1,199 @@ +# AIEN Verification: the GitHub thin gate (ADR 0033 Decision 11, inventory contract C5). +# +# 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 +# aien-dev/aien-receipts; verify the bundle signature and content with the pinned aien-test +# build; run the repository's portable smoke set (gates whose requires is only "portable"). +# +# GitHub-hosted compute: this workflow compiles only the two pinned verifier tools (the crumb +# 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 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: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + verify: + name: AIEN Verification + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + REPO_SLUG: aien-dev/interplane + AIEN_TEST_PIN: c26f4d7ac3156088469b27462390f5b08ef4f436 + RECEIPTS_RAW: https://raw.githubusercontent.com/aien-dev/aien-receipts/main + steps: + - name: Checkout the head under test + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Resolve the commit under test and the base ref + id: ids + run: | + if [ "${{ github.event_name }}" = pull_request ]; then + sha="${{ github.event.pull_request.head.sha }}" + else + sha="${{ github.sha }}" + fi + git fetch -q origin main + echo "sha=$sha" >> "$GITHUB_OUTPUT" + echo "base=$(git rev-parse origin/main)" >> "$GITHUB_OUTPUT" + echo "commit under test: $sha" + echo "base (trust anchors): $(git rev-parse origin/main)" + + - name: "Trust anchors from the base ref (A1: never from the head under test)" + id: anchors + run: | + mkdir -p "$RUNNER_TEMP/anchors" + base="${{ steps.ids.outputs.base }}" + if git show "$base:.aien/verify.pub" > "$RUNNER_TEMP/anchors/verify.pub" 2>/dev/null; then + echo "enrolled=true" >> "$GITHUB_OUTPUT" + git show "$base:.aien/always" > "$RUNNER_TEMP/anchors/always" 2>/dev/null || : > "$RUNNER_TEMP/anchors/always" + git show "$base:.aien/unmapped-ok" > "$RUNNER_TEMP/anchors/unmapped-ok" 2>/dev/null || : > "$RUNNER_TEMP/anchors/unmapped-ok" + echo "verify.pub (base): $(cat "$RUNNER_TEMP/anchors/verify.pub")" + else + echo "enrolled=false" >> "$GITHUB_OUTPUT" + # 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 (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 + + - name: Checkout the pinned crumb tool source (aien-architecture @ d0f0b95d344b4c6628c3d868346932fd247ce168) + uses: actions/checkout@v4 + with: + repository: aien-spark/aien-architecture + ref: d0f0b95d344b4c6628c3d868346932fd247ce168 + path: .crumb-tool-src + + - name: Build the crumb tool, then remove its source from this tree + run: | + make -C .crumb-tool-src/tools/crumb crumb + mkdir -p "$RUNNER_TEMP/bin" && cp .crumb-tool-src/tools/crumb/crumb "$RUNNER_TEMP/bin/crumb" + rm -rf .crumb-tool-src + echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH" + + - name: Crumbs must be exactly what the compiler produces now (stays GitHub-hosted, D11) + run: crumb verify . + + - name: Install Stable Rust Toolchain (for the pinned aien-test build and the smoke set) + if: steps.anchors.outputs.enrolled == 'true' + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: Checkout the pinned aien-test source (aien-sovereign-core @ ${{ env.AIEN_TEST_PIN }}) + if: steps.anchors.outputs.enrolled == 'true' + uses: actions/checkout@v4 + with: + repository: aien-spark/aien-sovereign-core + ref: ${{ env.AIEN_TEST_PIN }} + path: .aien-test-src + + - name: Cache the pinned aien-test build + if: steps.anchors.outputs.enrolled == 'true' + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + .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 + 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"; } + echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH" + rm -rf .aien-test-src + git status --porcelain --untracked-files=normal + + - name: Fetch the signed verification bundle for this commit + id: bundle + run: | + url="$RECEIPTS_RAW/interplane/${{ steps.ids.outputs.sha }}/bundle.json" + echo "bundle url: $url" + if curl -fsSL "$url" -o "$RUNNER_TEMP/bundle.json"; then + echo "present=true" >> "$GITHUB_OUTPUT" + else + echo "present=false" >> "$GITHUB_OUTPUT" + # 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 + if: steps.bundle.outputs.present == 'true' && steps.anchors.outputs.enrolled == 'true' + run: | + required=$(grep -v '^#' "$RUNNER_TEMP/anchors/always" | grep -v '^$' | paste -sd, -) + set +e + aien-test verify-bundle "$RUNNER_TEMP/bundle.json" \ + --repo "github.com/$REPO_SLUG" \ + --commit "${{ steps.ids.outputs.sha }}" \ + --pubkey "$RUNNER_TEMP/anchors/verify.pub" \ + ${required:+--require "$required"} + rc=$? + 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' + run: | + base="${{ steps.ids.outputs.base }}" + names=$(for f in $(git ls-tree -r --name-only "$base" -- tests/gates | grep '\.gate$'); do + git show "$base:$f" | awk ' + /^gate:/ {g=$2} + /^requires:/ {inr=1; next} + inr && /^ - / { if ($2 != "portable") other=1; next } + /^[a-z]/ {inr=0} + END { if (g != "" && !other) print g }' + done) + echo "portable smoke set: $(echo $names)" + mkdir -p "$RUNNER_TEMP/evidence" + fail=0 + for g in $names; do + echo "::group::$g" + if timeout 600 aien-test run "$g" --evidence-dir "$RUNNER_TEMP/evidence"; then echo "$g: PASS"; else echo "::error::$g: not PASS"; fail=1; fi + echo "::endgroup::" + done + exit $fail + + - 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: 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 0000000..a487702 --- /dev/null +++ b/docs/PIPELINE.md @@ -0,0 +1,63 @@ +# 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). Enrollment comes first (step 1: +the gates and trust anchors); the hosted `ci` workflow keeps running on pull requests and pushes +until step 2 retires it to a manual trigger. Each of its jobs is a Spark gate in `tests/gates/` (one `.gate` per job, +same commands, dispatched by `tests/gates/run.sh`). The `qualification` workflow was already manual +(it needs a live model endpoint) and is not a gate. + +## What happens to every pull request + +1. The Spark worker (`aien-test worker --github`, aien-sovereign-core `tools/aien-test`) 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 aien-sovereign-core, every 2 minutes) + checks the bundle against `.aien/verify.pub` on `main` and publishes it to + `aien-dev/aien-receipts` at `interplane//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 on +repositories with a Projects (classic) error): +`gh api -X POST repos/aien-spark/interplane/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 interplane --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: . + +## The AIEN adapter gate and its sibling checkouts + +`INTERPLANE-ADAPTER-AIEN` (hosted job `adapter-aien`) builds `adapters/aien`, which links +aegis-runtime by path at `../../../interplane-audit/aegis-runtime` (and aegis-runtime reaches +`../aien-protocols`), both at the commits in `adapters/aien/PINS`. The Spark worker provides +`../aegis-runtime` and `../aien-protocols` (main, read-only; aien-sovereign-core +`tools/aien-local-ci/siblings`). `tests/gates/run.sh adapter-aien` builds the hosted layout in a +private temp directory (a copy of the commit beside local clones of the two siblings) and runs +the real `adapters/aien/setup-siblings.sh` there, which checks out the PINS commits without the +network. `adapters/aien/Cargo.toml` is unchanged, so a local developer build set up with +`setup-siblings.sh` keeps working. diff --git a/tests/gates/interplane-adapter-aien.gate b/tests/gates/interplane-adapter-aien.gate new file mode 100644 index 0000000..257f46a --- /dev/null +++ b/tests/gates/interplane-adapter-aien.gate @@ -0,0 +1,27 @@ +# tests/gates/interplane-adapter-aien.gate +# Mirrors hosted: ci.yml job adapter-aien (setup-siblings.sh at adapters/aien/PINS, fmt, clippy -D warnings, test, T4 subset). Host: needs siblings ../aegis-runtime and ../aien-protocols +gate: INTERPLANE-ADAPTER-AIEN +manifest_version: 2 +owner: interplane +requires: + - host +inputs: + - rust/ + - provenance/ + - conformance/ + - spec/ + - dialects/ + - bench/ + - examples/ + - adapters/ + - rust-toolchain.toml + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["adapter-aien"] +expects: + exit: 0 + verdict: PASS +timeout: 60m +exactness: EXACT +cache_scope: machine diff --git a/tests/gates/interplane-negative-controls.gate b/tests/gates/interplane-negative-controls.gate new file mode 100644 index 0000000..89bf3a7 --- /dev/null +++ b/tests/gates/interplane-negative-controls.gate @@ -0,0 +1,27 @@ +# tests/gates/interplane-negative-controls.gate +# Mirrors hosted: ci.yml job negative-controls (trust-digest --check, no negctl in pipeline libraries, default build refuses a variant, matrix == conformance/expected/negative-control-matrix.json) +gate: INTERPLANE-NEGATIVE-CONTROLS +manifest_version: 2 +owner: interplane +requires: + - host +inputs: + - rust/ + - provenance/ + - conformance/ + - spec/ + - dialects/ + - bench/ + - examples/ + - adapters/ + - rust-toolchain.toml + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["negative-controls"] +expects: + exit: 0 + verdict: PASS +timeout: 30m +exactness: EXACT +cache_scope: machine diff --git a/tests/gates/interplane-no-python.gate b/tests/gates/interplane-no-python.gate new file mode 100644 index 0000000..7b5bc6e --- /dev/null +++ b/tests/gates/interplane-no-python.gate @@ -0,0 +1,19 @@ +# tests/gates/interplane-no-python.gate +# Mirrors hosted: ci.yml job no-python (no Python file is tracked; Drake's rule 2026-10-15). Portable: reads the tree only (always-run) +gate: INTERPLANE-NO-PYTHON +manifest_version: 2 +owner: interplane +requires: + - portable +inputs: + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["no-python"] +expects: + exit: 0 + observe: ["python_files_found == false"] + verdict: PASS +timeout: 2m +exactness: EXACT +cache_scope: portable diff --git a/tests/gates/interplane-package.gate b/tests/gates/interplane-package.gate new file mode 100644 index 0000000..b56486e --- /dev/null +++ b/tests/gates/interplane-package.gate @@ -0,0 +1,27 @@ +# tests/gates/interplane-package.gate +# Mirrors hosted: ci.yml job package (cargo package --workspace --locked in rust/) +gate: INTERPLANE-PACKAGE +manifest_version: 2 +owner: interplane +requires: + - host +inputs: + - rust/ + - provenance/ + - conformance/ + - spec/ + - dialects/ + - bench/ + - examples/ + - adapters/ + - rust-toolchain.toml + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["package"] +expects: + exit: 0 + verdict: PASS +timeout: 60m +exactness: EXACT +cache_scope: machine diff --git a/tests/gates/interplane-provenance.gate b/tests/gates/interplane-provenance.gate new file mode 100644 index 0000000..aa66b83 --- /dev/null +++ b/tests/gates/interplane-provenance.gate @@ -0,0 +1,21 @@ +# tests/gates/interplane-provenance.gate +# Mirrors hosted: ci.yml job provenance (fmt, clippy --locked -D warnings, test --locked, six CLI fixture verdicts) +gate: INTERPLANE-PROVENANCE +manifest_version: 2 +owner: interplane +requires: + - host +inputs: + - provenance/ + - rust/ + - rust-toolchain.toml + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["provenance"] +expects: + exit: 0 + verdict: PASS +timeout: 30m +exactness: EXACT +cache_scope: machine diff --git a/tests/gates/interplane-rust.gate b/tests/gates/interplane-rust.gate new file mode 100644 index 0000000..fd6e7b1 --- /dev/null +++ b/tests/gates/interplane-rust.gate @@ -0,0 +1,27 @@ +# tests/gates/interplane-rust.gate +# Mirrors hosted: ci.yml job rust (fmt, clippy -D warnings, test --all, negative-controls feature tests, both examples, 106 conformance verdicts == conformance/expected/verdicts.json) +gate: INTERPLANE-RUST +manifest_version: 2 +owner: interplane +requires: + - host +inputs: + - rust/ + - provenance/ + - conformance/ + - spec/ + - dialects/ + - bench/ + - examples/ + - adapters/ + - rust-toolchain.toml + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["rust"] +expects: + exit: 0 + verdict: PASS +timeout: 60m +exactness: EXACT +cache_scope: machine diff --git a/tests/gates/interplane-schemas-and-fixtures.gate b/tests/gates/interplane-schemas-and-fixtures.gate new file mode 100644 index 0000000..258fcf4 --- /dev/null +++ b/tests/gates/interplane-schemas-and-fixtures.gate @@ -0,0 +1,27 @@ +# tests/gates/interplane-schemas-and-fixtures.gate +# Mirrors hosted: ci.yml job schemas-and-fixtures (interplane-corpus schemas, then validate; Rust 1.99.0 from rust-toolchain.toml) +gate: INTERPLANE-SCHEMAS-AND-FIXTURES +manifest_version: 2 +owner: interplane +requires: + - host +inputs: + - rust/ + - provenance/ + - conformance/ + - spec/ + - dialects/ + - bench/ + - examples/ + - adapters/ + - rust-toolchain.toml + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["schemas-and-fixtures"] +expects: + exit: 0 + verdict: PASS +timeout: 30m +exactness: EXACT +cache_scope: machine diff --git a/tests/gates/run.sh b/tests/gates/run.sh new file mode 100755 index 0000000..2b61611 --- /dev/null +++ b/tests/gates/run.sh @@ -0,0 +1,145 @@ +#!/usr/bin/env bash +# tests/gates/run.sh: the one entry point for the local verification gates of interplane. +# Every step runs the SAME commands as the hosted job it mirrors (.github/workflows/ci.yml, jobs +# no-python, schemas-and-fixtures, rust, package, negative-controls, provenance, adapter-aien). +# Manifests under tests/gates/ name this script plus one step word, so no manifest needs shell +# expansion (ADR 0028 P6). Observations print as "AIEN-OBS ". +# +# Two deliberate differences from the hosted runner, neither changes what is checked: +# - Files the hosted job writes beside the checkout (rust-verdicts.json, rust-matrix.json, +# t4-verdicts.json) go to a private temp dir here, so the checkout stays clean while the gates +# of one head run in parallel in it; the cmp against conformance/expected/ is unchanged. +# - Paths into cargo's target dir honour CARGO_TARGET_DIR (the Spark worker sets it). +# +# Sibling checkouts (adapter-aien): the hosted job runs adapters/aien/setup-siblings.sh, which +# clones aegis-runtime and aien-protocols at the commits in adapters/aien/PINS into +# /interplane-audit/, where adapters/aien/Cargo.toml expects them +# (../../../interplane-audit/aegis-runtime). The Spark worker provides ../aegis-runtime and +# ../aien-protocols (main, read-only) and the run directory is not writable, so this step builds +# the hosted layout in a private temp dir: a copy of this commit at /interplane and local +# clones of the two siblings (no network) at /interplane-audit, then runs the real +# setup-siblings.sh there, which checks out the PINS commits and checks the Cargo.toml revs. +set -euo pipefail +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +cd "$ROOT" +step="${1:?usage: tests/gates/run.sh }" +obs() { printf 'AIEN-OBS %s %s\n' "$1" "$2"; } +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT +export CARGO_TERM_COLOR=never +TARGET="${CARGO_TARGET_DIR:-$ROOT/rust/target}" + +need_sibling() { + local name="$1" + if [ ! -d "../$name" ]; then + echo "run.sh: ../$name is missing; the hosted job clones aien-dev/$name at adapters/aien/PINS" >&2 + exit 3 + fi + obs "sibling_${name//-/_}_commit" "\"$(git -C "../$name" rev-parse HEAD 2>/dev/null || echo unknown)\"" +} + +case "$step" in + no-python) + # Hosted ci.yml job no-python (project rule, Drake 2026-10-15: no Python ships here). + found=$(git ls-files -- ':(glob)**/*.py' ':(glob)**/*.pyi' ':(glob)**/*.pyx' ':(glob)**/*.ipynb' \ + ':(glob)**/pyproject.toml' ':(glob)**/requirements*.txt' ':(glob)**/setup.py' ':(glob)**/setup.cfg' \ + ':(glob)**/Pipfile' ':(glob)**/Pipfile.lock') + # Scripts without a .py ending: a first line that runs Python. + shebang=$(git ls-files -z | xargs -0 -r awk 'FNR == 1 { if ($0 ~ /^#!.*python/) print FILENAME; nextfile }') + found=$(printf '%s\n%s\n' "$found" "$shebang" | sed '/^$/d') + if [ -n "$found" ]; then + printf 'Python files are tracked; this repository ships no Python:\n%s\n' "$found" + obs python_files_found true + exit 1 + fi + obs python_files_found false + ;; + schemas-and-fixtures) + cd rust + cargo run -q --locked -p interplane-conformance --bin interplane-corpus -- schemas + cargo run -q --locked -p interplane-conformance --bin interplane-corpus -- validate + ;; + rust) + cd rust + cargo fmt --all --check + cargo clippy --all-targets --all-features -- -D warnings + cargo test --all + # negative controls (test-only feature) detect their defects + cargo test -p interplane-conformance --features negative-controls + # both examples run offline and check their own story (exit 1 on any difference) + cargo run -q -p interplane-crossveil --example offline + cargo run -q -p interplane-crossveil --example todo_adapter + # conformance verdicts equal the recorded reference (106 cases) + cargo run -q --locked -p interplane-conformance --bin interplane-conformance -- ../conformance/fixtures --out "$tmp/rust-verdicts.json" + cmp "$tmp/rust-verdicts.json" ../conformance/expected/verdicts.json + test "$(jq length "$tmp/rust-verdicts.json")" = 106 + obs conformance_cases 106 + ;; + package) + # Release check: every crate packages and builds from its .crate alone. + cd rust + cargo package --workspace --locked + ;; + negative-controls) + # trust corpus and protocol digests match conformance/TRUST-DIGEST.txt + (cd rust && cargo run -q --locked -p interplane-conformance --bin interplane-corpus -- trust-digest --check) + # pipeline libraries never mention the negative controls ("if", because set -e ignores a "!" command) + if grep -rIl -E 'negctl|negative-controls|NEGCTL' rust/crates/interplane-core rust/crates/interplane-crossveil rust/crates/interplane-crossaxis rust/crates/interplane-lenshift; then + echo "run.sh: a pipeline library mentions the negative controls" >&2; exit 1 + fi + # default build refuses a variant and carries no variant code + ( + cd rust + cargo build -q -p interplane-conformance + if grep -q NEGCTL_BUILT_IN "$TARGET/debug/interplane-conformance"; then + echo "run.sh: the default build carries variant code" >&2; exit 1 + fi + rc=0; "$TARGET/debug/interplane-conformance" ../conformance/fixtures --out /dev/null --variant V4 || rc=$? + test "$rc" = 2 + ) + # negative-control matrix, offline, equals the recorded reference (every variant must be detected) + (cd rust && cargo run -q -p interplane-conformance --bin interplane-conformance --features negative-controls -- ../conformance/fixtures --matrix "$tmp/rust-matrix.json") + cmp "$tmp/rust-matrix.json" conformance/expected/negative-control-matrix.json + ;; + provenance) + cd provenance + cargo fmt --all --check + cargo clippy --locked --all-targets -- -D warnings + cargo test --locked + # fixture verdicts from the CLI + test "$(cargo run -q --locked -- verify fixtures/synthetic-full-chain)" = "PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong proposal=scripted_turn" + test "$(cargo run -q --locked -- verify fixtures/synthetic-fix-the-test)" = "PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong proposal=scripted_turn" + test "$(cargo run -q --locked -- verify fixtures/synthetic-weak-receipt)" = "PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=record_effect_receipt/1:weak" + test "$(cargo run -q --locked -- verify fixtures/real-waldo-aien-chain)" = "PASS complete effect=aien-ledger-slice/1:strong proposal=model_generation/2 candidate=none" + test "$(cargo run -q --locked -- verify fixtures/real-waldo-tokenizer-json)" = "PASS_LABELLED_INCOMPLETE missing=link:effect,link:interplane" + test "$(cargo run -q --locked -- verify fixtures/real-waldo-smoke)" = "PASS_LABELLED_INCOMPLETE missing=link:aien,link:effect,link:interplane" + ;; + adapter-aien) + need_sibling aegis-runtime + need_sibling aien-protocols + # The hosted layout, built privately: /interplane (this commit) beside /interplane-audit. + mkdir -p "$tmp/interplane" "$tmp/interplane-audit" + git archive HEAD | tar -x -C "$tmp/interplane" + for sib in aegis-runtime aien-protocols; do + git clone -q --no-checkout "../$sib" "$tmp/interplane-audit/$sib" + done + # The real hosted setup step: checks out the PINS commits (already in the siblings' history, + # no network) and checks that the Cargo.toml git revs equal PINS. + "$tmp/interplane/adapters/aien/setup-siblings.sh" "$tmp" + . "$tmp/interplane/adapters/aien/PINS" + test "$(git -C "$tmp/interplane-audit/aegis-runtime" rev-parse HEAD)" = "$AEGIS_RUNTIME_REV" + test "$(git -C "$tmp/interplane-audit/aien-protocols" rev-parse HEAD)" = "$AIEN_PROTOCOLS_REV" + obs aegis_runtime_pin "\"$AEGIS_RUNTIME_REV\"" + obs aien_protocols_pin "\"$AIEN_PROTOCOLS_REV\"" + cd "$tmp/interplane/adapters/aien" + cargo fmt --all --check + cargo clippy --all-targets -- -D warnings + cargo test + # T4 subset through the real Pipeline and AIEN authority (bench/PROTOCOL-0.3.md section 2; no skips) + T4_OUT="$tmp/t4-verdicts.json" cargo test --test t4_corpus -- --nocapture + ;; + *) + echo "run.sh: unknown step '$step'" >&2 + exit 2 + ;; +esac