interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / tools / r16_qualify.sh

651 lines · 38061 bytes Raw Blame History
1#!/bin/bash
2# SPDX-License-Identifier: Apache-2.0
3# Copyright 2026 Drake Stapleton (AIEN / aien-dev)
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# r16_qualify.sh -- R16 Orchestrator Retirement qualification harness (schema revision 2).
18#
19# Runs the R16 gate targets on the current checkout and writes the
20# AIEN_RX_R16_ORCHESTRATOR_RETIRED_V1 receipt (field names unchanged; the added field
21# "schema_revision": 2 marks the changed semantics below).
22#
23# Truthfulness rules (revision 2):
24# * A dirty tree is REFUSED (exit 2) before anything runs.
25# * Every gate status is computed from a real check: a make target's exit status AND
26# a required line in its log (or a value read from the inventory JSON). A failing
27# check is FAIL. A gate with no implemented check is NOT_RUN, never PASS.
28# * candidate_bound, tree_dirty and silicon_observed are computed from what was
29# observed during this run, not written as literals.
30# * Raw evidence and the receipt go to an UNTRACKED directory (default build/r16-raw/<run>,
31# or R16_OUT_DIR). Nothing under evidence/ is touched; a human or agent step copies
32# and commits the receipt later.
33# * No hardcoded machine paths. PHYSICS_DIR / AIENOS_LOCK_REPO are passed to make
34# only if the caller set them.
35#
36# Exit status: 0 every gate PASS; 1 at least one FAIL; 2 refused (dirty tree / bad
37# environment); 3 no FAIL but at least one gate NOT_RUN.
38#
39# Environment:
40# R16_OUT_DIR output root (default <repo>/build/r16-raw); must not be tracked
41# R16_RUN_ID override the run id (used by the self-test)
42# R16_EXPECT_COMMIT if set, HEAD must equal it or the run is refused
43# R16_R15_RECEIPT path to the R15 receipt on this candidate (checked for G7)
44# R16_QUALIFY_DRY=1 dry mode, used by tests/r16_qualify/run.sh: runs no make target, no
45# chip, no machine probe; reads fixture logs (<log> and <log>.rc)
46# already in the raw dir. Never writes a sha-named receipt.
47set -euo pipefail
48
49SCHEMA_REVISION=2
50HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
51cd "$HERE"
52DRY=${R16_QUALIFY_DRY:-0}
53
54refuse() { echo "REFUSED: $*" >&2; exit 2; }
55
56# ---- 0. refuse before running anything ------------------------------------
57git rev-parse --git-dir >/dev/null 2>&1 || refuse "not a git work tree: $HERE"
58if [ -n "$(git status --porcelain)" ]; then
59 git status --porcelain | head -20 >&2
60 refuse "working tree is dirty (uncommitted or untracked files); commit or clean first"
61fi
62CANDIDATE_COMMIT=$(git rev-parse HEAD)
63if [ -n "${R16_EXPECT_COMMIT:-}" ] && [ "$R16_EXPECT_COMMIT" != "$CANDIDATE_COMMIT" ]; then
64 refuse "HEAD $CANDIDATE_COMMIT is not the expected candidate $R16_EXPECT_COMMIT"
65fi
66export OMEGA_CANDIDATE_COMMIT="$CANDIDATE_COMMIT"
67for v in AIENOS_CAP_LIB VISOR_AUTH_CAP_LIB EFFECT_CAP64_CAP_LIB; do
68 [ -z "${!v:-}" ] || refuse "$v is set: a prebuilt authority library has no source proof; build it from aienos.lock (AIENOS_LOCK_REPO / AIENOS_R7_DIR)"
69done
70if [ -n "${PHYSICS_DIR:-}" ]; then export PHYSICS_DIR; fi
71if [ -n "${AIENOS_LOCK_REPO:-}" ]; then export AIENOS_LOCK_REPO; fi
72
73RUN_COMMIT=$CANDIDATE_COMMIT
74RUN_ID=${R16_RUN_ID:-$(date -u +%Y%m%dT%H%M%SZ)-${CANDIDATE_COMMIT:0:12}}
75OUT_ROOT=${R16_OUT_DIR:-$HERE/build/r16-raw}
76RAW_DIR="$OUT_ROOT/$RUN_ID"
77case "$OUT_ROOT/" in
78 "$HERE"/evidence/*) refuse "output dir is under tracked evidence/; use an untracked path" ;;
79esac
80mkdir -p "$RAW_DIR"
81if [ "$DRY" != 1 ]; then
82 case "$RAW_DIR" in
83 "$HERE"/*) git check-ignore -q "$RAW_DIR" || refuse "output dir $RAW_DIR is inside the repo but not git-ignored" ;;
84 esac
85fi
86
87echo "=== R16 Qualification (schema revision $SCHEMA_REVISION): $RUN_ID ==="
88echo "Candidate commit: $CANDIDATE_COMMIT"
89if [ "$DRY" = 1 ]; then echo "DRY MODE: no make target, no chip, no receipt named by hash"; fi
90
91# ---- helpers -----------------------------------------------------------------
92RC=0
93# run_target <logfile> <make target...>: sets RC to the exit status, or NOT_RUN in dry
94# mode when no fixture log exists. Never aborts the script (set -e is off around make).
95run_target() {
96 local log=$1; shift
97 if [ "$DRY" = 1 ]; then
98 if [ -f "$log" ]; then RC=$(cat "$log.rc" 2>/dev/null || echo 0); else RC=NOT_RUN; fi
99 return 0
100 fi
101 set +e
102 make "$@" > "$log" 2>&1 < /dev/null
103 RC=$?
104 set -e
105 echo "$RC" > "$log.rc"
106}
107# verdict <rc> <logfile> <fixed pattern>: PASS only if the target exited 0 and the log
108# holds the pattern; FAIL if it ran and either failed; NOT_RUN if it did not run.
109verdict() {
110 local rc=$1 log=$2 pat=$3
111 if [ "$rc" = NOT_RUN ]; then echo NOT_RUN; return; fi
112 if [ "$rc" != 0 ]; then echo FAIL; return; fi
113 if [ -s "$log" ] && grep -Fq -- "$pat" "$log"; then echo PASS; else echo FAIL; fi
114}
115# combine <status...>: FAIL beats NOT_RUN (or MISSING_IMPLEMENTATION) beats PASS.
116combine() {
117 local s r=PASS
118 for s in "$@"; do
119 if [ "$s" = FAIL ]; then echo FAIL; return; fi
120 if [ "$s" != PASS ]; then r=NOT_RUN; fi # NOT_RUN, MISSING_IMPLEMENTATION, anything else
121 done
122 echo "$r"
123}
124# jint <json> <key>: integer value of a key (last occurrence), empty if absent.
125jint() {
126 [ -s "$1" ] || return 0
127 sed -n 's/^.*"'"$2"'": *\([0-9][0-9]*\).*$/\1/p' "$1" | tail -1
128}
129jstrv() {
130 [ -s "$1" ] || return 0
131 sed -n 's/^.*"'"$2"'": *"\([^"]*\)".*$/\1/p' "$1" | tail -1
132}
133repohead() {
134 [ -s "$1" ] || return 0
135 sed -n 's/^.*"name": "'"$2"'".*"head": "\([0-9a-f]*\)".*$/\1/p' "$1" | head -1
136}
137b2j() { if [ "$1" = PASS ]; then echo true; elif [ "$1" = FAIL ]; then echo false; else echo '"NOT_RUN"'; fi; }
138
139# ---- 1. machine identity (observation only; no chip access) -----------------
140AIENOS_COMMIT=$(cat "$HERE/aienos.lock" 2>/dev/null || echo "unknown")
141PHYSICS_COMMIT=$(cat "$HERE/physics.lock" 2>/dev/null || echo "unknown")
142if [ "$DRY" != 1 ]; then
143 echo "[*] Capturing machine identity..."
144 midrs=$(for c in /sys/devices/system/cpu/cpu[0-9]*; do
145 printf '%s:%s ' "${c##*cpu}" "$(cat "$c/regs/identification/midr_el1" 2>/dev/null || true)"; done) || true
146 govs=$(for c in /sys/devices/system/cpu/cpu[0-9]*; do
147 printf '%s:%s:%s ' "${c##*cpu}" "$(cat "$c/cpufreq/scaling_governor" 2>/dev/null || true)" \
148 "$(cat "$c/cpufreq/scaling_cur_freq" 2>/dev/null || true)"; done) || true
149 top=$(ps -eo pcpu,comm --sort=-pcpu 2>/dev/null | sed -n '2,11p' | awk '{printf "%s:%s ", $2, $1}') || true
150 gpu_info=$(nvidia-smi --query-gpu=name,pci.bus_id,driver_version,temperature.gpu --format=csv,noheader 2>/dev/null) || gpu_info="N/A"
151 mach_id=$(sha256sum /etc/machine-id 2>/dev/null | cut -d' ' -f1) || mach_id="N/A"
152 mem_total=$(awk '/MemTotal/{print $2}' /proc/meminfo 2>/dev/null) || mem_total=0
153 cat > "$RAW_DIR/machine.json" <<MEOF
154{
155 "hostname": "$(hostname)",
156 "machine_id_sha256": "$mach_id",
157 "kernel": "$(uname -r)",
158 "architecture": "$(uname -m)",
159 "midr": "$midrs",
160 "governor_freq": "$govs",
161 "mem_kb": "$mem_total",
162 "gpu": "$gpu_info",
163 "loadavg": "$(cat /proc/loadavg 2>/dev/null || true)",
164 "top_cpu": "$top",
165 "aienos_commit": "$AIENOS_COMMIT",
166 "physics_commit": "$PHYSICS_COMMIT",
167 "compiler": "$(${CC:-cc} --version 2>/dev/null | head -1 || true)"
168}
169MEOF
170fi
171
172# ---- 2. G1 / G2: loop inventory -------------------------------------------
173echo "[*] R16-G1 / R16-G2: loop inventory..."
174INV_LOG="$RAW_DIR/r16_inventory.log"
175INV_JSON="$RAW_DIR/inventory.json"
176INV_TEST_LOG="$RAW_DIR/test_r16_inventory.log"
177if [ "$DRY" != 1 ]; then rm -f build/r16-inventory.json; fi
178run_target "$INV_LOG" r16-inventory
179INV_RC=$RC
180if [ "$DRY" != 1 ] && [ -s build/r16-inventory.json ]; then cp build/r16-inventory.json "$INV_JSON"; fi
181run_target "$INV_TEST_LOG" test-r16-inventory
182INV_TEST_RC=$RC
183G1=NOT_RUN; G2=NOT_RUN; UNCLASS=""; AREACH=""
184if [ "$INV_RC" != NOT_RUN ] || [ -s "$INV_JSON" ]; then
185 if [ ! -s "$INV_JSON" ]; then
186 G1=FAIL; G2=FAIL
187 else
188 UNCLASS=$(jint "$INV_JSON" unclassified)
189 AREACH=$(jint "$INV_JSON" a_reachable)
190 g1=PASS
191 for k in unclassified question_rows bad_class stale_rows map_errors skipped_repos; do
192 [ "$(jint "$INV_JSON" "$k")" = 0 ] || g1=FAIL
193 done
194 for r in omega aien-sovereign-core aegis-runtime aienos physics; do
195 [ -n "$(repohead "$INV_JSON" "$r")" ] || g1=FAIL # every scanned commit recorded
196 done
197 G1=$g1
198 g2=PASS
199 [ "$INV_RC" = 0 ] || g2=FAIL
200 [ "$(jstrv "$INV_JSON" result)" = PASS ] || g2=FAIL
201 [ "$AREACH" = 0 ] || g2=FAIL
202 G2=$(combine "$g2" "$(verdict "$INV_TEST_RC" "$INV_TEST_LOG" "R16 inventory self-test: PASS")")
203 fi
204fi
205echo " G1=$G1 G2=$G2 (unclassified=${UNCLASS:-n/a} a_reachable=${AREACH:-n/a})"
206
207# ---- 3. G3: authoritative path without legacy orchestrators ------------------
208echo "[*] R16-G3: authpath host and silicon..."
209SILICON_BROKEN=0
210V=NOT_RUN
211run_target "$RAW_DIR/r16_authpath_host.log" test-r16-authpath
212G3H=$(verdict "$RC" "$RAW_DIR/r16_authpath_host.log" "R16 gate: R16_G3_AUTHPATH=HOST_PASS_NON_SILICON")
213# silicon_run <name> <log> <pattern> <make target>: sets V. After one silicon failure the
214# remaining silicon targets are NOT run (a failed seat run can leave the chip in a bad state).
215silicon_run() {
216 local log=$2 pat=$3; shift 3
217 if [ "$SILICON_BROKEN" = 1 ]; then V=NOT_RUN; return 0; fi
218 run_target "$log" "$@"
219 V=$(verdict "$RC" "$log" "$pat")
220 if [ "$V" = FAIL ]; then SILICON_BROKEN=1; fi
221 return 0
222}
223silicon_run g3s "$RAW_DIR/r16_authpath_silicon.log" "R16 gate: R16_G3_AUTHPATH=PASS" test-r16-authpath-silicon
224G3S=$V
225G3=$(combine "$G3H" "$G3S")
226echo " G3=$G3 (host $G3H, silicon $G3S)"
227
228# ---- 4. G4: negative tests and load-bearing mutants -------------------------
229echo "[*] R16-G4: negative tests and mutants..."
230run_target "$RAW_DIR/r16_negative.log" test-r16-negative
231G4A=$(verdict "$RC" "$RAW_DIR/r16_negative.log" "R16 gate: R16_G4_LEGACY_REFUSED=PASS")
232run_target "$RAW_DIR/r16_negative_mutants.log" test-r16-negative-mutants
233G4B=$(verdict "$RC" "$RAW_DIR/r16_negative_mutants.log" "R16 gate: R16_G4_GUARDS_LOAD_BEARING=PASS")
234G4=$(combine "$G4A" "$G4B")
235echo " G4=$G4"
236
237# ---- 5. G5: surface ----------------------------------------------------------
238echo "[*] R16-G5: surface check..."
239run_target "$RAW_DIR/r16_surface.log" test-r16-surface
240G5=$(verdict "$RC" "$RAW_DIR/r16_surface.log" "R16 gate: R16_G5_SURFACE=PASS")
241echo " G5=$G5"
242
243# ---- 6. G7: R1-R15 ladder on the candidate ----------------------------------
244echo "[*] R16-G7: ladder..."
245# name|make target|log|pattern|silicon(0/1)
246LADDER='R1_R6|test-r3|r1_r6_heartbeat.log|R4_CAUSAL_TRACE: PASS|0
247R7|test-r7|r7_native.log|native authority matched the linux oracle|0
248R8|test-r8|r8_aegis.log|failures 0|0
249R9|test-r9|r9_barrier.log|generation barrier kept a single coherent generation|0
250R10|test-r10|r10_omega.log|failures 0|0
251R11|test-r11|r11_aien.log|failures 0|0
252R12_host|test-r12|r12_host.log|failures 0|0
253R12_silicon|test-r12-silicon|r12_silicon.log|silicon 1|1
254R13_host|test-r13-host|r13_host.log|R13 gate: R13_LIVING_SYSTEM=HOST_PASS_NON_SILICON|0
255R13_silicon|test-r13-silicon|r13_silicon.log|R13 gate: R13_LIVING_SYSTEM=PASS|1
256R14_host|test-r14-host|r14_host.log|R14 gate: R14_LIVING_RECOVERY=HOST_PASS_NON_SILICON|0
257R14_silicon|test-r14-silicon|r14_silicon.log|R14 gate: R14_LIVING_RECOVERY=PASS|1
258R15_parity_host|test-r15-parity-host|r15_parity_host.log|SEQ_SEMANTIC_PARITY=PASS|0
259R15_g7_host|test-r15-g7-host|r15_g7_host.log|R15 G7 worker split: 57 checks, 0 failures|0
260R15_parity_silicon|test-r15-parity-silicon|r15_parity_silicon.log|SEQ_SEMANTIC_PARITY=PASS|1
261R15_receipt|test-r15-receipt|r15_receipt.log|r15 receipt test: 0 failure(s)|0'
262declare -A LV TG LOGF SEATOF # SEATOF: host or silicon, the seat each test ran on
263SILICON_RAN=0; SILICON_PASS=0
264if [ "$G3S" != NOT_RUN ]; then
265 SILICON_RAN=1
266 if [ "$G3S" = PASS ]; then SILICON_PASS=1; fi
267fi
268while IFS='|' read -r name target log pat sil; do
269 TG[$name]=$target; LOGF[$name]="$RAW_DIR/$log"
270 if [ "$sil" = 1 ]; then SEATOF[$name]=silicon; else SEATOF[$name]=host; fi
271 if [ "$sil" = 1 ]; then
272 silicon_run "$name" "$RAW_DIR/$log" "$pat" "$target"
273 LV[$name]=$V
274 if [ "$V" != NOT_RUN ]; then SILICON_RAN=$((SILICON_RAN + 1)); fi
275 if [ "$V" = PASS ]; then SILICON_PASS=$((SILICON_PASS + 1)); fi
276 else
277 run_target "$RAW_DIR/$log" "$target"
278 LV[$name]=$(verdict "$RC" "$RAW_DIR/$log" "$pat")
279 # A rung whose living part did not run (R11 refuses to start above load 2 and still
280 # exits 0 with "failures 0") is NOT_RUN, never PASS.
281 if [ "${LV[$name]}" = PASS ] && grep -Fq -- "[-] living run not exercised" "$RAW_DIR/$log"; then
282 LV[$name]=NOT_RUN
283 fi
284 fi
285 echo " $name: ${LV[$name]}"
286done <<< "$LADDER"
287
288# R15 physical acceptance (R15 spec G1-G16) is judged from the R15 receipt on this
289# candidate, supplied by the caller. No receipt: NOT_RUN.
290R15ACC=NOT_RUN
291if [ -n "${R16_R15_RECEIPT:-}" ]; then
292 R15ACC=PASS
293 f=$R16_R15_RECEIPT
294 if [ ! -s "$f" ]; then
295 R15ACC=FAIL
296 else
297 [ "$(basename "$f" .json)" = "$(sha256sum "$f" | cut -d' ' -f1)" ] || R15ACC=FAIL
298 grep -Fq "\"outcome\": \"PASS\"" "$f" || R15ACC=FAIL
299 grep -Fq "\"candidate_commit\": \"$CANDIDATE_COMMIT\"" "$f" || R15ACC=FAIL
300 grep -Fq "\"candidate_bound\": true" "$f" || R15ACC=FAIL
301 grep -Fq "\"tree_dirty\": false" "$f" || R15ACC=FAIL
302 grep -Fq "\"silicon_observed\": true" "$f" || R15ACC=FAIL
303 fi
304fi
305G7=$(combine "${LV[R1_R6]}" "${LV[R7]}" "${LV[R8]}" "${LV[R9]}" "${LV[R10]}" "${LV[R11]}" "${LV[R12_host]}" \
306 "${LV[R12_silicon]}" "${LV[R13_host]}" "${LV[R13_silicon]}" "${LV[R14_host]}" "${LV[R14_silicon]}" \
307 "${LV[R15_parity_host]}" "${LV[R15_g7_host]}" "${LV[R15_parity_silicon]}" "${LV[R15_receipt]}" "$R15ACC")
308echo " G7=$G7 (R15 acceptance receipt: $R15ACC)"
309
310# ---- 7. G6: protected things kept -------------------------------------------
311# The twelve items of spec R16-G6: the six section-49 items plus R9 crash recovery, R10
312# verifier, R12 seat-loss handling, R14 recovery paths, operator emergency controls and
313# the benchmark reference paths (SEQ). Presence and operation are separate facts:
314# * present = every named implementation symbol is DEFINED in its file (a function
315# definition line; a comment, prototype or call does not count). Absent: MISSING_IMPLEMENTATION.
316# An item with no implementation named at all is MISSING_IMPLEMENTATION (never a proxy PASS).
317# * operated = every named exercising test ran in THIS invocation and passed (exit
318# status AND required log line). A log that reports a skipped or unexercised run is
319# NOT_RUN, never PASS. FAIL if any test ran and failed.
320# Item status: MISSING_IMPLEMENTATION if not present; else FAIL > NOT_RUN > PASS over its
321# tests. G6 combines the items like combine() (FAIL > NOT_RUN/MISSING > PASS); G6 names
322# MISSING_IMPLEMENTATION when an item is missing and nothing failed.
323# Each item carries its own "basis" text in the receipt: it says whether the file:symbol is
324# what the spec itself names or a mapping chosen here (PROXY), and what the tests do not cover.
325echo "[*] R16-G6: protected things kept..."
326# g6_defined <file> <symbol> <f|t|l>: f = C function definition line, t = fixed text,
327# l = function definition in the aienos source at the FULL aienos.lock commit (the trusted
328# capability root). Kind l reads immutable blobs through tools/aienos_lock_source.sh: the
329# repository must hold the locked commit object, every object read is re-hashed, replace
330# refs are off. Files in AIENOS_R7_DIR, a build cache or a directory name are never read
331# for it; the repository around AIENOS_R7_DIR may serve objects, which prove themselves.
332# Returns 0 defined, 1 absent (the locked commit was read: file or symbol not there),
333# 2 cannot look (no repository holds the locked commit, or the lock is malformed).
334G6_LOCK_COMMIT=$(head -n 1 "$HERE/aienos.lock" 2>/dev/null || true)
335g6_lock() { AIENOS_LOCK=$G6_LOCK_COMMIT bash "$HERE/tools/aienos_lock_source.sh" "$@"; }
336G6_LOCK_IDENTITY=$(g6_lock identity 2>/dev/null) || true
337[ -n "$G6_LOCK_IDENTITY" ] || G6_LOCK_IDENTITY="{\"aienos_lock\": \"$G6_LOCK_COMMIT\", \"source\": \"none\", \"status\": \"malformed_lock\"}"
338declare -A G6BLOB
339g6_defined() {
340 local re="^[A-Za-z_][^;]*[ *]$2\\([^;]*\$"
341 if [ "$3" = l ]; then
342 local src rc
343 src=$(g6_lock show "$1" 2>/dev/null); rc=$?
344 [ "$rc" = 0 ] || return "$rc"
345 G6BLOB[$1]=$(g6_lock blob "$1" 2>/dev/null)
346 printf '%s\n' "$src" | grep -Eq -- "$re"; return $?
347 fi
348 [ -f "$HERE/$1" ] || return 1
349 if [ "$3" = t ]; then grep -Fq -- "$2" "$HERE/$1"; else grep -Eq -- "$re" "$HERE/$1"; fi
350}
351# M19 accelerator world (the known-good fallback, spec lines 182-183) and its maintenance
352# entry: one silicon run. PASS needs exit 0, no [FAIL] gate line and "N / N M19 GATES PASSED"
353# with N equal and nonzero.
354silicon_run m19 "$RAW_DIR/m19_world.log" "M19 GATES PASSED" test-m19
355LV[M19]=$V; TG[M19]=test-m19; LOGF[M19]="$RAW_DIR/m19_world.log"; SEATOF[M19]=silicon
356if [ "${LV[M19]}" = PASS ]; then
357 if grep -Fq -- "[FAIL]" "$RAW_DIR/m19_world.log" || \
358 ! grep -Eq -- "PERSISTENT WORLD QUALIFICATION: ([1-9][0-9]*) / \1 M19 GATES PASSED" "$RAW_DIR/m19_world.log"; then
359 LV[M19]=FAIL
360 fi
361fi
362# R16 G6 operator emergency stop runtime (spec/r16-operator-emergency-stop.md): host test
363# plus the guard mutants. PASS needs exit 0 and both pass lines.
364run_target "$RAW_DIR/rx_emergency.log" test-rx-emergency
365LV[RX_EMERGENCY]=$(verdict "$RC" "$RAW_DIR/rx_emergency.log" "RX_EMERGENCY_MUTANTS: PASS")
366if [ "${LV[RX_EMERGENCY]}" = PASS ] && ! grep -Fq -- "RX_EMERGENCY_STOP: PASS" "$RAW_DIR/rx_emergency.log"; then
367 LV[RX_EMERGENCY]=FAIL
368fi
369TG[RX_EMERGENCY]=test-rx-emergency; LOGF[RX_EMERGENCY]="$RAW_DIR/rx_emergency.log"
370# R16 G6 operator control by execution (docs/r16-operator-control.md section 7): the production
371# program driven from outside by the operator client. Host: the integration test plus its
372# mutants, both must pass. Silicon: the same test on the resident seat. Labelled apart.
373# Each seat's test writes its receipt to OP_OUT (beside the raw directory, untracked); the
374# receipt is copied INTO the raw directory, so the raw digest covers it, and a PASS needs
375# the receipt to name this seat, this candidate on a clean tree, no failure or skip, the
376# seat's own gate value, and the SHA-256 of the production binary this run built
377# (build/rx_r13_living_<seat>, file name included). A test that skipped a case (gate
378# NOT_RUN, exit 0) is NOT_RUN, never FAIL and never PASS.
379OP_OUT="$OUT_ROOT/$RUN_ID.operator"
380export RX_OP_OUT="$OP_OUT"
381OPV=NOT_RUN
382# op_receipt <seat> <verdict> <gate value>: sets OPV to the verdict after the receipt check.
383op_receipt() {
384 local seat=$1 want=$3 f="$RAW_DIR/operator_$1_receipt.json" bin="$HERE/build/rx_r13_living_$1" why=""
385 OPV=$2
386 if [ "$DRY" != 1 ]; then
387 rm -f "$f"
388 if [ -f "$OP_OUT/operator_${seat}_receipt.json" ]; then cp "$OP_OUT/operator_${seat}_receipt.json" "$f"; fi
389 fi
390 [ "$OPV" = PASS ] || return 0
391 if [ ! -s "$f" ]; then why="no operator receipt"
392 elif [ "$(jstrv "$f" seat)" != "$seat" ]; then why="receipt seat is not $seat"
393 elif [ "$(jstrv "$f" binary)" != "rx_r13_living_$seat" ]; then why="receipt binary $(jstrv "$f" binary) is not rx_r13_living_$seat"
394 elif [ ! -f "$bin" ] || [ "$(jstrv "$f" binary_sha256)" != "$(sha256sum "$bin" | cut -d' ' -f1)" ]; then why="receipt binary digest is not the production binary built in this run"
395 elif [ "$(jstrv "$f" candidate_commit)" != "$CANDIDATE_COMMIT" ]; then why="receipt candidate commit is not $CANDIDATE_COMMIT"
396 elif [ "$(sed -n 's/^.*"tree_dirty": *\([a-z]*\).*$/\1/p' "$f")" != false ]; then why="receipt tree not clean"
397 elif [ "$(jint "$f" failures)" != 0 ] || [ "$(jint "$f" skipped)" != 0 ]; then why="receipt counts failures or skips"
398 elif [ "$(sed -n 's/^.*"R16_G6_OPERATOR": "\([^"]*\)".*$/\1/p' "$f")" != "$want" ]; then why="receipt gate is not $want"
399 fi
400 if [ -n "$why" ]; then OPV=FAIL; echo " operator $seat receipt: FAIL ($why)"
401 else echo " operator $seat receipt: bound (binary $(jstrv "$f" binary_sha256 | cut -c1-12))"; fi
402}
403# op_notrun <verdict> <log> <rc> <ok rc...>: a run that exited with an accepted status and
404# printed a NOT_RUN gate line is NOT_RUN.
405op_notrun() {
406 local v=$1 log=$2 rc=$3 ok; shift 3
407 for ok in "$@"; do
408 if [ "$rc" = "$ok" ] && [ -s "$log" ] && grep -Eq -- "(R16_G6_OPERATOR|RX_OPERATOR_MUTANTS)(=|: )NOT_RUN" "$log"; then echo NOT_RUN; return; fi
409 done
410 echo "$v"
411}
412rm -f "$OP_OUT/operator_host_receipt.json" "$OP_OUT/operator_silicon_receipt.json"
413run_target "$RAW_DIR/r16_operator_host.log" test-r16-operator-host
414LV[R16_OP_HOST]=$(op_notrun "$(verdict "$RC" "$RAW_DIR/r16_operator_host.log" "R16 operator gate: R16_G6_OPERATOR=HOST_PASS_NON_SILICON")" "$RAW_DIR/r16_operator_host.log" "$RC" 0)
415op_receipt host "${LV[R16_OP_HOST]}" HOST_PASS_NON_SILICON; LV[R16_OP_HOST]=$OPV
416TG[R16_OP_HOST]=test-r16-operator-host; LOGF[R16_OP_HOST]="$RAW_DIR/r16_operator_host.log"
417run_target "$RAW_DIR/r16_operator_mutants.log" test-r16-operator-mutants
418LV[R16_OP_MUTANTS]=$(op_notrun "$(verdict "$RC" "$RAW_DIR/r16_operator_mutants.log" "RX_OPERATOR_MUTANTS: PASS")" "$RAW_DIR/r16_operator_mutants.log" "$RC" 3)
419TG[R16_OP_MUTANTS]=test-r16-operator-mutants; LOGF[R16_OP_MUTANTS]="$RAW_DIR/r16_operator_mutants.log"
420silicon_run r16op "$RAW_DIR/r16_operator_silicon.log" "R16 operator gate: R16_G6_OPERATOR=PASS" test-r16-operator-silicon
421if [ "$V" = FAIL ]; then
422 V=$(op_notrun "$V" "$RAW_DIR/r16_operator_silicon.log" "$RC" 0)
423 if [ "$V" = NOT_RUN ]; then SILICON_BROKEN=0; fi # it skipped a case; nothing failed on the chip
424fi
425op_receipt silicon "$V" PASS; LV[R16_OP_SILICON]=$OPV
426if [ "$OPV" != NOT_RUN ]; then SILICON_RAN=$((SILICON_RAN + 1)); fi
427if [ "$OPV" = PASS ]; then SILICON_PASS=$((SILICON_PASS + 1)); fi
428TG[R16_OP_SILICON]=test-r16-operator-silicon; LOGF[R16_OP_SILICON]="$RAW_DIR/r16_operator_silicon.log"; SEATOF[R16_OP_SILICON]=silicon
429unset RX_OP_OUT
430# g6_test <name>: status of one exercising test; a skipped or unexercised log is NOT_RUN.
431g6_test() {
432 local s=${LV[$1]:-NOT_RUN}
433 if [ "$s" = PASS ] && [ -s "${LOGF[$1]:-/nonexistent}" ] && grep -Eq -- "SKIPPED|not exercised" "${LOGF[$1]}"; then s=NOT_RUN; fi
434 echo "$s"
435}
436# key|file:symbol:kind;...|tests (comma separated)|basis
437G6_ITEMS='known_good_fallback_present|src/omega_accelerator_world.c:omega_world_drain:f;src/omega_accelerator_world.c:omega_world_init:f|M19|Spec lines 182-183 name M19 omega_world_* as the known-good fallback (class C): the spec own mapping, not a proxy. Exercised by test-m19 (silicon, N/N gates). Does not test falling back from the reaction world to the M19 world.
438recovery_path_present|src/runtime/rx_generation.c:rx_gen_recover:f|R9,R14_host|PROXY: the spec names no single recovery symbol; rx_gen_recover is the generation-store crash recovery chosen here. R9 stops after each persistence step and R14 host recovers; boot or repair recovery outside omega is not covered.
439deterministic_maintenance_controls_present|src/omega_world_gates.c:run_m19_gates:f;tools/omegatool.c:--run-m19-gates:t|M19|Spec line 182 classes omegatool --run-*-gates as B (deterministic maintenance). PARTIAL: only the M19 runner is exercised (by test-m19); the other --run-*-gates entries are not.
440trusted_capability_root_present|src/runtime/rx_native_bind.c:rx_world_init_native:f;native/capability/aienos_capability.c:aienos_cap_validate:l;native/capability/aienos_capability.c:aienos_cap_mint:l|R7,R12_host|Spec C3: the native C library at aienos.lock is the sole authoritative root. Checks that source as immutable blobs of the FULL locked commit (tools/aienos_lock_source.sh; identity in g6_lock_source) plus the omega binding; NOT_RUN if no repository holds the locked commit, MISSING_IMPLEMENTATION if the locked commit was read and lacks a symbol. R7 compares native authority with the Linux oracle.
441generation_mechanism_present|src/runtime/rx_generation.c:rx_gen_propose:f|R9,R13_host|Map row OM-022 and spec line 659 name rx_generation.c as the protected generation mechanism; rx_gen_propose is the entry chosen here (PROXY for the symbol). R9 barrier and R13 host promote.
442evidence_present|src/omega_evidence.c:omega_evidence_write_digest:f|R15_receipt,R9|PROXY: the spec names no evidence symbol; omega_evidence_write_digest (content-addressed evidence writer) chosen here. R15 receipt test and R9 evidence blob exercise it indirectly.
443r9_crash_recovery_passing|src/runtime/rx_generation.c:rx_gen_recover:f|R9|PROXY: R9 exercises rx_gen_recover (same routine as recovery_path_present, not independent). PASS means the R9 barrier test passed in this run.
444r10_verifier_passing|src/omega_verify.c:omega_verify_v0_structural:f|R10|PROXY: omega_verify_v0_structural is the verifier R10 reaches through rx_omega.c; R10 pass in this run is the evidence.
445r12_seat_loss_handling_passing|src/runtime/rx_world.c:rx_resident_seat_lost:f|R12_host,R12_silicon|rx_resident_seat_lost is the seat-loss handler (spec/r12-resident-seat.md, Seat loss). R12 host and silicon exercise it; rx_gpu_seat_kill is only the test hook and is not counted here.
446r14_recovery_paths_passing|src/runtime/rx_living.c:fn_restore:f|R14_host,R14_silicon|PROXY: fn_restore (generation.restore reaction) is one R14 recovery path chosen here; R14 host and silicon exercise the recovery runs.
447operator_emergency_controls_passing|src/runtime/rx_world.c:rx_world_emergency_stop:f;src/runtime/rx_world.c:rx_world_emergency_resume:f;src/runtime/rx_world.c:rx_world_operator_authorize:f;src/runtime/rx_generation.c:rx_gen_promote:f;src/runtime/rx_operator.c:rx_operator_open:f;tests/runtime/rx_r13_living.c:operator_open:f;tests/runtime/rx_r13_living.c:operator_audit:f|RX_EMERGENCY,R12_host,R16_OP_HOST,R16_OP_MUTANTS,R16_OP_SILICON|The runtime control (spec/r16-operator-emergency-stop.md: rx_world_emergency_stop / _resume; authority = enrolled caller credential plus an RX_WORLD_RES_CONTROL capability with the privileged RX_RIGHT_EPOCH right, never a reaction subject; a durable sealed OPERATOR_HALT mark that the generation store obeys and a restarted world restores) and its operator entry point in the production R13 program (docs/r16-operator-control.md: owner-only socket rx_operator_open, per-world credential and capability, generation store directory as the durable halt directory, restored stop before any work). Presence of these definitions proves nothing by itself: the item is operated only by execution. RX_EMERGENCY (host, in-process) and R12_host t_emergency_stop cover the runtime; R16_OP_HOST (test-r16-operator-host) starts the production host program and drives stop, status, resume, revoke and shutdown from outside through build/rx_operator, checking replies, the state directory and the crumb-log audit the program prints (no COMMIT or EXTERNAL under a stop); R16_OP_MUTANTS rebuilds the production program from mutated copies (wiring missing, wiring in a comment, unused call, handler disconnected, success reply without a transition, unauthorized resume accepted, and others) and requires the test to fail on each; R16_OP_SILICON is the same test on build/rx_r13_living_silicon (resident GB10 seat, no SIGKILL phase). Host and silicon are separate tests: the item is not PASS without the silicon run. Not covered: effects already outside the world when the stop lands (spec section 7.4), another process of the same uid deleting the mark while no program runs (spec section 7.3).
448benchmark_reference_paths_seq_passing|src/runtime/rx_seq_reference.c:rx_seq_pulse:f|R15_parity_host,R15_parity_silicon|Spec line 183 names rx_seq_reference as class D reference oracle. R15 parity host and silicon compare the reaction path with it.'
449declare -A G6S
450G6LIST=""; G6ALL=""; G6MISSING=0
451while IFS='|' read -r key pairs tests basis; do
452 present=true; implj=""
453 if [ -z "$pairs" ]; then present=false; fi
454 IFS=';' read -ra PA <<< "$pairs"
455 for p in "${PA[@]}"; do
456 [ -n "$p" ] || continue
457 pf=${p%%:*}; rest=${p#*:}; kind=${rest##*:}; sym=${rest%:*}
458 if g6_defined "$pf" "$sym" "$kind"; then dr=0; else dr=$?; fi
459 if [ "$dr" = 0 ]; then d=true
460 elif [ "$dr" = 2 ]; then d='"unreadable"'; if [ "$present" = true ]; then present=unknown; fi
461 else d=false; present=false; fi
462 src_kind=omega_tree; blobj=""
463 if [ "$kind" = l ]; then src_kind=aienos_lock_commit; blobj=", \"blob\": \"${G6BLOB[$pf]:-}\""; fi
464 implj="$implj{\"file\": \"$pf\", \"symbol\": \"$sym\", \"source\": \"$src_kind\", \"defined\": $d$blobj}, "
465 done
466 implj=${implj%, }
467 tj=""; ts=PASS; IFS=',' read -ra TA <<< "$tests"
468 for t in "${TA[@]}"; do
469 s=$(g6_test "$t"); ts=$(combine "$ts" "$s")
470 tj="$tj{\"name\": \"$t\", \"target\": \"${TG[$t]}\", \"seat\": \"${SEATOF[$t]:-host}\", \"status\": \"$s\"}, "
471 done
472 tj=${tj%, }
473 if [ "$present" = false ]; then st=MISSING_IMPLEMENTATION; G6MISSING=$((G6MISSING + 1))
474 elif [ "$present" = unknown ]; then st=$(combine "$ts" NOT_RUN)
475 else st=$ts; fi
476 G6S[$key]=$st; G6ALL="$G6ALL $st"
477 G6LIST="$G6LIST {\"item\": \"$key\", \"status\": \"$st\", \"present\": \"$present\", \"implementation\": [$implj], \"tests\": [$tj], \"basis\": \"$basis\"},
478"
479 echo " $key: $st"
480done <<< "$G6_ITEMS"
481G6LIST=${G6LIST%$'\n'}; G6LIST=${G6LIST%,}
482# shellcheck disable=SC2086
483G6=$(combine $G6ALL)
484if [ "$G6" = NOT_RUN ] && [ "$G6MISSING" -gt 0 ] && [[ " $G6ALL " != *" FAIL "* ]]; then G6=MISSING_IMPLEMENTATION; fi
485echo " G6=$G6 (items missing: $G6MISSING)"
486g6j() { local s=${G6S[$1]}; if [ "$s" = PASS ]; then echo true; elif [ "$s" = FAIL ]; then echo false; else echo "\"$s\""; fi; }
487
488# ---- 8. observed binding ----------------------------------------------------------
489END_COMMIT=$(git rev-parse HEAD)
490if [ -n "$(git status --porcelain)" ]; then TREE_DIRTY=true; else TREE_DIRTY=false; fi
491if [ "$END_COMMIT" = "$CANDIDATE_COMMIT" ] && [ "$RUN_COMMIT" = "$CANDIDATE_COMMIT" ] && [ "$TREE_DIRTY" = false ]; then
492 CAND_BOUND=true
493else
494 CAND_BOUND=false
495fi
496# silicon_observed: every silicon target (authpath, R12, R13, R14, R15 parity, R16 G6
497# operator control on the resident seat) ran and passed. Host results never count here.
498if [ "$SILICON_RAN" -ge 6 ] && [ "$SILICON_PASS" = "$SILICON_RAN" ]; then SIL_OBS=true; else SIL_OBS=false; fi
499
500# ---- 9. receipt ---------------------------------------------------------------------
501SC_COMMIT=$(repohead "$INV_JSON" aien-sovereign-core)
502AR_COMMIT=$(repohead "$INV_JSON" aegis-runtime)
503REMAINING_CENTRAL='"NOT_RUN"'
504if [ -n "$AREACH" ]; then REMAINING_CENTRAL=$AREACH; fi
505REMAINING_UNCLASS='"NOT_RUN"'
506if [ -n "$UNCLASS" ]; then REMAINING_UNCLASS=$UNCLASS; fi
507
508# G8 (spec/r16-orchestrator-retirement.md §G8) includes "the PR is merged with a merge
509# commit" and silicon_observed = true. This script runs before any merge, so it can
510# never observe the whole gate: G8 is always NOT_RUN here. It reports only whether the
511# receipt preconditions hold (bound, clean tree, silicon observed, not dry); G8 is
512# decided after the merge by whoever checks the merge commit.
513if [ "$CAND_BOUND" = true ] && [ "$TREE_DIRTY" = false ] && [ "$SIL_OBS" = true ] && [ "$DRY" != 1 ]; then
514 G8_PRECONDITIONS=met
515else
516 G8_PRECONDITIONS=not_met
517fi
518G8=NOT_RUN
519echo "[*] R16-G8: NOT_RUN (merge-commit part is outside this script; receipt preconditions $G8_PRECONDITIONS)"
520
521OVERALL=$(combine "$G1" "$G2" "$G3" "$G4" "$G5" "$G6" "$G7" "$G8")
522
523lr() { printf ' "%s": {"status": "%s", "target": "%s"}' "$1" "${LV[$2]}" "${TG[$2]}"; }
524RAW_DIGEST="NOT_RUN"
525(cd "$RAW_DIR" && rm -f SHA256SUMS && ls | grep -v '^SHA256SUMS$' | LC_ALL=C sort | xargs sha256sum > SHA256SUMS) || true
526if [ -s "$RAW_DIR/SHA256SUMS" ]; then RAW_DIGEST=$(sha256sum "$RAW_DIR/SHA256SUMS" | cut -d' ' -f1); fi
527RAW_REL=${RAW_DIR#"$HERE"/}
528
529OUT_RECEIPT_TMP="$RAW_DIR/receipt.raw.json"
530cat > "$OUT_RECEIPT_TMP" <<RECOBJ
531{
532 "schema": "AIEN_RX_R16_ORCHESTRATOR_RETIRED_V1",
533 "schema_revision": $SCHEMA_REVISION,
534 "dry_run": $(if [ "$DRY" = 1 ]; then echo true; else echo false; fi),
535 "candidate_commit": "$CANDIDATE_COMMIT",
536 "run_commit": "$RUN_COMMIT",
537 "candidate_bound": $CAND_BOUND,
538 "tree_dirty": $TREE_DIRTY,
539 "silicon_observed": $SIL_OBS,
540 "aienos_commit": "$AIENOS_COMMIT",
541 "physics_commit": "$PHYSICS_COMMIT",
542 "aienos_lock": "$AIENOS_COMMIT",
543 "physics_lock": "$PHYSICS_COMMIT",
544 "aien_sovereign_core_commit": "${SC_COMMIT:-unknown}",
545 "aegis_runtime_commit": "${AR_COMMIT:-unknown}",
546 "production_entry_point": "docs/r16-production-entry-point.md",
547 "legacy_orchestrators_disabled_test": "$G4A",
548 "legacy_cannot_bypass_authority_test": "$G3",
549 "remaining_central_loop_count": $REMAINING_CENTRAL,
550 "remaining_unclassified_semantic_loop_count": $REMAINING_UNCLASS,
551 "protected_surfaces_kept": {
552 "known_good_fallback_present": $(g6j known_good_fallback_present),
553 "recovery_path_present": $(g6j recovery_path_present),
554 "deterministic_maintenance_controls_present": $(g6j deterministic_maintenance_controls_present),
555 "trusted_capability_root_present": $(g6j trusted_capability_root_present),
556 "generation_mechanism_present": $(g6j generation_mechanism_present),
557 "evidence_present": $(g6j evidence_present),
558 "r9_crash_recovery_passing": $(g6j r9_crash_recovery_passing),
559 "r10_verifier_passing": $(g6j r10_verifier_passing),
560 "r12_seat_loss_handling_passing": $(g6j r12_seat_loss_handling_passing),
561 "r14_recovery_paths_passing": $(g6j r14_recovery_paths_passing),
562 "operator_emergency_controls_passing": $(g6j operator_emergency_controls_passing),
563 "benchmark_reference_paths_seq_passing": $(g6j benchmark_reference_paths_seq_passing)
564 },
565 "g6_lock_source": $G6_LOCK_IDENTITY,
566 "g6_items": [
567$G6LIST
568 ],
569 "r15_acceptance_still_passing": $(b2j "$R15ACC"),
570 "operator_control": {
571 "host": {"seat": "host", "status": "${LV[R16_OP_HOST]}", "mutants": "${LV[R16_OP_MUTANTS]}", "receipt": "operator_host_receipt.json"},
572 "silicon": {"seat": "silicon", "status": "${LV[R16_OP_SILICON]}", "receipt": "operator_silicon_receipt.json"}
573 },
574 "correctness_reruns": {
575$(lr R1 R1_R6),
576$(lr R2 R1_R6),
577$(lr R3 R1_R6),
578$(lr R4 R1_R6),
579$(lr R5 R1_R6),
580$(lr R6 R1_R6),
581$(lr R7 R7),
582$(lr R8 R8),
583$(lr R9 R9),
584$(lr R10 R10),
585$(lr R11 R11),
586$(lr R12_host R12_host),
587$(lr R12_silicon R12_silicon),
588$(lr R13_host R13_host),
589$(lr R13_silicon R13_silicon),
590$(lr R14_host R14_host),
591$(lr R14_silicon R14_silicon),
592$(lr R15_parity_host R15_parity_host),
593$(lr R15_parity_silicon R15_parity_silicon),
594$(lr R15_g7_host R15_g7_host),
595$(lr R15_receipt R15_receipt)
596 },
597 "gates": {
598 "R16-G1": "$G1",
599 "R16-G2": "$G2",
600 "R16-G3": "$G3",
601 "R16-G4": "$G4",
602 "R16-G5": "$G5",
603 "R16-G6": "$G6",
604 "R16-G7": "$G7",
605 "R16-G8": "$G8"
606 },
607 "g8_scope": "receipt bound to the candidate, clean tree, named by its own SHA-256; the merge commit is a separate step not checked here",
608 "gate": "$OVERALL",
609 "R16_ORCHESTRATOR_RETIRED": "$OVERALL",
610 "scope": "ADR 0016 resident reaction architecture migration; sovereign-core LLM request loop: not retired, still in use",
611 "not_claimed": [
612 "Retirement of the aien-sovereign-core LLM request loop (section 3.1, Q1)",
613 "Removal of any Rust code (section 3.1, Q2); the Rust loops still run if started by hand outside the AIEN production path",
614 "Retirement or code removal of the aien-sovereign-core aien-cli operator tool loops (13 rows) and spark-dream idle-time cycle loop (1 row); classified as class A (retired by non-use), their code is not removed under section 3.1 Q2",
615 "Any gate or field written NOT_RUN or MISSING_IMPLEMENTATION: no check or implementation was found for it, or its target was not run in this run"
616 ],
617 "raw_digest_note": "sha256 of SHA256SUMS over the raw directory",
618 "raw_directory_digest_sha256": "$RAW_DIGEST",
619 "raw_directory": "$RAW_REL",
620 "timestamp_utc": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
621}
622RECOBJ
623
624if [ "$DRY" = 1 ]; then
625 mv "$OUT_RECEIPT_TMP" "$RAW_DIR/DRY-RUN-receipt.json"
626 FINAL_PATH="$RAW_DIR/DRY-RUN-receipt.json"
627else
628 # Canonical writer built into the untracked output dir. The receipt goes beside the
629 # raw dir, untracked; a later human/agent step copies it under evidence/R16/ and commits.
630 seed/out/omc < tools/json_canon.om > "$RAW_DIR/json_canon" && chmod +x "$RAW_DIR/json_canon"
631 "$RAW_DIR/json_canon" --pretty < "$OUT_RECEIPT_TMP" > "$RAW_DIR/receipt.pretty.json"
632 RECEIPT_SHA=$(sha256sum "$RAW_DIR/receipt.pretty.json" | cut -d' ' -f1)
633 mkdir -p "$OUT_ROOT/receipts"
634 FINAL_PATH="$OUT_ROOT/receipts/$RECEIPT_SHA.json"
635 "$RAW_DIR/json_canon" --write-exclusive "$FINAL_PATH" < "$RAW_DIR/receipt.pretty.json"
636 chmod 0444 "$FINAL_PATH"
637 if [ "$(sha256sum "$FINAL_PATH" | cut -d' ' -f1)" != "$RECEIPT_SHA" ]; then
638 echo "ERROR: receipt not named by its own SHA-256" >&2
639 exit 1
640 fi
641 rm -f "$OUT_RECEIPT_TMP" "$RAW_DIR/receipt.pretty.json"
642fi
643
644echo "Gates: G1=$G1 G2=$G2 G3=$G3 G4=$G4 G5=$G5 G6=$G6 G7=$G7 G8=$G8"
645echo "Receipt (untracked): $FINAL_PATH"
646echo "R16_QUALIFY_RESULT=$OVERALL"
647case "$OVERALL" in
648 PASS) exit 0 ;;
649 FAIL) exit 1 ;;
650 *) exit 3 ;;
651esac