interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / tests / gates / run.sh

105 lines · 5565 bytes Raw Blame History
1#!/usr/bin/env bash
2# tests/gates/run.sh: the one entry point for the local verification gates of aien-architecture.
3# Every step runs the SAME command as the hosted job it mirrors (.github/workflows/crumb.yml and
4# qualification-status.yml) or the repository's own offline scripts. Manifests under tests/gates/
5# name this script plus one step word, so no manifest needs shell expansion (ADR 0028 P6).
6set -euo pipefail
7ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
8cd "$ROOT"
9step="${1:?usage: tests/gates/run.sh <step>}"
10obs() { printf 'AIEN-OBS %s %s\n' "$1" "$2"; }
11
12case "$step" in
13 # crumb-verify (gate CRUMB-VERIFY) is retired (DRA-97, 2026-11-07): Crumbs are off the active
14 # workflow, so no gate checks crumb freshness. The crumb tool, its tests (crumb-tool-test below)
15 # and the .crumb files stay.
16 crumb-tool-test)
17 # Hosted crumb.yml step "Build and test the crumb tool".
18 make -C tools/crumb test
19 ;;
20 qualification-status)
21 # Hosted qualification-status.yml checks out aien-spark/omega (default branch, unpinned)
22 # as omega-evidence and runs the script against it. Locally the sibling ../omega plays
23 # that role; its commit is recorded so the receipt says which evidence was read.
24 if [ ! -d ../omega/evidence ]; then
25 echo "run.sh: ../omega is missing; the hosted job checks out aien-dev/omega as omega-evidence" >&2
26 exit 3
27 fi
28 obs sibling_omega_commit "\"$(git -C ../omega rev-parse HEAD 2>/dev/null || echo unknown)\""
29 sh scripts/verify-r16-status.sh ../omega
30 ;;
31 doctrine)
32 # aien-architecture#7 in seeded .om (#316): tools/doctrine/doctrine.om makes every judgment;
33 # gate.sh independently checks the compiler pin before invoking AIEN_OMC; gate.om
34 # repeats the native hash check and runs the checker on $ROOT. NOT_RUN (exit 3) without the
35 # pinned compiler. The retired bash oracle is scripts/check_doctrine.sh before this commit.
36 exec sh tools/doctrine/gate.sh "$ROOT"
37 ;;
38 script-tests)
39 # The offline tests of the repository's own operator scripts. Each builds temporary git
40 # repos and fake gh/crumb tools under mktemp; no network, no auth (see their headers).
41 # The candidate checkers are seeded .om (tools/candidate, #316): their suites and the
42 # byte-for-byte parity corpus compile them with the compiler named by AIEN_OMC, which must
43 # hash as tools/zero-legacy/omega.pin says; otherwise NOT_RUN (exit 3).
44 omc="${AIEN_OMC:-}"
45 if [ -z "$omc" ] || [ ! -x "$omc" ]; then
46 echo "run.sh: AIEN_OMC is not an executable omc (NOT_RUN)" >&2
47 exit 3
48 fi
49 want=$(sed -n 's/^omc_sha256: //p' tools/zero-legacy/omega.pin)
50 have=$(sha256sum "$omc" | cut -d' ' -f1)
51 if [ "$have" != "$want" ]; then
52 echo "run.sh: AIEN_OMC hashes $have, tools/zero-legacy/omega.pin pins $want (NOT_RUN)" >&2
53 exit 3
54 fi
55 export AIEN_OMC="$omc"
56 obs omc_sha256 "\"$have\""
57 build=$(mktemp -d)
58 trap 'rm -rf "$build"' EXIT
59 "$omc" < tools/candidate/check_candidate.om > "$build/check_candidate"
60 "$omc" < tools/candidate/check_pins.om > "$build/check_pins"
61 chmod +x "$build/check_candidate" "$build/check_pins"
62 parity_rc=0
63 bash tools/candidate/parity/run.sh "$build/check_candidate" "$build/check_pins" > "$build/parity.log" || parity_rc=$?
64 cat "$build/parity.log"
65 parity=$(sed -n 's/^parity: //p' "$build/parity.log")
66 obs candidate_parity_identical "${parity%% *}"
67 obs candidate_parity_naming_deltas "$(printf '%s' "$parity" | sed 's/.*identical, \([0-9]*\) exact naming deltas.*/\1/')"
68 obs candidate_parity_limits "$(printf '%s' "$parity" | sed 's/.*deltas, \([0-9]*\) named limits.*/\1/')"
69 obs candidate_parity_different "$(printf '%s' "$parity" | sed 's/.*limits, \([0-9]*\) different$/\1/')"
70 ext=$(sed -n 's/^extensions: //p' "$build/parity.log")
71 obs candidate_extensions_identical "${ext%% *}"
72 obs candidate_extensions_different "$(printf '%s' "$ext" | sed 's/.*identical, \([0-9]*\) different$/\1/')"
73 [ "$parity_rc" -eq 0 ]
74 for t in scripts/test_pr_gate.sh scripts/test_rebase_crumb.sh scripts/test_check_candidate.sh scripts/test_check_candidate_pins.sh; do
75 echo "== $t"
76 bash "$t"
77 done
78 obs script_tests_run 4
79 ;;
80 zero-legacy)
81 # #316: gate.sh independently checks the compiler pin before executing AIEN_OMC.
82 # Fixture judgments and the additional native hash check live in gate.om.
83 # Missing/mismatched compiler remains NOT_RUN (exit 3).
84 exec sh tools/zero-legacy/gate.sh
85 ;;
86 capreg)
87 # The org CUDA capability register (docs/capability-register/): every judgment is made by
88 # tools/capreg/gate.om (seeded .om), which checks AIEN_OMC against tools/zero-legacy/omega.pin,
89 # builds capreg.om, runs its fixtures, verifies register.tsv against REGISTER.md and expects a
90 # planted bad row to be refused. NOT_RUN (exit 3) without the pinned compiler.
91 exec sh tools/capreg/gate.sh
92 ;;
93 name-check)
94 # ADR 0038: tools/name-check/namecheck.om (seeded .om) judges the added lines of the change
95 # (merge base of origin/main, else HEAD~1, to HEAD) for the retired project names; gate.sh
96 # checks AIEN_OMC against tools/zero-legacy/omega.pin and only writes the git diff; gate.om
97 # repeats the hash check, requires its six fixtures to give their recorded output,
98 # then judges the change. NOT_RUN (exit 3) without the pinned compiler.
99 exec sh tools/name-check/gate.sh "$ROOT"
100 ;;
101 *)
102 echo "run.sh: unknown step '$step'" >&2
103 exit 2
104 ;;
105esac