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 / .github / workflows / aien-verification.yml

282 lines · 13176 bytes Raw Blame History
1# AIEN: GitHub-hosted checks and Alpha verification (ADR 0033 Decision 11, inventory contract C5).
2#
3# Drake 2026-10-24: nothing on GitHub gates a merge; main requires no status check. The Spark
4# qualifies Alpha builds instead: the local pipeline pushes annotated tags alpha/YYYYMMDD.N.
5# AIEN Checks (pull_request, push to main): advisory. For enrolled repos (.aien/verify.pub on
6# origin/main) the portable smoke set named at origin/main. No crumb step: Crumbs are retired
7# from the active workflow (DRA-97, 2026-11-07).
8# AIEN Pinned-omc Gates (pull_request, push to main): advisory. On a hosted AArch64 runner, births
9# the omc pinned in tools/zero-legacy/omega.pin from seed-0 and runs the host gates that need only
10# that compiler: ARCH-CAPABILITY-REGISTER, ARCH-DOCTRINE, ARCH-ZERO-LEGACY-CLOSURE and
11# ARCH-SCRIPT-TESTS (#363).
12# AIEN Alpha (push of an alpha/* tag): the tagged commit must be on main; its signed Spark bundle
13# from aien-receipts must verify (--require-full) against the trust anchors on origin/main.
14# GitHub-hosted compute builds only the pinned verifier tools, never this repository's code, with one
15# exception that is a checker, not shipped code: the seeded .om checkers that the
16# pinned omc compiles in the pinned-omc job. That omc is born from seed-0 with no C toolchain, and every
17# gate refuses it unless it hashes as omega.pin says.
18name: AIEN
19
20on:
21 pull_request:
22 push:
23 branches: [main]
24 tags: ['alpha/*']
25
26permissions:
27 contents: read
28
29jobs:
30 checks:
31 name: AIEN Checks
32 if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
33 runs-on: ubuntu-latest
34 timeout-minutes: 30
35 env:
36 REPO_SLUG: aien-dev/aien-architecture
37 AIEN_TEST_PIN: a51042b61b87355c0850ef82ba409a46e153a1ff
38 RECEIPTS_RAW: https://raw.githubusercontent.com/aien-dev/aien-receipts/main
39 steps:
40 - name: Checkout the head under test
41 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
42 with:
43 fetch-depth: 0
44
45 - name: Resolve the base ref
46 id: ids
47 run: |
48 git fetch -q origin main
49 echo "base=$(git rev-parse origin/main)" >> "$GITHUB_OUTPUT"
50 echo "base (trust anchors): $(git rev-parse origin/main)"
51
52 - name: "Enrollment from the base ref (never from the head under test)"
53 id: anchors
54 run: |
55 if git cat-file -e "${{ steps.ids.outputs.base }}:.aien/verify.pub" 2>/dev/null; then
56 echo "enrolled=true" >> "$GITHUB_OUTPUT"
57 else
58 echo "enrolled=false" >> "$GITHUB_OUTPUT"
59 echo "not enrolled: no .aien/verify.pub on the base ref; the portable smoke set is skipped"
60 fi
61
62 - name: Install Stable Rust Toolchain (for the pinned aien-test build)
63 uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable branch head 2026-10-26
64 if: steps.anchors.outputs.enrolled == 'true'
65 with:
66 components: rustfmt
67
68 - name: Checkout the pinned aien-test source (aien-sovereign-core @ ${{ env.AIEN_TEST_PIN }})
69 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
70 if: steps.anchors.outputs.enrolled == 'true'
71 with:
72 repository: aien-dev/aien-sovereign-core-mv
73 ref: ${{ env.AIEN_TEST_PIN }}
74 path: .aien-test-src
75 - name: Move pinned verifier source outside the candidate tree
76 if: steps.anchors.outputs.enrolled == 'true'
77 # Cargo reads .cargo/config.toml from CWD and its ancestors, even with --manifest-path.
78 run: mv .aien-test-src "$RUNNER_TEMP/aien-test-src"
79
80 - name: Cache the pinned aien-test build
81 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
82 if: steps.anchors.outputs.enrolled == 'true'
83 with:
84 path: |
85 ~/.cargo/registry
86 ~/.cargo/git
87 key: aien-test-${{ runner.os }}-${{ env.AIEN_TEST_PIN }}-isolated-v1
88
89 - name: Build aien-test from the pin outside the candidate tree
90 if: steps.anchors.outputs.enrolled == 'true'
91 run: |
92 cd "$RUNNER_TEMP/aien-test-src"
93 cargo build --release -p aien-test --target-dir "$RUNNER_TEMP/aien-test-target"
94 mkdir -p "$RUNNER_TEMP/bin" && cp "$RUNNER_TEMP/aien-test-target/release/aien-test" "$RUNNER_TEMP/bin/aien-test"
95 echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
96 rm -rf "$RUNNER_TEMP/aien-test-src"
97 cd "$GITHUB_WORKSPACE"
98 git status --porcelain --untracked-files=normal
99
100 # ARCH-DOCTRINE and the other gates that need the pinned AArch64 omc are `requires: host`, so
101 # they stay out of this set; the pinned-omc job below runs them on an AArch64 runner.
102 - name: Portable smoke set (gates whose requires is only portable, named at the base ref)
103 if: steps.anchors.outputs.enrolled == 'true'
104 run: |
105 base="${{ steps.ids.outputs.base }}"
106 names=$(for f in $(git ls-tree -r --name-only "$base" -- tests/gates | grep '\.gate$'); do
107 git show "$base:$f" | awk '
108 /^gate:/ {g=$2}
109 /^requires:/ {inr=1; next}
110 inr && /^ - / { if ($2 != "portable") other=1; next }
111 /^[a-z]/ {inr=0}
112 END { if (g != "" && !other) print g }'
113 done)
114 echo "portable smoke set: $(echo $names)"
115 mkdir -p "$RUNNER_TEMP/evidence"
116 fail=0
117 for g in $names; do
118 echo "::group::$g"
119 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
120 echo "::endgroup::"
121 done
122 exit $fail
123
124 pinned-omc-gates:
125 name: AIEN Pinned-omc Gates
126 if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
127 # The seed chain and omc write AArch64 Linux ELF, so this job needs an arm64 runner.
128 runs-on: ubuntu-24.04-arm
129 timeout-minutes: 20
130 steps:
131 - name: Checkout the head under test
132 uses: actions/checkout@v7
133
134 # The pin is read from the head under test because the gates check AIEN_OMC against that same
135 # file; a PR that moves the pin is tested with the compiler it names.
136 - name: Read the compiler pin (tools/zero-legacy/omega.pin)
137 id: pin
138 run: |
139 pin=tools/zero-legacy/omega.pin
140 repo=$(sed -n 's|^repo: .*github\.com[:/]\(.*\)\.git$|\1|p' "$pin")
141 commit=$(sed -n 's/^commit: //p' "$pin")
142 omc_sha256=$(sed -n 's/^omc_sha256: //p' "$pin")
143 printf '%s' "$commit" | grep -Eqx '[0-9a-f]{40}' || { echo "::error::$pin: commit is not 40 hex"; exit 1; }
144 printf '%s' "$omc_sha256" | grep -Eqx '[0-9a-f]{64}' || { echo "::error::$pin: omc_sha256 is not 64 hex"; exit 1; }
145 [ -n "$repo" ] || { echo "::error::$pin: no github.com repo"; exit 1; }
146 echo "repo=$repo" >> "$GITHUB_OUTPUT"
147 echo "commit=$commit" >> "$GITHUB_OUTPUT"
148 echo "omc_sha256=$omc_sha256" >> "$GITHUB_OUTPUT"
149 echo "omc pin: $repo@$commit, omc sha256 $omc_sha256"
150
151 - name: Checkout the pinned Omega seed (${{ steps.pin.outputs.repo }} @ ${{ steps.pin.outputs.commit }})
152 uses: actions/checkout@v7
153 with:
154 repository: ${{ steps.pin.outputs.repo }}
155 ref: ${{ steps.pin.outputs.commit }}
156 path: .omega-seed
157
158 - name: Birth omc from seed-0 outside the candidate tree and check its hash
159 run: |
160 mv .omega-seed "$RUNNER_TEMP/omega-seed"
161 cd "$RUNNER_TEMP/omega-seed"
162 sh seed/omega-from-seed.sh
163 have=$(sha256sum seed/out/omc | cut -d' ' -f1)
164 if [ "$have" != "${{ steps.pin.outputs.omc_sha256 }}" ]; then
165 echo "::error::seed-born omc hashes $have, omega.pin pins ${{ steps.pin.outputs.omc_sha256 }}"
166 exit 1
167 fi
168 echo "AIEN_OMC=$RUNNER_TEMP/omega-seed/seed/out/omc" >> "$GITHUB_ENV"
169 cd "$GITHUB_WORKSPACE"
170 git status --porcelain --untracked-files=normal
171
172 # Each step is the `run:` of its manifest under tests/gates/. Exit 3 is NOT_RUN and fails
173 # this job, since the pinned compiler is present here.
174 - name: Host gates that need only the pinned omc
175 run: |
176 fail=0
177 for step in capreg doctrine zero-legacy script-tests; do
178 echo "::group::run.sh $step"
179 rc=0
180 timeout 600 bash tests/gates/run.sh "$step" || rc=$?
181 echo "::endgroup::"
182 if [ "$rc" -eq 0 ]; then echo "$step: PASS"; else echo "::error::$step: exit $rc, not PASS"; fail=1; fi
183 done
184 git status --porcelain --untracked-files=normal
185 exit $fail
186
187 alpha:
188 name: AIEN Alpha
189 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/alpha/')
190 runs-on: ubuntu-latest
191 timeout-minutes: 30
192 env:
193 REPO_SLUG: aien-dev/aien-architecture
194 AIEN_TEST_PIN: a51042b61b87355c0850ef82ba409a46e153a1ff
195 RECEIPTS_RAW: https://raw.githubusercontent.com/aien-dev/aien-receipts/main
196 steps:
197 - name: Checkout the tagged commit
198 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
199 with:
200 fetch-depth: 0
201
202 - name: The tagged commit must be on main
203 id: ids
204 run: |
205 sha=$(git rev-parse "${GITHUB_REF}^{commit}")
206 git fetch -q origin main
207 if ! git merge-base --is-ancestor "$sha" origin/main; then
208 echo "::error::${GITHUB_REF#refs/tags/} points at $sha, which is not on main"
209 exit 1
210 fi
211 echo "sha=$sha" >> "$GITHUB_OUTPUT"
212 echo "tag ${GITHUB_REF#refs/tags/} -> $sha (on main)"
213
214 - name: Trust anchors from origin/main
215 run: |
216 mkdir -p "$RUNNER_TEMP/anchors"
217 if ! git show "origin/main:.aien/verify.pub" > "$RUNNER_TEMP/anchors/verify.pub" 2>/dev/null; then
218 echo "::error::.aien/verify.pub is not on origin/main: no trusted key, nothing can be verified."
219 exit 1
220 fi
221 git show "origin/main:.aien/always" > "$RUNNER_TEMP/anchors/always" 2>/dev/null || : > "$RUNNER_TEMP/anchors/always"
222 echo "verify.pub (origin/main): $(cat "$RUNNER_TEMP/anchors/verify.pub")"
223
224 - name: Install Stable Rust Toolchain (for the pinned aien-test build)
225 uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable branch head 2026-10-26
226 with:
227 components: rustfmt
228
229 - name: Checkout the pinned aien-test source (aien-sovereign-core @ ${{ env.AIEN_TEST_PIN }})
230 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
231 with:
232 repository: aien-dev/aien-sovereign-core-mv
233 ref: ${{ env.AIEN_TEST_PIN }}
234 path: .aien-test-src
235 - name: Move pinned verifier source outside the candidate tree
236 # The tagged tree is already on main, but it must not configure its own verifier build.
237 run: mv .aien-test-src "$RUNNER_TEMP/aien-test-src"
238
239 - name: Cache the pinned aien-test build
240 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
241 with:
242 path: |
243 ~/.cargo/registry
244 ~/.cargo/git
245 key: aien-test-${{ runner.os }}-${{ env.AIEN_TEST_PIN }}-isolated-v1
246
247 - name: Build aien-test from the pin outside the candidate tree
248 run: |
249 cd "$RUNNER_TEMP/aien-test-src"
250 cargo build --release -p aien-test --target-dir "$RUNNER_TEMP/aien-test-target"
251 mkdir -p "$RUNNER_TEMP/bin" && cp "$RUNNER_TEMP/aien-test-target/release/aien-test" "$RUNNER_TEMP/bin/aien-test"
252 echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
253 rm -rf "$RUNNER_TEMP/aien-test-src"
254 cd "$GITHUB_WORKSPACE"
255 git status --porcelain --untracked-files=normal
256
257 - name: Fetch the signed Spark bundle for the tagged commit
258 run: |
259 url="$RECEIPTS_RAW/aien-architecture/${{ steps.ids.outputs.sha }}/bundle.json"
260 echo "bundle url: $url"
261 if ! curl -fsSL "$url" -o "$RUNNER_TEMP/bundle.json"; then
262 echo "::error::no signed Spark bundle for ${{ steps.ids.outputs.sha }} at $url"
263 exit 1
264 fi
265
266 - name: Verify the full bundle with the origin/main public key
267 run: |
268 required=$(grep -v '^#' "$RUNNER_TEMP/anchors/always" | grep -v '^$' | paste -sd, - || true)
269 set +e
270 aien-test verify-bundle "$RUNNER_TEMP/bundle.json" \
271 --repo "github.com/$REPO_SLUG" \
272 --commit "${{ steps.ids.outputs.sha }}" \
273 --pubkey "$RUNNER_TEMP/anchors/verify.pub" \
274 --require-full \
275 ${required:+--require "$required"}
276 rc=$?
277 set -e
278 echo "verify-bundle exit $rc (0 PASS, 1 FAIL, 2 NOT_RUN, 3 REJECTED)"
279 echo "::group::tag message"
280 git tag -l --format='%(contents)' "${GITHUB_REF#refs/tags/}"
281 echo "::endgroup::"
282 exit "$rc"