Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/research/atemporal/at0/integration/run.sh # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / research / atemporal / at0 / integration / run.sh` 428 lines ยท 37980 bytes Raw Blame History 1 #!/bin/sh 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 # AT-0 Agent 5: clean-checkout integration runner (charter section 6, gates G2, G4, G5, G6). 18 # 19 # sh run.sh [--out DIR | --evidence] [--keep-work] 20 # 21 # Builds model, oracle, evaluator and the assembler from a fresh local clone of this checkout's 22 # HEAD (so the working tree is never touched), runs every evaluator case through 23 # model -> oracle (reference lines only) -> assemble -> evaluator, runs the whole set twice for 24 # repeatability, runs the implementation-level controls, and writes receipts. 25 # --evidence writes the new folder evidence/AT0/- (append-only; must not exist) 26 # --out DIR writes to DIR (wiped first); default build/at0/check (what `make at0-check` uses) 27 # Single-threaded, no network, no Python, no GPU. Exit 0 only if no gate is FAIL. 28 set -u 29 LC_ALL=C; export LC_ALL 30 TZ=UTC; export TZ 31 # the runner may be started by `make at0-check`: the inner makes of the hygiene controls must not inherit its state 32 unset MAKELEVEL MAKEFLAGS MFLAGS MAKEOVERRIDES GNUMAKEFLAGS 33 HERE=$(cd "$(dirname "$0")" && pwd) 34 ROOT=$(cd "$HERE/../../../.." && pwd) 35 MODE=check; OUT=""; KEEP=0 36 while [ $# -gt 0 ]; do 37 case "$1" in 38 --evidence) MODE=evidence;; 39 --out) shift; OUT=${1:?--out needs a directory};; 40 --keep-work) KEEP=1;; 41 *) echo "usage: sh run.sh [--out DIR | --evidence] [--keep-work]" >&2; exit 64;; 42 esac 43 shift 44 done 45 HEAD=$(git -C "$ROOT" rev-parse HEAD) || { echo "not a git checkout" >&2; exit 64; } 46 SHORT=$(git -C "$ROOT" rev-parse --short=7 HEAD) 47 STAMP=$(date -u +%Y%m%dT%H%M%SZ) 48 CLEAN=YES; [ -n "$(git -C "$ROOT" status --porcelain)" ] && CLEAN=NO 49 if [ "$MODE" = evidence ]; then OUT="$ROOT/evidence/AT0/$STAMP-$SHORT"; [ -e "$OUT" ] && { echo "evidence folder exists: $OUT" >&2; exit 64; } 50 else [ -n "$OUT" ] || OUT="$ROOT/build/at0/check"; case "$OUT" in /*) ;; *) OUT="$PWD/$OUT";; esac; rm -rf "$OUT"; fi 51 mkdir -p "$OUT/receipts" "$OUT/cases" "$OUT/results" "$OUT/components" "$OUT/verify" "$OUT/mutants" || exit 1 52 WORK=$(mktemp -d "${TMPDIR:-/tmp}/at0-run.XXXXXX") || exit 1 53 [ $KEEP = 1 ] || trap 'rm -rf "$WORK"' EXIT 54 LOG="$OUT/run.log"; : > "$LOG" 55 R="$OUT/receipts" 56 say() { printf '%s\n' "$*" | tee -a "$LOG"; } 57 logrun() { printf '$ %s\n' "$*" >> "$LOG"; } 58 sha() { sha256sum "$1" | cut -c1-64; } 59 GATES="$R/gates.tsv"; CTRL="$R/controls.tsv"; : > "$GATES"; : > "$CTRL" 60 gate() { printf '%s\t%s\t%s\t%s\n' "$1" "$2" "$3" "$4" >> "$GATES"; say "GATE $1 $2 $4"; } 61 ctrl() { printf '%s\t%s\t%s\t%s\n' "$1" "$2" "$3" "$4" >> "$CTRL"; say "CONTROL $1 $2 $4"; } 62 63 say "AT-0 Agent 5 run $STAMP mode=$MODE omega=$HEAD tree_clean=$CLEAN" 64 65 # ---------- 0. contract pin ---------- 66 LOCK="$HERE/contract.lock" 67 lock() { sed -n "s/^$1 //p" "$LOCK" | head -1; } 68 CONTRACT_COMMIT=$(lock contract_commit) 69 CASE_SHA=$(lock case_v1_sha256); RESULT_SHA=$(lock result_v2_sha256) 70 cp "$LOCK" "$R/contract.lock" 71 if [ -n "${AT0_ARCH_DIR:-}" ] && [ -d "$AT0_ARCH_DIR/docs/plans/atemporal" ]; then 72 D="$AT0_ARCH_DIR/docs/plans/atemporal" 73 if [ "$(sha "$D/AT0_CASE_V1.md")" = "$CASE_SHA" ] && [ "$(sha "$D/AT0_RESULT_V2.md")" = "$RESULT_SHA" ] && [ "$(sha "$D/AT0_SPEC.md")" = "$(lock spec_sha256)" ]; then 74 ctrl C0-CONTRACT-DIGESTS PASS "sha256sum AT0_CASE_V1.md AT0_RESULT_V2.md AT0_SPEC.md in \$AT0_ARCH_DIR" "contract files match contract.lock (arch HEAD $(git -C "$AT0_ARCH_DIR" rev-parse --short=7 HEAD 2>/dev/null))" 75 else ctrl C0-CONTRACT-DIGESTS FAIL "sha256sum AT0_CASE_V1.md AT0_RESULT_V2.md AT0_SPEC.md" "digest mismatch against contract.lock"; fi 76 else ctrl C0-CONTRACT-DIGESTS NOT_RUN "AT0_ARCH_DIR unset" "no local aien-architecture clone given; digests only recorded in contract.lock"; fi 77 78 # ---------- 1. clean checkout and toolchain ---------- 79 S="$WORK/src"; AT0="$S/research/atemporal/at0"; INT="$AT0/integration" 80 logrun "git clone --no-hardlinks $ROOT $S; git checkout --detach $HEAD" 81 git clone -q --no-hardlinks "$ROOT" "$S" >> "$LOG" 2>&1 && git -C "$S" checkout -q --detach "$HEAD" >> "$LOG" 2>&1 || { say "FATAL clone failed"; exit 1; } 82 [ "$(git -C "$S" rev-parse HEAD)" = "$HEAD" ] || { say "FATAL clone HEAD mismatch"; exit 1; } 83 CCBIN=${CC:-gcc} 84 GCC_V=$($CCBIN --version | head -1) 85 RUSTC_V=$(rustc --version) 86 { 87 echo "date_utc $STAMP"; echo "uname $(uname -srm)"; echo "host $(cat /etc/hostname 2>/dev/null || echo unknown)" 88 echo "cc ($CCBIN) $GCC_V"; echo "cc via 'cc': $(cc --version | head -1)"; echo "make $(make --version | head -1)"; echo "nm $(nm --version | head -1)" 89 echo "--- rustc -vV"; rustc -vV 90 } > "$R/toolchain.txt" 91 case "$RUSTC_V" in "rustc 1.98.1 "*) ctrl C0-RUSTC-PIN PASS "rustc --version" "$RUSTC_V (pin 1.98.1)";; *) ctrl C0-RUSTC-PIN FAIL "rustc --version" "$RUSTC_V is not the pinned 1.98.1";; esac 92 CF="-std=c11 -Wall -Wextra -Werror -pedantic -O2 -D_POSIX_C_SOURCE=200809L" 93 MODEL_FLAGS=$(sed -n 's/^CFLAGS="\(.*\)"$/\1/p' "$AT0/model/build.sh" | head -1) 94 ORACLE_FLAGS=$(sed -n 's/^FLAGS="\(.*\)"$/\1/p' "$AT0/oracle/build.sh" | head -1) 95 { echo "model (build.sh, plain, -lm): $MODEL_FLAGS -O2"; echo "model (build.sh asan): $MODEL_FLAGS -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all" 96 echo "oracle (build.sh build): rustc $ORACLE_FLAGS --crate-name at0_oracle src/main.rs" 97 echo "evaluator (Makefile): $CF -Isrc -I../../../../src ... -lm"; echo "integration (this runner): $CF -I../../../../src ... (no -lm needed)"; } > "$R/flags.txt" 98 99 # ---------- 2. builds and component tests ---------- 100 bstep() { # label dir cmd... 101 lab=$1; d=$2; shift 2; logrun "(cd $d && $*)" 102 (cd "$d" && "$@") > "$WORK/$lab.log" 2>&1; rc=$?; cp "$WORK/$lab.log" "$R/$lab.log" 103 [ $rc -eq 0 ] && say "BUILD $lab ok" || say "BUILD $lab FAILED rc=$rc"; return $rc 104 } 105 BUILD_OK=1 106 bstep model-build "$AT0/model" ./build.sh || BUILD_OK=0 107 bstep model-build-asan "$AT0/model" ./build.sh asan || BUILD_OK=0 108 bstep oracle-build "$AT0/oracle" ./build.sh || BUILD_OK=0 109 bstep evaluator-build "$AT0/evaluator" make -s all || BUILD_OK=0 110 bstep evaluator-build-asan "$AT0/evaluator" make -s asan || BUILD_OK=0 111 logrun "cc $CF -I src -o at0-assemble at0_assemble.c src/omega_om_units.c" 112 mkdir -p "$WORK/bin" 113 cc $CF -I"$S/src" -o "$WORK/bin/at0-assemble" "$INT/at0_assemble.c" "$S/src/omega_om_units.c" > "$R/integration-build.log" 2>&1 || { BUILD_OK=0; say "BUILD integration FAILED"; } 114 [ $BUILD_OK = 1 ] || { say "FATAL build failure; see $R/*.log"; gate AT0-G2 FAIL "build" "a build step failed"; gate AT0-G4 NOT_RUN "build" "build failed"; gate AT0-G5 NOT_RUN "build" "build failed"; gate AT0-G6 NOT_RUN "build" "build failed"; exit 1; } 115 MODEL="$AT0/model/build/at0-model"; ORACLE="$AT0/oracle/target/at0-oracle"; EVAL="$AT0/evaluator/build/at0-eval"; ASM="$WORK/bin/at0-assemble" 116 ( cd "$AT0/model" && ./build/at0-tests tests/cases ) > "$R/model-tests.log" 2>&1; mrc=$? 117 ( cd "$AT0/model" && ./build-asan/at0-tests tests/cases ) > "$R/model-tests-asan.log" 2>&1; mrca=$? 118 ( cd "$AT0/oracle" && ./build.sh test ) > "$R/oracle-tests.log" 2>&1; orc=$? 119 ( cd "$AT0/oracle" && ./isolation.sh ) > "$R/oracle-isolation-own.log" 2>&1; oisorc=$? 120 ctrl C1-MODEL-TESTS $( [ $mrc -eq 0 ] && [ $mrca -eq 0 ] && echo PASS || echo FAIL ) "model/build/at0-tests tests/cases; model/build-asan/at0-tests tests/cases" "plain rc=$mrc, ASan/UBSan rc=$mrca ($(tail -1 "$R/model-tests.log"))" 121 ctrl C1-ORACLE-TESTS $( [ $orc -eq 0 ] && echo PASS || echo FAIL ) "oracle/build.sh test" "rc=$orc ($(grep -m1 'test result' "$R/oracle-tests.log"))" 122 ctrl C1-ORACLE-OWN-ISOLATION $( [ $oisorc -eq 0 ] && echo PASS || echo FAIL ) "oracle/isolation.sh" "Agent 2's own gate rc=$oisorc ($(tail -1 "$R/oracle-isolation-own.log"))" 123 124 # ---------- 3. receipts: sources and binaries ---------- 125 ( cd "$S" && git ls-files research/atemporal/at0 src/omega_om_units.c src/omega_api_decl.h src/omega_native.h src/sha256.h mk/at0.mk 2>/dev/null | LC_ALL=C sort | while read -r f; do printf '%s %s\n' "$(sha "$f")" "$f"; done ) > "$R/sources.sha256" 126 { for b in "$MODEL" "$ORACLE" "$EVAL" "$ASM" "$AT0/model/build/at0-tests" "$AT0/model/build-asan/at0-model" "$AT0/evaluator/build/at0-eval-asan"; do 127 [ -f "$b" ] && printf '%s %s\n' "$(sha "$b")" "${b#$WORK/}"; done; } > "$R/binaries.sha256" 128 ENGINE_SHA=$(sha "$MODEL"); ORACLE_SHA=$(sha "$ORACLE") 129 130 # ---------- 4. provenance template ---------- 131 HOSTN=$(cat /etc/hostname 2>/dev/null || echo unknown) 132 ORFLAGS=$(printf '%s' "$ORACLE_FLAGS" | sed 's/ -D warnings//') 133 BCC="$GCC_V (engine); $RUSTC_V (oracle)" 134 BFL="engine: $MODEL_FLAGS -O2 -lm; oracle: rustc $ORACLE_FLAGS" 135 [ ${#BCC} -le 200 ] && [ ${#BFL} -le 200 ] || { BFL=$(printf '%s' "$BFL" | cut -c1-200); say "NOTE build_flags truncated to 200 bytes; full flags in receipts/flags.txt"; } 136 BFL=$(printf '%s' "$BFL" | sed 's/ *$//'); BCC=$(printf '%s' "$BCC" | sed 's/ *$//') 137 PROV="$WORK/prov.static" 138 { echo "source_repo aien-dev/omega"; echo "source_commit $HEAD"; echo "source_tree_clean $CLEAN"; echo "contract_commit $CONTRACT_COMMIT" 139 echo "engine_sha256 $ENGINE_SHA"; echo "oracle_repo aien-dev/omega"; echo "oracle_commit $HEAD"; echo "oracle_sha256 $ORACLE_SHA" 140 echo "build_cc $BCC"; echo "build_flags $BFL"; echo "host $HOSTN"; } > "$PROV" 141 export AT0_MODEL_BIN="$MODEL" AT0_ORACLE_BIN="$ORACLE" AT0_ASM_BIN="$ASM" AT0_PROV_STATIC="$PROV" 142 RUNONE="sh $INT/candidate_run.sh" 143 144 # ---------- 5. case set ---------- 145 CASES="$WORK/cases.list" 146 ( cd "$AT0/evaluator/cases" && ls positive/*.case negative/*.case refuse/*.case ) | LC_ALL=C sort > "$CASES" 147 NCASE=$(wc -l < "$CASES") 148 for cls in positive negative refuse; do mkdir -p "$OUT/cases/$cls" "$OUT/results/pass1/$cls" "$OUT/results/pass2/$cls" "$OUT/verify/$cls"; done 149 cp "$AT0/evaluator/cases/MANIFEST.tsv" "$R/MANIFEST.tsv" 150 while read -r c; do cp "$AT0/evaluator/cases/$c" "$OUT/cases/$c"; done < "$CASES" 151 ( cd "$OUT/cases" && while read -r c; do printf '%s %s\n' "$(sha "$c")" "$c"; done < "$CASES" ) > "$R/cases.sha256" 152 say "cases: $NCASE (positive $(grep -c '^positive' "$CASES"), negative $(grep -c '^negative' "$CASES"), refuse $(grep -c '^refuse' "$CASES")); hidden set not touched" 153 154 # value helpers over a result file 155 field() { sed -n "s/^$2 //p" "$1" | head -1; } 156 valblock() { sed -n '/^begin values$/,/^end values$/p' "$1"; } 157 158 # ---------- 6. pass 1 ---------- 159 CT="$R/cases.tsv" 160 printf 'case\tclass\texpected_outcome\texpected_codes\tgot_outcome\tgot_codes\texpectation_met\tevaluator\toracle_own_outcome\toracle_own_codes\ttool_response\tmanifest_response\n' > "$CT" 161 NSAME=0; NDIFF_TOOL=0 162 while read -r c; do 163 name=$(basename "$c" .case); cls=${c%%/*}; case_abs="$OUT/cases/$c" 164 want=$(awk -F'\t' -v p="$c" '$1==p {print $3}' "$AT0/evaluator/cases/MANIFEST.tsv") 165 res="$OUT/results/pass1/$cls/$name.result" 166 AT0_COMP_DIR="$OUT/components" $RUNONE "$case_abs" > "$res" 2> "$WORK/err"; rc=$? 167 if [ $rc -eq 2 ]; then 168 rm -f "$res"; got=$(head -1 "$WORK/err") 169 orc_line=$("$ORACLE" check "$case_abs" 2>&1 >/dev/null | head -1) 170 ok=SAME; [ "$got" = "$want" ] && [ "$orc_line" = "$want" ] || ok=DIFF 171 printf '%s\t%s\tREFUSED\t%s\tREFUSED\t%s\tNOT_APPLICABLE\tNOT_APPLICABLE\t-\t-\tmodel[%s] oracle[%s]\t%s\n' "$c" "$cls" "$want" "$got" "$got" "$orc_line" "$want" >> "$CT" 172 [ "$ok" = SAME ] || NDIFF_TOOL=$((NDIFF_TOOL+1)); continue 173 fi 174 [ "$cls" = refuse ] && [ $rc -eq 0 ] && NDIFF_TOOL=$((NDIFF_TOOL+1)) 175 if [ $rc -ne 0 ]; then 176 "$ORACLE" emit "$case_abs" -o "$OUT/components/$name.oracle" 2>/dev/null 177 printf '%s\t%s\t-\t-\tERROR\t%s\tNO\tNOT_RUN\t%s\t%s\trc=%s\t%s\n' "$c" "$cls" "$(head -1 "$WORK/err" | cut -c1-80)" "$(field "$OUT/components/$name.oracle" outcome)" "$(field "$OUT/components/$name.oracle" failure_codes)" "$rc" "$want" >> "$CT"; rm -f "$res"; continue 178 fi 179 "$EVAL" result "$res" --case "$case_abs" --json > "$OUT/verify/$cls/$name.json" 2>/dev/null; evrc=$? 180 evs=$(sed 's/.*"status":"\([A-Z]*\)".*/\1/' "$OUT/verify/$cls/$name.json") 181 exp_o=$(sed -n 's/^expected_outcome //p' "$case_abs"); exp_c=$(sed -n 's/^expected_failure_codes //p' "$case_abs") 182 oo=$(field "$OUT/components/$name.oracle" outcome); oc=$(field "$OUT/components/$name.oracle" failure_codes) 183 printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\tok\t%s\n' "$c" "$cls" "$exp_o" "$exp_c" "$(field "$res" outcome)" "$(field "$res" failure_codes)" "$(field "$res" expectation_met)" "${evs:-evrc$evrc}" "$oo" "$oc" "$want" >> "$CT" 184 done < "$CASES" 185 say "pass 1 done: $(awk -F'\t' 'NR>1' "$CT" | wc -l) rows" 186 187 # ---------- 7. pass 2 (repeatability): later in time, different time zone ---------- 188 sleep 2 189 while read -r c; do 190 name=$(basename "$c" .case); cls=${c%%/*} 191 TZ=Asia/Tokyo $RUNONE "$OUT/cases/$c" > "$OUT/results/pass2/$cls/$name.result" 2>/dev/null || rm -f "$OUT/results/pass2/$cls/$name.result" 192 done < "$CASES" 193 RP_N=0; RP_VAL=0; RP_VER=0; RP_EVD=0; RP_BAD="" 194 for f in "$OUT"/results/pass1/*/*.result; do 195 cls=$(basename "$(dirname "$f")"); name=$(basename "$f"); g="$OUT/results/pass2/$cls/$name" 196 RP_N=$((RP_N+1)) 197 [ -f "$g" ] || { RP_BAD="$RP_BAD $name(missing)"; continue; } 198 [ "$(valblock "$f")" = "$(valblock "$g")" ] && RP_VAL=$((RP_VAL+1)) || RP_BAD="$RP_BAD $name(values)" 199 [ "$(field "$f" verdict_id)" = "$(field "$g" verdict_id)" ] && RP_VER=$((RP_VER+1)) || RP_BAD="$RP_BAD $name(verdict_id)" 200 [ "$(field "$f" evidence_digest)" != "$(field "$g" evidence_digest)" ] && RP_EVD=$((RP_EVD+1)) || RP_BAD="$RP_BAD $name(evidence_digest_equal)" 201 for k in case_id acceptance_id; do [ "$(field "$f" $k)" = "$(field "$g" $k)" ] || RP_BAD="$RP_BAD $name($k)"; done 202 done 203 if [ "$RP_N" -gt 0 ] && [ $RP_VAL = $RP_N ] && [ $RP_VER = $RP_N ] && [ $RP_EVD = $RP_N ] && [ -z "$RP_BAD" ]; then 204 ctrl C2-REPEATABILITY PASS "run each case twice (2 s apart, TZ=UTC then TZ=Asia/Tokyo); compare" "$RP_N results: values blocks byte-identical $RP_VAL/$RP_N, verdict_id equal $RP_VER/$RP_N, case_id/acceptance_id equal, evidence_digest differs $RP_EVD/$RP_N" 205 ctrl C3-WALLCLOCK-INDEPENDENCE PASS "same comparison (the charter's wall-clock independence control)" "equal case_id, acceptance_id, verdict_id and values block; different evidence_digest" 206 else 207 ctrl C2-REPEATABILITY FAIL "run each case twice and compare" "values $RP_VAL verdict $RP_VER evidence-differs $RP_EVD of $RP_N; problems:$RP_BAD" 208 ctrl C3-WALLCLOCK-INDEPENDENCE FAIL "same comparison" "problems:$RP_BAD" 209 fi 210 211 # ---------- 8. evaluation order ---------- 212 EO_N=0; EO_OK=0; EO_BAD="" 213 for f in "$OUT"/components/*.engine; do 214 name=$(basename "$f" .engine); cf=$(ls "$OUT"/cases/*/"$name".case) 215 EO_N=$((EO_N+1)) 216 "$MODEL" "$cf" --reversed > "$WORK/rev" 2>/dev/null 217 if cmp -s "$f" "$WORK/rev"; then EO_OK=$((EO_OK+1)); else EO_BAD="$EO_BAD $name"; fi 218 done 219 [ $EO_N -gt 0 ] && [ $EO_OK = $EO_N ] && ctrl C4-EVALUATION-ORDER PASS "at0-model --reversed vs normal, cmp of whole engine output" "$EO_OK/$EO_N bit-identical (labels evaluated in reverse order)" \ 220 || ctrl C4-EVALUATION-ORDER FAIL "at0-model --reversed vs normal" "identical $EO_OK/$EO_N; differ:$EO_BAD" 221 222 # ---------- 9. gates G4 and G5 (tables) ---------- 223 G4=$(awk -F'\t' 'NR>1 && $2=="positive" {n++; if ($5=="PASS" && $7=="YES") ok++} END {printf "%d %d", n+0, ok+0}' "$CT") 224 G5=$(awk -F'\t' 'NR>1 && $2=="negative" {n++; if ($5=="FAIL" && $7=="YES" && $6==$4) ok++} END {printf "%d %d", n+0, ok+0}' "$CT") 225 set -- $G4; G4N=$1; G4OK=$2; set -- $G5; G5N=$1; G5OK=$2 226 G6N=$(awk -F'\t' 'NR>1 && $5!="REFUSED" && $5!="ERROR" {n++; if ($8=="PASS") ok++} END {printf "%d %d", n+0, ok+0}' "$CT"); set -- $G6N; G6T=$1; G6OK=$2 227 REFN=$(awk -F'\t' 'NR>1 && $5=="REFUSED" {n++} END {print n+0}' "$CT") 228 229 # ---------- 10. mutant controls (axis swap, Y sign, hidden clock) ---------- 230 mutant_model() { # name sed-script source-file -> builds $WORK/mut//at0-model 231 mn=$1; ms=$2; mf=$3; md="$WORK/mut/$mn"; mkdir -p "$md" 232 cp "$AT0"/model/*.c "$AT0"/model/*.h "$md/" 233 sed "$ms" "$AT0/model/$mf" > "$md/$mf" 234 if cmp -s "$AT0/model/$mf" "$md/$mf"; then echo "mutation did not change $mf" >&2; return 1; fi 235 ( cd "$md" && cc $CF -I. -I"$S/src" -o at0-model at0_main.c at0_exact.c at0_case.c at0_io.c at0_state.c at0_hamiltonian.c at0_constraint.c at0_povm.c at0_conditional.c at0_observable.c at0_engine.c at0_output.c "$S/src/omega_om_units.c" -lm ) > "$md/build.log" 2>&1 236 } 237 run_mutant() { # name -> results under mutants/ 238 mn=$1; mkdir -p "$OUT/mutants/$mn" 239 for c in $(grep '^positive' "$CASES"); do 240 name=$(basename "$c" .case) 241 AT0_MODEL_BIN="$WORK/mut/$mn/at0-model" AT0_CC_NOTE="(MUTANT $mn control, not a qualification result)" \ 242 AT0_PROV_STATIC="$WORK/prov.mut.$mn" $RUNONE "$OUT/cases/$c" > "$OUT/mutants/$mn/$name.result" 2>/dev/null || continue 243 evs=$("$EVAL" result "$OUT/mutants/$mn/$name.result" --case "$OUT/cases/$c" --json 2>/dev/null | sed 's/.*"status":"\([A-Z]*\)".*/\1/') 244 printf '%s\t%s\t%s\t%s\t%s\n' "$name" "$(field "$OUT/mutants/$mn/$name.result" outcome)" "$(field "$OUT/mutants/$mn/$name.result" failure_codes)" "$(field "$OUT/mutants/$mn/$name.result" expectation_met)" "$evs" 245 done > "$R/mutant-$mn.tsv" 246 } 247 for mn in axis_swap y_sign_flip; do 248 case $mn in 249 axis_swap) MS='s/case AT0_AXIS_X:/case @@AX@@:/; s/case AT0_AXIS_Y:/case AT0_AXIS_X:/; s/case @@AX@@:/case AT0_AXIS_Y:/';; 250 y_sign_flip) MS='s/m\[0\]\[1\] = -I; out->m\[1\]\[0\] = I;/m[0][1] = I; out->m[1][0] = -I;/';; 251 esac 252 # the mutants record their own binary digest as engine_sha256 253 if mutant_model $mn "$MS" at0_observable.c; then 254 sed "s/^engine_sha256 .*/engine_sha256 $(sha "$WORK/mut/$mn/at0-model")/" "$PROV" > "$WORK/prov.mut.$mn" 255 run_mutant $mn 256 else echo "mutant $mn did not build: $(tail -2 "$WORK/mut/$mn/build.log" 2>/dev/null)" >> "$LOG"; : > "$R/mutant-$mn.tsv"; fi 257 done 258 # axis swap must be caught on every positive case where the swap is visible: expectation_met NO with SCHRODINGER_DEVIATION_EXCEEDED 259 mut_report() { # name -> "caught/total; blind: ..." 260 awk -F'\t' '{n++; if ($4=="NO" && $3=="SCHRODINGER_DEVIATION_EXCEEDED") c++; else b=b" "$1} END {printf "%d/%d caught", c+0, n+0; if (b) printf "; not caught (swap invisible on that case, see QUALIFICATION.md):%s", b}' "$R/mutant-$1.tsv" 261 } 262 AX=$(mut_report axis_swap); YS=$(mut_report y_sign_flip) 263 AXP1=$(awk -F'\t' '$1 ~ /^P1-kat/ {print ($4=="NO" && $3=="SCHRODINGER_DEVIATION_EXCEEDED") ? "YES" : "NO"}' "$R/mutant-axis_swap.tsv") 264 AXALL=$(awk -F'\t' '$1 ~ /^P1/ && !($4=="NO" && $3=="SCHRODINGER_DEVIATION_EXCEEDED") {print $1}' "$R/mutant-axis_swap.tsv" | tr '\n' ' ') 265 [ "$AXP1" = YES ] && ctrl C5-AXIS-SWAP-MUTANT PASS "model copy with the X and Y cases of at0_observable.c exchanged, run on all positive cases" "$AX; every P1 case caught except:${AXALL:- none}" \ 266 || ctrl C5-AXIS-SWAP-MUTANT FAIL "model copy with X and Y exchanged" "KAT not caught: $AX" 267 [ "$(awk -F'\t' '$1 ~ /^P1-kat/ {print ($4=="NO" && $3=="SCHRODINGER_DEVIATION_EXCEEDED") ? "YES":"NO"}' "$R/mutant-y_sign_flip.tsv")" = YES ] && ctrl C6-Y-SIGN-MUTANT PASS "model copy with sigma_y negated (dropped complex conjugate), run on all positive cases" "$YS" \ 268 || ctrl C6-Y-SIGN-MUTANT FAIL "model copy with sigma_y negated" "KAT not caught: $YS" 269 270 # ---------- 11. isolation (G2) ---------- 271 ISO="$WORK/iso"; mkdir -p "$ISO/clean" "$ISO/mut" 272 ISOOK=1 273 for f in "$AT0"/model/at0_*.c "$S/src/omega_om_units.c"; do 274 b=$(basename "$f" .c); [ "$b" = at0_main ] && continue 275 cc $CF -I"$AT0/model" -I"$S/src" -c "$f" -o "$ISO/clean/$b.o" >> "$LOG" 2>&1 || ISOOK=0 276 done 277 [ $ISOOK = 1 ] || say "NOTE model objects did not all compile (C7 will FAIL)" 278 CLEANOBJS=$(ls "$ISO"/clean/*.o | grep -v /at0_io\.o) 279 sh "$HERE/isolation_check.sh" $CLEANOBJS > "$R/isolation-model-own.log" 2>&1; i1=$? 280 ALLOW='^(fopen|fclose|fread|ferror)$' sh "$HERE/isolation_check.sh" "$ISO/clean/at0_io.o" > "$R/isolation-model-case-reader.log" 2>&1; i3=$? 281 sh "$HERE/isolation_check.sh" "$ISO/clean/at0_io.o" > "$R/isolation-model-case-reader-strict.log" 2>&1; i3s=$? 282 sh "$AT0/evaluator/gates/isolation.sh" $CLEANOBJS > "$R/isolation-model-evaluator-gate.log" 2>&1; i2=$? 283 # hidden-clock mutant: the engine plus a clock read 284 cp "$AT0/model/at0_engine.c" "$ISO/mut/at0_engine_hidden_clock.c" 285 printf '\n#include \nlong at0_hidden_clock_probe(void) { struct timespec t; clock_gettime(CLOCK_REALTIME, &t); return (long)t.tv_nsec; }\n' >> "$ISO/mut/at0_engine_hidden_clock.c" 286 cc $CF -I"$AT0/model" -I"$S/src" -c "$ISO/mut/at0_engine_hidden_clock.c" -o "$ISO/mut/at0_engine_hidden_clock.o" >> "$LOG" 2>&1 287 sh "$HERE/isolation_check.sh" "$ISO/mut/at0_engine_hidden_clock.o" > "$R/isolation-model-mutant-own.log" 2>&1; m1=$? 288 sh "$AT0/evaluator/gates/isolation.sh" "$ISO/mut/at0_engine_hidden_clock.o" > "$R/isolation-model-mutant-evaluator-gate.log" 2>&1; m2=$? 289 # a hidden-clock mutant that reads CNTVCT_EL0 or the like is invisible to any symbol scan: recorded as a limit, not tested 290 [ $ISOOK = 1 ] && [ $i1 -eq 0 ] && [ $i2 -eq 0 ] && [ $i3 -eq 0 ] && ctrl C7-ISOLATION-MODEL-CLEAN PASS "nm -u over model compute objects (all model .c except at0_main.c and at0_io.c (the thin file-reader layer, D6), plus src/omega_om_units.c, so at0_case.o is scanned strictly): isolation_check.sh and evaluator/gates/isolation.sh; at0_io.o scanned with only fopen/fread/fclose/ferror exempt" "$(echo $CLEANOBJS | wc -w) compute objects clean under both scanners (parser at0_case.o strictly clean); at0_io.o scanned separately (strict scan rc=$i3s: $(head -1 "$R/isolation-model-case-reader-strict.log" | cut -c1-120))" \ 291 || ctrl C7-ISOLATION-MODEL-CLEAN FAIL "nm -u over model compute objects" "own rc=$i1 evaluator-gate rc=$i2 case-reader rc=$i3: $(head -2 "$R/isolation-model-own.log" | tr '\n' ' ')" 292 [ $m1 -eq 1 ] && [ $m2 -ne 0 ] && ctrl C8-ISOLATION-MODEL-HIDDEN-CLOCK-MUTANT PASS "same scanners on at0_engine.c plus a clock_gettime call" "caught by both: $(head -1 "$R/isolation-model-mutant-own.log")" \ 293 || ctrl C8-ISOLATION-MODEL-HIDDEN-CLOCK-MUTANT FAIL "same scanners on the hidden-clock mutant" "own rc=$m1 evaluator-gate rc=$m2 (both must flag)" 294 # Rust oracle: nm -u on the members of the compute rlib, plus two Rust mutants 295 RI="$WORK/riso"; mkdir -p "$RI/clean" "$RI/m1" "$RI/m2" 296 RFL="--edition 2021 -C opt-level=2 -C codegen-units=1 -C debuginfo=0 -C panic=abort -D warnings --crate-type lib --crate-name at0" 297 ( cd "$AT0/oracle" && ./build.sh lib ) >> "$LOG" 2>&1 298 ( cd "$RI/clean" && ar x "$AT0/oracle/target/libat0.rlib" ) 2>> "$LOG" 299 cp -r "$AT0/oracle/src/at0" "$RI/m1/at0"; cp -r "$AT0/oracle/src/at0" "$RI/m2/at0" 300 printf '\npub fn hidden_clock() -> u64 { std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) }\n' >> "$RI/m1/at0/mod.rs" 301 printf '\n#[repr(C)] pub struct Ts { s: i64, n: i64 }\nextern "C" { fn clock_gettime(c: i32, t: *mut Ts) -> i32; }\npub fn hidden_clock() -> i64 { let mut t = Ts { s: 0, n: 0 }; unsafe { clock_gettime(0, &mut t); } t.n }\n' >> "$RI/m2/at0/mod.rs" 302 for m in m1 m2; do ( cd "$RI/$m" && rustc $RFL at0/mod.rs -o lib.rlib && ar x lib.rlib ) >> "$LOG" 2>&1; done 303 sh "$HERE/isolation_check.sh" "$RI"/clean/*.o > "$R/isolation-oracle-own.log" 2>&1; r0=$? 304 sh "$AT0/evaluator/gates/isolation.sh" "$RI"/clean/*.o > "$R/isolation-oracle-evaluator-gate.log" 2>&1; r0e=$? 305 sh "$HERE/isolation_check.sh" "$RI"/m1/*.o > "$R/isolation-oracle-mutant-std-time.log" 2>&1; r1=$? 306 sh "$HERE/isolation_check.sh" "$RI"/m2/*.o > "$R/isolation-oracle-mutant-extern-clock.log" 2>&1; r2=$? 307 sh "$AT0/evaluator/gates/isolation.sh" "$RI"/m1/*.o > /dev/null 2>&1; r1e=$? 308 sh "$AT0/evaluator/gates/isolation.sh" "$RI"/m2/*.o > /dev/null 2>&1; r2e=$? 309 [ $r0 -eq 0 ] && [ $r0e -eq 0 ] && ctrl C9-ISOLATION-ORACLE-CLEAN PASS "oracle/build.sh lib; ar x libat0.rlib; nm -u on each member: isolation_check.sh and evaluator/gates/isolation.sh" "$(ls "$RI"/clean/*.o | wc -l) rlib members clean under both scanners (compute crate src/at0 only; main.rs is the I/O layer and is excluded by design)" \ 310 || ctrl C9-ISOLATION-ORACLE-CLEAN FAIL "nm -u over oracle compute rlib members" "own rc=$r0 evaluator-gate rc=$r0e: $(head -2 "$R/isolation-oracle-own.log" | tr '\n' ' ')" 311 [ $r1 -eq 1 ] && [ $r2 -eq 1 ] && ctrl C10-ISOLATION-ORACLE-HIDDEN-CLOCK-MUTANTS PASS "same scan on two Rust mutants (std::time::SystemTime; extern \"C\" clock_gettime)" "own scanner flags both; evaluator gate flags std-time mutant rc=$r1e and extern-clock mutant rc=$r2e (0 would mean not flagged)" \ 312 || ctrl C10-ISOLATION-ORACLE-HIDDEN-CLOCK-MUTANTS FAIL "same scan on two Rust mutants" "own: std-time rc=$r1 extern-clock rc=$r2 (both must be 1)" 313 314 # ---------- 12. make hygiene (G2) ---------- 315 if [ -f "$S/mk/at0.mk" ]; then 316 HY="$WORK/hyg"; mkdir -p "$HY" 317 mk() { ( cd "$S" && make "$@" ) ; } 318 ( cd "$S" && make -n -k all PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 ) > /dev/null 2>&1 319 hy() { # tag dir 320 D=$2 321 for g in all test; do 322 ( cd "$D" && make -n -k $g PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 ) > "$HY/$1.$g" 2>&1; echo "exit $?" >> "$HY/$1.$g" 323 ( cd "$D" && make -n -k $g ) > "$HY/$1.$g.default" 2>&1; echo "exit $?" >> "$HY/$1.$g.default" 324 done 325 ( cd "$D" && make -pn -k all PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 ) 2>/dev/null | grep -v '^#' | sed -E 's/[0-9a-f]{12,40}/SHA/g; s/ at0-check at0-clean//; s| mk/at0\.mk||g' | grep -v -E '^(AT0_[A-Z_]* |at0-(check|clean):|AT0_MK|MAKEFILE_LIST|MA2_RUN_ID|R16_STAMP)' | grep -v -E '^\t.*(AT0_|integration/run\.sh|at0-clean|build/at0)' | LC_ALL=C sort -u > "$HY/$1.db" 326 } 327 # "without": a second clone with mk/at0.mk removed and committed, so both trees are clean and the comparison is not polluted by dirty-tree stamps 328 S2="$WORK/src-without"; git clone -q --no-hardlinks "$S" "$S2" && git -C "$S2" rm -q mk/at0.mk && git -C "$S2" -c user.email=a5@example.invalid -c user.name=a5 commit -q -m "without at0.mk (control)" 329 ( cd "$S2" && make -n -k all PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 ) > /dev/null 2>&1 330 hy with "$S"; hy without "$S2" 331 hok=1; hmsg="" 332 for g in all test; do 333 for v in "" ".default"; do cmp -s "$HY/with.$g$v" "$HY/without.$g$v" || { hok=0; hmsg="$hmsg $g$v"; }; done 334 done 335 cp "$HY/with.all" "$R/make-n-all.with.txt"; cp "$HY/without.all" "$R/make-n-all.without.txt"; cp "$HY/with.test" "$R/make-n-test.with.txt"; cp "$HY/without.test" "$R/make-n-test.without.txt" 336 diff "$HY/without.db" "$HY/with.db" > "$R/make-database.diff" 337 extra=$(grep '^[<>]' "$R/make-database.diff" | grep -v -i 'at0' | wc -l) 338 nl_all=$(wc -l < "$HY/with.all"); nl_test=$(wc -l < "$HY/with.test") 339 [ $hok = 1 ] && ctrl C11-MAKE-N-HYGIENE PASS "make -n -k all|test with PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 and with defaults, fragment present vs moved aside (cmp of stdout+stderr+exit)" "byte-identical in all four comparisons (all: $nl_all lines, test: $nl_test lines; exit 2 both ways because the physics checkout is absent, a pre-existing condition)" \ 340 || ctrl C11-MAKE-N-HYGIENE FAIL "make -n -k all|test with and without mk/at0.mk" "differ:$hmsg" 341 [ "$extra" = 0 ] && ctrl C12-MAKE-DATABASE PASS "make -pn -k all, sorted, fragment present vs removed-and-committed clone; diff after dropping at0-named lines, the mk/at0.mk entry in MAKEFILE_LIST prerequisites, 12-40 hex commit stamps and run timestamps" "empty diff: no variable, rule, target or prerequisite of the existing build changes (SRCS, all, test, clean untouched)" \ 342 || ctrl C12-MAKE-DATABASE FAIL "make -pn database diff" "$extra changed lines outside at0 names; see make-database.diff" 343 ( cd "$S" && make -n at0-check PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 ) > "$R/make-n-at0-check.txt" 2>&1; pc=$? 344 ( cd "$S" && make -n at0-clean PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 ) > "$R/make-n-at0-clean.txt" 2>&1; pc2=$? 345 [ $pc -eq 0 ] && [ $pc2 -eq 0 ] && grep -q 'run.sh' "$R/make-n-at0-check.txt" && ctrl C13-MAKE-PARSES PASS "make -n at0-check at0-clean PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0" "both parse and plan: $(grep -m1 run.sh "$R/make-n-at0-check.txt" | cut -c1-90)" \ 346 || ctrl C13-MAKE-PARSES FAIL "make -n at0-check at0-clean" "rc=$pc/$pc2" 347 else 348 ctrl C11-MAKE-N-HYGIENE NOT_RUN "mk/at0.mk not committed at HEAD" "fragment absent"; ctrl C12-MAKE-DATABASE NOT_RUN "-" "fragment absent"; ctrl C13-MAKE-PARSES NOT_RUN "-" "fragment absent" 349 fi 350 351 # ---------- 13. the evaluator's own harness with this runner as the candidate (G5/G6 hooks) ---------- 352 export AT0_CANDIDATE_CASE_TOOL="sh $INT/case_tool.sh" AT0_CANDIDATE_RUN="sh $INT/candidate_run.sh" AT0_CANDIDATE_OBJECTS="$CLEANOBJS" AT0_HIDDEN_DIR=/nonexistent-hidden-set-not-used 353 ( cd "$AT0/evaluator" && sh run.sh ) > "$R/evaluator-run.log" 2>&1; evrc=$? 354 cp "$AT0/evaluator/results/qualification.json" "$R/evaluator-qualification.json" 2>/dev/null 355 ESUM=$(grep -m1 '^---- summary' "$R/evaluator-run.log") 356 ECAND=$(grep -c '^CAND-VERIFY-.* PASS' "$R/evaluator-run.log") 357 EBAD=$(grep -E '^(CAND|CORPUS|SELF|DERIV|MUTANT)-[^ ]+ +[a-z]+ +FAIL' "$R/evaluator-run.log" | head -5 | tr '\n' ';') 358 if [ $evrc -eq 0 ]; then ctrl C14-EVALUATOR-HARNESS PASS "evaluator/run.sh with AT0_CANDIDATE_CASE_TOOL, AT0_CANDIDATE_RUN, AT0_CANDIDATE_OBJECTS set to this runner (hidden set not used)" "$ESUM; CAND-VERIFY PASS lines: $ECAND" 359 else ctrl C14-EVALUATOR-HARNESS FAIL "evaluator/run.sh with candidate hooks" "rc=$evrc $ESUM $EBAD"; fi 360 grep -q 'CAND-WALLCLOCK-INDEPENDENCE .* PASS' "$R/evaluator-run.log" && ctrl C15-EVALUATOR-WALLCLOCK PASS "evaluator/run.sh CAND-WALLCLOCK-INDEPENDENCE" "Agent 4's own wall-clock control passes on this runner" || ctrl C15-EVALUATOR-WALLCLOCK FAIL "evaluator/run.sh CAND-WALLCLOCK-INDEPENDENCE" "see evaluator-run.log" 361 grep -q 'CAND-ISOLATION .* PASS' "$R/evaluator-run.log" && ctrl C16-EVALUATOR-ISOLATION-CAND PASS "evaluator/run.sh CAND-ISOLATION (gates/isolation.sh on model objects)" "passes" || ctrl C16-EVALUATOR-ISOLATION-CAND FAIL "evaluator/run.sh CAND-ISOLATION" "see evaluator-run.log" 362 363 # ---------- 14. judge calibration against the oracle's 21 fixtures ---------- 364 JC_OK=0; JC_N=0; JC_BAD="" 365 for v in "$AT0"/oracle/fixtures/*.values; do 366 b=$(basename "$v" .values); JC_N=$((JC_N+1)) 367 "$ASM" judge "$AT0/oracle/fixtures/$b.case" "$v" > "$WORK/jc.out" 2>/dev/null 368 sed -n '/^begin verdict/,$p' "$v" > "$WORK/jc.exp" 369 if cmp -s "$WORK/jc.out" "$WORK/jc.exp"; then JC_OK=$((JC_OK+1)); else JC_BAD="$JC_BAD $b"; fi 370 done 371 [ $JC_OK = $JC_N ] && ctrl C17-JUDGE-CALIBRATION PASS "at0-assemble judge vs the oracle's verdict block and verdict_id" "$JC_OK/$JC_N identical" \ 372 || ctrl C17-JUDGE-CALIBRATION FAIL "at0-assemble judge vs oracle fixtures" "identical $JC_OK/$JC_N; differ:$JC_BAD (see QUALIFICATION.md discrepancies)" 373 374 375 # ---------- 14b. assembler must refuse inconsistent inputs (red before green for the runner itself) ---------- 376 KC="$OUT/cases/positive/P1-kat-ideal-qubit-n4.case"; BC="$OUT/cases/positive/P1b-ideal-n4-tau8-m8.case" 377 AR_BAD=""; AR_N=0 378 ar() { # label, expected-substring, case, engine, oracle 379 AR_N=$((AR_N+1)); "$ASM" assemble "$3" "$4" "$5" "$WORK/prov.static" > /dev/null 2> "$WORK/ar.err"; rcx=$? 380 if [ $rcx -eq 3 ] && grep -q "$2" "$WORK/ar.err"; then :; else AR_BAD="$AR_BAD $1(rc=$rcx)"; fi 381 } 382 sed 's/^case_id .*/case_id `0000000000000000000000000000000000000000000000000000000000000000`/' "$OUT/components/P1-kat-ideal-qubit-n4.engine" > "$WORK/e1" 383 ar altered-case-id "engine identities differ" "$KC" "$WORK/e1" "$OUT/components/P1-kat-ideal-qubit-n4.oracle" 384 ar oracle-for-other-case "different case" "$KC" "$OUT/components/P1-kat-ideal-qubit-n4.engine" "$OUT/components/P1b-ideal-n4-tau8-m8.oracle" 385 ar engine-for-other-case "differs from the case file" "$BC" "$OUT/components/P1-kat-ideal-qubit-n4.engine" "$OUT/components/P1b-ideal-n4-tau8-m8.oracle" 386 sed 's/^end values$/reference 0 X PLUS f64:`0000000000000000` 0@0\nend values/' "$OUT/components/P1-kat-ideal-qubit-n4.engine" > "$WORK/e2" 387 ar engine-with-reference "contains reference lines" "$KC" "$WORK/e2" "$OUT/components/P1-kat-ideal-qubit-n4.oracle" 388 sed 's/^build_cc oracle /build_cc /' "$OUT/components/P1-kat-ideal-qubit-n4.oracle" > "$WORK/o1" 389 ar oracle-not-marked "does not begin with" "$KC" "$OUT/components/P1-kat-ideal-qubit-n4.engine" "$WORK/o1" 390 sed '/^reference /d' "$OUT/components/P1-kat-ideal-qubit-n4.oracle" > "$WORK/o2" 391 ar oracle-without-reference "no reference lines" "$KC" "$OUT/components/P1-kat-ideal-qubit-n4.engine" "$WORK/o2" 392 [ -z "$AR_BAD" ] && ctrl C18-ASSEMBLER-REFUSALS PASS "at0-assemble assemble on $AR_N tampered or mismatched inputs (altered case_id, oracle or engine of another case, reference lines in the engine output, unmarked oracle record, oracle without reference lines)" "all refused with exit 3 and the expected message" \ 393 || ctrl C18-ASSEMBLER-REFUSALS FAIL "at0-assemble assemble on tampered inputs" "not refused as expected:$AR_BAD" 394 [ "$NDIFF_TOOL" = 0 ] && ctrl C19-REFUSAL-AGREEMENT PASS "model and oracle refusal codes against evaluator manifest on all refuse cases" "all $REFN refuse cases agree" || ctrl C19-REFUSAL-AGREEMENT FAIL "model and oracle refusal codes against evaluator manifest on all refuse cases" "$NDIFF_TOOL of $REFN refuse cases differ (or a refuse case was accepted); see cases.tsv and QUALIFICATION.md" 395 # ---------- 15. gates ---------- 396 isoG=PASS 397 for k in C7 C8 C9 C10 C11 C12 C13; do st=$(awk -F'\t' -v k="$k" '$1 ~ "^"k"-" {print $2}' "$CTRL"); [ -n "$st" ] || isoG=NOT_RUN; [ "$st" = PASS ] || isoG=$(awk -F'\t' -v k="$k" -v cur="$isoG" 'BEGIN{r=cur} $1 ~ "^"k"-" && $2=="FAIL" {r="FAIL"} $1 ~ "^"k"-" && $2=="NOT_RUN" && r!="FAIL" {r="NOT_RUN"} END{print r}' "$CTRL"); done 398 gate AT0-G2 "$isoG" "controls C7-C13 in controls.tsv (isolation_check.sh and evaluator/gates/isolation.sh on model and Rust oracle objects incl. mutants; make -n hygiene; make parses with PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0)" "runner checks C7-C13 $( [ "$isoG" = PASS ] && echo "all pass" || echo "not all pass" ); Agent 4 sign-off of this runner scanner (isolation_check.sh) on C objects and Rust rlib members is recorded by reference only (omega#358, 2026-10-10T00:09:52Z, before #364 merged, so it covers the scanner, not the final oracle code; the runner does not verify it) and Agent 4 gate now flags the Rust std::time mutant (C10); Agent 4 is UNISOLATED (same host and account)" 399 [ "$G4N" -gt 0 ] && [ "$G4OK" = "$G4N" ] && gate AT0-G4 PASS "every positive case: outcome PASS and expectation_met YES (cases.tsv)" "$G4OK/$G4N" || gate AT0-G4 FAIL "every positive case: outcome PASS and expectation_met YES" "$G4OK/$G4N" 400 G5C=$(awk -F'\t' '$2=="PASS" && $1 ~ /^C(5|6)-/ {n++} END {print n+0}' "$CTRL") 401 [ "$G5N" -gt 0 ] && [ "$G5OK" = "$G5N" ] && [ "$G5C" = 2 ] && gate AT0-G5 PASS "every negative case: outcome FAIL with exactly its expected codes and expectation_met YES; axis-swap and Y-sign mutants caught (C5, C6); hidden-clock mutants caught (C8, C10)" "$G5OK/$G5N negative cases" \ 402 || gate AT0-G5 FAIL "negative arm" "negative $G5OK/$G5N, mutant controls passing $G5C/2" 403 EVSELF=$(grep -E '^(SELF|DERIV|MUTANT|GATE|CAND-WALLCLOCK|CAND-ISOLATION)[^ ]* +[a-z]+ +FAIL' "$R/evaluator-run.log" | wc -l) 404 C3ST=$(awk -F'\t' '$1 ~ /^C3-/ {print $2}' "$CTRL"); NVALID=$((NCASE-REFN)) 405 if [ "$G6T" -gt 0 ] && [ "$G6OK" = "$G6T" ] && [ "$EVSELF" = 0 ] && [ "$C3ST" = PASS ]; then 406 if [ "$G6T" = "$NVALID" ]; then 407 gate AT0-G6 PASS "at0-eval result --case on every assembled result (verify/*.json) plus evaluator/run.sh with this runner as candidate; wall-clock control C3" "evaluator PASS on $G6OK of $NVALID valid cases (the other $((NVALID-G6T)) produced no result file, see G4); evaluator self-tests, mutants and gates with this runner as candidate: 0 FAIL; evidence folder committed by the PR" 408 else 409 gate AT0-G6 INCONCLUSIVE "verifier agreed with every result produced, but not every valid case produced a result" "evaluator PASS on $G6OK of $NVALID valid cases; $((NVALID-G6T)) produced no result (see G4); evaluator self-tests, mutants and gates with this runner as candidate: 0 FAIL" 410 fi 411 else 412 gate AT0-G6 FAIL "independent verification" "evaluator PASS on $G6OK/$G6T results, evaluator self/gate failures $EVSELF, wall-clock $C3ST" 413 fi 414 gate AT0-G7 NOT_RUN "-" "Agent 6 (scientific review) owns G7; Agent 5 does not run it" 415 416 # ---------- 16. result digests and summary ---------- 417 ( cd "$OUT" && find results mutants components verify -type f | LC_ALL=C sort | while read -r f; do printf '%s %s\n' "$(sha "$f")" "$f"; done ) > "$R/outputs.sha256" 418 { 419 echo "omega_commit $HEAD"; echo "source_tree_clean $CLEAN"; echo "contract_commit $CONTRACT_COMMIT"; echo "stamp $STAMP" 420 echo "cases $NCASE valid $((NCASE-REFN)) refused $REFN" 421 echo "G4 positive $G4OK/$G4N; G5 negative $G5OK/$G5N; G6 evaluator agreement $G6OK/$G6T; refusal rows where model, oracle and manifest agree $((REFN-NDIFF_TOOL))/$REFN" 422 echo "mutant axis_swap: $AX"; echo "mutant y_sign_flip: $YS" 423 } > "$R/summary.txt" 424 cat "$R/summary.txt" | tee -a "$LOG" 425 NFAIL=$(awk -F'\t' '$2=="FAIL"' "$GATES" | wc -l); NCF=$(awk -F'\t' '$2=="FAIL"' "$CTRL" | wc -l) 426 say "gates: $(awk -F'\t' '{printf "%s=%s ", $1, $2}' "$GATES")" 427 say "controls failing: $NCF; gates failing: $NFAIL" 428 [ $NFAIL -eq 0 ] && [ $NCF -eq 0 ]