interplane.Get Omega
Read in your language

aien

aien-dev/aien

Brought by drakestapleton

branch main Branches Tags History

aien / tests / goal_microjobs / gate.sh

380 lines · 18601 bytes Raw Blame History
1#!/usr/bin/env bash
2# SPDX-License-Identifier: AGPL-3.0-or-later
3# Allen #13 offline gate: build the seeded .om microjob kernel, drive a 12-node objective
4# through the persistent journal in separate processes (restart, partial completion,
5# model failure, correction, refusal, cancellation, budgets), refuse plan and event
6# mutants, then show that source mutations of the kernel are caught by the probes.
7# Workers and verifiers below are synthetic fixtures: no model is called, nothing leaves
8# the run directory. Usage: OMEGA_WORKTREE=... bash tests/goal_microjobs/gate.sh
9set -euo pipefail
10
11repo=$(cd "$(dirname "$0")/../.." && pwd)
12: "${OMEGA_WORKTREE:?Set OMEGA_WORKTREE to the isolated seeded-Omega compiler worktree}"
13run_root=${GM_RUN_ROOT:-"$repo/evidence/goal-microjobs"}
14mkdir -p "$run_root"
15run=$(mktemp -d "$run_root/offline-$(date -u +%Y%m%dT%H%M%SZ)-XXXXXX")
16work=$(mktemp -d "${TMPDIR:-/tmp}/allen-gm-XXXXXX")
17trap 'rm -rf "$work"' EXIT
18mkdir -p "$work/probes"
19log="$run/transcript.log"
20: > "$log"
21
22drv="$repo/scripts/goal_microjobs/microjobs.sh"
23export GM_KERNEL="$work/kernel"
24bash "$repo/scripts/goal_microjobs/build.sh" "$repo/src/goal_microjobs/kernel.om" "$GM_KERNEL" >> "$log"
25
26checks=0
27die() { echo "FAIL: $*" | tee -a "$log" >&2; exit 1; }
28ok() { checks=$((checks + 1)); printf 'ok %d %s\n' "$checks" "$*" >> "$log"; }
29dw() { bash "$drv" digest "$1"; }
30
31# identities: owner 7, Allen runtime 9, verifiers 5 (recompute) and 6 (checker),
32# workers 20 (native compute), 21 (reflex route), 22 (student route)
33OWNER=7 RT=9 V5=5 V6=6 W20=20 W21=21 W22=22
34
35# plan fields after "2 id": kind op route profile effect in out reqin reqout vkind
36# verifier rclass maxatt tenant time_ms required d0 d1 d2 d3 ndeps deps...
37node() { local id=$1 rest=$2 tag=$3 deps=$4; printf '2 %s %s %s %s\n' "$id" "$rest" "$(dw "operand:$tag")" "$deps"; }
38# header: abi objective(4) owner runtime ceiling n terminal maxatt maxmodel maxtok budin budout budtime
39HDR_ABI=1 HDR_CEIL=2 HDR_MAXATT=24 HDR_MAXMODEL=8 HDR_MAXTOK=2000 HDR_BUDIN=1000
40plan() {
41 printf '1 %s %s %s %s %s 12 11 %s %s %s %s 256 20000\n' "$HDR_ABI" "$(dw 'objective:allen13-fixture-weekly-budget-note')" \
42 "$OWNER" "$RT" "$HDR_CEIL" "$HDR_MAXATT" "$HDR_MAXMODEL" "$HDR_MAXTOK" "$HDR_BUDIN"
43 node 1 "1 1 0 0 1 0 0 0 0 1 5 2 2 7 100 1" n1 "0"
44 node 2 "1 3 0 0 1 0 0 0 0 1 5 2 2 7 100 1" n2 "0"
45 node 3 "1 1 0 0 1 0 0 0 0 1 5 2 2 7 100 1" n3-v1 "0"
46 node 4 "2 1 1 1 0 60 12 40 8 2 6 2 3 7 2000 1" n4 "0"
47 node 5 "2 2 2 2 0 120 30 100 20 2 6 2 3 7 4000 1" n5 "1 4"
48 node 6 "2 3 3 4 0 500 120 300 64 3 6 2 2 7 8000 0" n6 "1 4"
49 node 7 "1 1 0 0 1 0 0 0 0 1 5 2 2 7 100 1" n7 "3 1 2 3"
50 node 8 "1 4 0 0 1 0 0 0 0 1 5 2 2 7 100 1" n8 "2 5 7"
51 node 9 "2 4 1 2 0 120 30 90 24 2 6 2 3 7 4000 1" n9 "2 7 8"
52 node 10 "1 6 0 0 1 0 0 0 0 1 5 2 2 7 100 1" n10 "2 7 9"
53 node 11 "1 3 0 0 1 0 0 0 0 1 5 2 2 7 100 1" n11 "3 8 9 10"
54 node 12 "1 3 0 0 2 0 0 0 0 1 5 3 1 7 100 1" n12 "1 11"
55}
56
57S=""
58z4="0 0 0 0"
59# ev TYPE NODE ATTEMPT GEN ISSUER VERDICT "D0 D1 D2 D3" TOK TIME
60accept() { local out; out=$(bash "$drv" propose "$S" "$1" "$2" "$3" "$4" "$5" "$6" $7 "$8" "$9") || die "expected ACCEPT for $*: $out"; ok "accept $*"; }
61reject() {
62 local name=$1 code=$2; shift 2
63 local seq=$(( $(wc -l < "$S/journal") + 1 ))
64 { cat "$S/plan" "$S/journal"; printf '3 %s %s %s %s %s %s %s %s %s %s\n' "$seq" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"; } > "$work/probes/$name.in"
65 printf '%s\n' "$code" > "$work/probes/$name.code"
66 local out rc
67 set +e
68 out=$(bash "$drv" propose "$S" "$1" "$2" "$3" "$4" "$5" "$6" $7 "$8" "$9")
69 rc=$?
70 set -e
71 test "$rc" -eq "$code" || die "$name: expected reject $code, got $rc ($out)"
72 ok "reject $name $code"
73}
74status() { bash "$drv" status "$S"; }
75nodef() { status | awk -v id="$1" -v f="$2" '$1 == 101 && $2 == id { print $f }'; }
76objf() { status | awk -v f="$1" '$1 == 100 { print $f }'; }
77expect_node() { local got; got=$(nodef "$1" 3)/$(nodef "$1" 4)/$(nodef "$1" 5); test "$got" = "$2" || die "node $1 state/gen/attempts $got, want $2"; ok "node $1 = $2"; }
78expect_obj() { local got; got=$(objf 2); test "$got" = "$1" || die "objective status $got, want $1"; ok "objective status $1"; }
79
80# compute worker and an independent recompute verifier (different arithmetic path)
81work_value() { echo $(( $1 )); }
82verify_value() { expr "$1" "$2" "$3"; }
83run_compute() { # node gen attempt expr-for-worker tag
84 local n=$1 g=$2 a=$3 val=$4 tag=$5
85 accept 1 "$n" "$a" "$g" $W20 0 "$z4" 0 0
86 local d; d=$(dw "n$n:$tag:$val")
87 accept 2 "$n" "$a" "$g" $W20 0 "$d" 0 3
88 accept 3 "$n" "$a" "$g" $V5 1 "$d" 0 0
89}
90
91echo '== plan admission and plan mutants' >> "$log"
92plan > "$work/plan"
93S="$work/state-a"
94bash "$drv" init "$S" "$work/plan" >> "$log"
95ok "init acceptance plan"
96expect_obj 1
97
98plan_mutant() { # name code awk-program
99 local name=$1 code=$2 prog=$3 rc
100 plan | awk "$prog" > "$work/probes/plan-$name.in"
101 printf '%s\n' "$code" > "$work/probes/plan-$name.code"
102 set +e
103 bash "$drv" init "$work/m-$name" "$work/probes/plan-$name.in" > /dev/null
104 rc=$?
105 set -e
106 test "$rc" -eq "$code" || die "plan mutant $name: expected $code, got $rc"
107 test ! -e "$work/m-$name/plan" || die "plan mutant $name left a plan"
108 ok "plan mutant $name $code"
109}
110plan_mutant old-abi 10 'NR == 1 { $2 = 0 } { print }'
111plan_mutant cycle 20 '$1 == 2 && $2 == 1 { $NF = "1 7" } { print }'
112plan_mutant missing-dep 19 '$1 == 2 && $2 == 12 { $NF = 13 } { print }'
113plan_mutant self-dep 19 '$1 == 2 && $2 == 12 { $NF = 12 } { print }'
114plan_mutant overlong-unsplittable 15 '$1 == 2 && $2 == 4 { $10 = 70 } { print }'
115plan_mutant cap-above-profile 14 '$1 == 2 && $2 == 4 { $8 = 65 } { print }'
116plan_mutant compute-with-tokens 14 '$1 == 2 && $2 == 7 { $8 = 1 } { print }'
117plan_mutant changed-privacy-owner 17 '$1 == 2 && $2 == 6 { $16 = 8 } { print }'
118plan_mutant unauthorized-effect 18 'NR == 1 { $9 = 1 } { print }'
119plan_mutant missing-operand 22 '$1 == 2 && $2 == 9 { $19 = 0; $20 = 0; $21 = 0; $22 = 0 } { print }'
120plan_mutant missing-verifier 16 '$1 == 2 && $2 == 8 { $13 = 0 } { print }'
121plan_mutant never-retry-twice 23 '$1 == 2 && $2 == 12 { $14 = 1; $15 = 2 } { print }'
122plan_mutant effect-idempotent-retry 23 '$1 == 2 && $2 == 12 { $14 = 2 } { print }'
123plan_mutant over-budget 26 'NR == 1 { $15 = 700 } { print }'
124plan_mutant terminal-optional 21 'NR == 1 { $11 = 6 } { print }'
125plan_mutant truncated 2 'NR < 13 { print }'
126plan_mutant malformed-word 3 '$1 == 2 && $2 == 3 { $3 = "x" } { print }'
127
128echo '== independent microjobs before the join (several running at once)' >> "$log"
129accept 1 1 1 1 $W20 0 "$z4" 0 0
130accept 1 2 1 1 $W20 0 "$z4" 0 0
131reject dispatch-by-verifier 39 1 3 1 1 $V5 0 "$z4" 0 0
132reject dispatch-by-owner 39 1 3 1 1 $OWNER 0 "$z4" 0 0
133accept 1 3 1 1 $W20 0 "$z4" 0 0
134accept 1 4 1 1 $W21 0 "$z4" 0 0
135expect_node 4 2/1/1
136reject dispatch-before-dependencies 43 1 7 1 1 $W20 0 "$z4" 0 0
137v1=$(work_value '120+80+45'); test "$v1" = "$(verify_value 120 + 125)" || die "oracle n1"
138d1=$(dw "n1:sum:$v1")
139accept 2 1 1 1 $W20 0 "$d1" 0 3
140reject compute-result-with-tokens 48 2 2 1 1 $W20 0 "$d1" 1 3
141reject self-reported-success 40 3 1 1 1 $W20 1 "$d1" 0 0
142reject wrong-verifier 39 3 1 1 1 $V6 1 "$d1" 0 0
143reject verifier-digest-mismatch 41 3 1 1 1 $V5 1 "$(dw "n1:sum:999")" 0 0
144accept 3 1 1 1 $V5 1 "$d1" 0 0
145v2=$(work_value '300+15'); d2=$(dw "n2:reduce:$v2")
146accept 2 2 1 1 $W20 0 "$d2" 0 2
147accept 3 2 1 1 $V5 1 "$d2" 0 0
148v3=$(work_value '12*7'); test "$v3" = "$(verify_value 12 '*' 7)" || die "oracle n3"
149d3=$(dw "n3:arith:$v3")
150accept 2 3 1 1 $W20 0 "$d3" 0 2
151accept 3 3 1 1 $V5 1 "$d3" 0 0
152d4=$(dw "n4:route:budget-note")
153reject result-over-token-contract 42 2 4 1 1 $W21 0 "$d4" 73 900
154reject result-by-other-worker 39 2 4 1 1 $W22 0 "$d4" 50 900
155accept 2 4 1 1 $W21 0 "$d4" 50 900
156accept 3 4 1 1 $V6 1 "$d4" 0 0
157echo '== refusal: optional teacher route has no current qualification' >> "$log"
158accept 7 6 0 1 $RT 0 "$z4" 0 0
159expect_node 6 7/1/0
160
161echo '== model failure then bounded retry' >> "$log"
162accept 1 5 1 1 $W22 0 "$z4" 0 0
163accept 4 5 1 1 $W22 0 "$z4" 40 4000
164expect_node 5 1/1/1
165reject retry-reuses-attempt 35 1 5 1 1 $W22 0 "$z4" 0 0
166accept 1 5 2 1 $W22 0 "$z4" 0 0
167d5=$(dw "n5:extract:limit=700")
168accept 2 5 2 1 $W22 0 "$d5" 110 2500
169accept 3 5 2 1 $V6 1 "$d5" 0 0
170expect_node 5 4/1/2
171
172echo '== join' >> "$log"
173v7=$(work_value "$v1+$v2+$v3"); test "$v7" = "$(verify_value "$v1" + "$(verify_value "$v2" + "$v3")")" || die "oracle n7"
174run_compute 7 1 1 "$v7" join
175run_compute 8 1 1 "$(work_value "$v7 <= 700")" compare
176accept 1 9 1 1 $W21 0 "$z4" 0 0
177
178echo '== partial completion: process stops with a live lease; restart replays exact state' >> "$log"
179status > "$run/partial-1.status"
180# Interrupt a real writer with SIGKILL after the kernel admitted its event but before the
181# atomic rename: nothing may be committed, the lock must be released, replay must match.
182cat > "$work/slow-kernel" <<EOF
183#!/usr/bin/env bash
184"$work/kernel"
185rc=\$?
186sleep 30
187exit \$rc
188EOF
189chmod 700 "$work/slow-kernel"
190jsha=$(sha256sum < "$S/journal")
191GM_KERNEL="$work/slow-kernel" setsid bash "$drv" propose "$S" 4 9 1 1 $RT 0 $z4 0 0 > /dev/null 2>&1 &
192wpid=$!
193for _ in $(seq 200); do pgrep -s "$wpid" -x sleep > /dev/null && break; sleep 0.05; done
194pgrep -s "$wpid" -x sleep > /dev/null || die "interrupted writer never reached its commit window"
195kill -KILL -- -"$wpid"
196wait "$wpid" 2> /dev/null || true
197test -f "$S/journal.cand" || die "interrupted writer left no candidate"
198test "$(sha256sum < "$S/journal")" = "$jsha" || die "SIGKILL before rename changed the journal"
199ok "SIGKILL inside the commit window left the journal unchanged"
200status > "$run/partial-2.status"
201cmp -s "$run/partial-1.status" "$run/partial-2.status" || die "replay after restart differs"
202ok "restart replay byte-identical ($(sha256sum < "$run/partial-1.status" | cut -c1-16))"
203expect_node 9 2/1/1
204expect_obj 1
205accept 4 9 1 1 $RT 0 "$z4" 0 0
206d9late=$(dw "n9:summarize:late")
207reject duplicate-result-after-restart 33 2 9 1 1 $W21 0 "$d9late" 20 100
208accept 1 9 2 1 $W21 0 "$z4" 0 0
209d9bad=$(dw "n9:summarize:total 640")
210accept 2 9 2 1 $W21 0 "$d9bad" 120 1800
211accept 3 9 2 1 $V6 0 "$d9bad" 0 0
212expect_node 9 1/1/2
213accept 1 9 3 1 $W21 0 "$z4" 0 0
214d9=$(dw "n9:summarize:total $v7 within 700")
215accept 2 9 3 1 $W21 0 "$d9" 118 1700
216reject result-twice 33 2 9 3 1 $W21 0 "$d9" 118 1700
217accept 3 9 3 1 $V6 1 "$d9" 0 0
218expect_node 9 4/1/3
219
220echo '== human correction invalidates exactly the affected nodes' >> "$log"
221reject correction-by-non-owner 39 6 3 0 1 $RT 0 "$(dw operand:n3-v2)" 0 0
222reject correction-same-operand 46 6 3 0 1 $OWNER 0 "$(dw operand:n3-v1)" 0 0
223reject correction-stale-generation 34 6 3 0 2 $OWNER 0 "$(dw operand:n3-v2)" 0 0
224accept 6 3 0 1 $OWNER 0 "$(dw operand:n3-v2)" 0 0
225for n in 1 2 4 5; do test "$(nodef $n 3)/$(nodef $n 4)" = "4/1" || die "unaffected node $n changed"; done
226ok "unaffected nodes 1 2 4 5 stay DONE at generation 1"
227expect_node 6 7/1/0
228for n in 3 7 8 9 10 11 12; do test "$(nodef $n 3)/$(nodef $n 4)/$(nodef $n 5)" = "1/2/0" || die "affected node $n not reset"; done
229ok "affected nodes 3 7 8 9 10 11 12 reset to generation 2"
230reject stale-generation-dispatch 34 1 3 1 1 $W20 0 "$z4" 0 0
231
232v3=$(work_value '12*9'); test "$v3" = "$(verify_value 12 '*' 9)" || die "oracle n3 v2"
233run_compute 3 2 1 "$v3" arith
234v7=$(work_value "$v1+$v2+$v3"); test "$v7" = "$(verify_value "$v1" + "$(verify_value "$v2" + "$v3")")" || die "oracle n7 v2"
235run_compute 7 2 1 "$v7" join
236run_compute 8 2 1 "$(work_value "$v7 <= 700")" compare
237accept 1 9 1 2 $W21 0 "$z4" 0 0
238d9=$(dw "n9:summarize:total $v7 within 700")
239accept 2 9 1 2 $W21 0 "$d9" 116 1600
240accept 3 9 1 2 $V6 1 "$d9" 0 0
241run_compute 10 2 1 1 verify
242run_compute 11 2 1 "$v7" "note-ok"
243reject effect-before-done 44 8 12 0 2 $RT 0 "$(dw effect:n12:g2)" 0 0
244run_compute 12 2 1 "$v7" publish
245reject effect-on-non-effect-node 44 8 11 0 2 $RT 0 "$(dw effect:n11:g2)" 0 0
246reject effect-by-worker 39 8 12 0 2 $W20 0 "$(dw effect:n12:g2)" 0 0
247expect_obj 1
248accept 8 12 0 2 $RT 0 "$(dw effect:n12:g2)" 0 0
249reject duplicate-effect 45 8 12 0 2 $RT 0 "$(dw effect:n12:g2)" 0 0
250expect_obj 2
251# status words: 100 status nodes done attempts model_calls tokens_reserved last_seq time_ms
252# cancelled tokens_used. Expected totals recomputed independently (docs/GOAL_MICROJOBS.md).
253totals=$(awk '$1 == 100' <(status))
254test "$totals" = "100 2 12 11 18 7 972 55 12531 0 554" || die "objective totals $totals"
255ok "objective totals: 18 attempts, 7 model calls, 972 tokens reserved, 554 used, 12531 ms"
256status > "$run/acceptance.status"
257receipt=$(awk '$1 == 103' "$run/acceptance.status")
258want="103 $(dw 'objective:allen13-fixture-weekly-budget-note') $(dw "n11:note-ok:$v7") 2 $(wc -l < "$S/journal")"
259test "$receipt" = "$want" || die "objective receipt $receipt, want $want"
260ok "terminal receipt binds objective digest and verified terminal result n11:note-ok:$v7"
261cp "$S/journal" "$run/acceptance.journal"
262cp "$S/plan" "$run/acceptance.plan"
263
264echo '== event wire refusals (driven directly, the driver never writes these)' >> "$log"
265wire() { # name code line
266 local name=$1 code=$2 line=$3 rc
267 { cat "$S/plan" "$S/journal"; printf '%s\n' "$line"; } > "$work/probes/$name.in"
268 printf '%s\n' "$code" > "$work/probes/$name.code"
269 set +e; "$GM_KERNEL" < "$work/probes/$name.in" > /dev/null; rc=$?; set -e
270 test "$rc" -eq "$code" || die "$name: expected $code, got $rc"
271 ok "wire $name $code"
272}
273next=$(( $(wc -l < "$S/journal") + 1 ))
274wire seq-gap 30 "3 $((next + 1)) 1 1 1 1 $W20 0 $z4 0 0"
275wire unknown-event-type 32 "3 $next 9 1 1 1 $W20 0 $z4 0 0"
276wire unknown-node 31 "3 $next 1 13 1 1 $W20 0 $z4 0 0"
277wire truncated-event 2 "3 $next 1 1"
278
279echo '== budgets stop model-call storms' >> "$log"
280HDR_MAXMODEL=2 plan > "$work/plan-b"
281S="$work/state-b"
282bash "$drv" init "$S" "$work/plan-b" >> "$log"
283accept 1 4 1 1 $W21 0 "$z4" 0 0
284accept 4 4 1 1 $W21 0 "$z4" 70 2000
285accept 1 4 2 1 $W21 0 "$z4" 0 0
286accept 4 4 2 1 $W21 0 "$z4" 70 2000
287reject model-call-budget 37 1 4 3 1 $W21 0 "$z4" 0 0
288test "$(nodef 4 7)" = 0 || die "unfundable node reported ready"
289ok "unfundable model node is not offered as ready"
290HDR_MAXTOK=100 plan > "$work/plan-c"
291S="$work/state-c"
292bash "$drv" init "$S" "$work/plan-c" >> "$log"
293accept 1 4 1 1 $W21 0 "$z4" 0 0
294accept 2 4 1 1 $W21 0 "$d4" 50 900
295accept 3 4 1 1 $V6 1 "$d4" 0 0
296reject token-budget 38 1 5 1 1 $W22 0 "$z4" 0 0
297S="$work/state-d"
298bash "$drv" init "$S" "$work/plan" >> "$log"
299for a in 1 2 3; do accept 1 4 "$a" 1 $W21 0 "$z4" 0 0; accept 4 4 "$a" 1 $W21 0 "$z4" 10 2000; done
300expect_node 4 5/1/3
301reject attempts-exhausted 33 1 4 4 1 $W21 0 "$z4" 0 0
302expect_obj 3
303test "$(nodef 5 6)/$(nodef 9 6)/$(nodef 12 6)" = "1/1/1" || die "dependents of failed node not blocked"
304ok "dependents of the exhausted model node are blocked"
305
306echo '== cancellation' >> "$log"
307S="$work/state-e"
308bash "$drv" init "$S" "$work/plan" >> "$log"
309accept 1 1 1 1 $W20 0 "$z4" 0 0
310accept 1 4 1 1 $W21 0 "$z4" 0 0
311reject cancel-by-non-owner 39 5 7 0 0 $W20 0 "$z4" 0 0
312accept 5 4 0 0 $OWNER 0 "$z4" 0 0
313for n in 4 5 6 8 9 10 11 12; do test "$(nodef $n 3)" = 6 || die "node $n not cancelled"; done
314ok "cancel of node 4 cancels exactly 4 and its dependents 5 6 8 9 10 11 12"
315reject late-result-after-cancel 33 2 4 1 1 $W21 0 "$d4" 50 900
316accept 2 1 1 1 $W20 0 "$d1" 0 3
317accept 3 1 1 1 $V5 1 "$d1" 0 0
318expect_node 1 4/1/1
319expect_obj 5
320accept 5 0 0 0 $OWNER 0 "$z4" 0 0
321expect_obj 4
322reject dispatch-after-objective-cancel 47 1 2 1 1 $W20 0 "$z4" 0 0
323reject cancel-twice 47 5 0 0 0 $OWNER 0 "$z4" 0 0
324
325echo '== source mutation controls' >> "$log"
326: > "$run/mutations.tsv"
327mutate() { # name from to probe
328 local name=$1 from=$2 to=$3 probe=$4 count rc want
329 count=$(grep -F -x -c "$from" "$repo/src/goal_microjobs/kernel.om")
330 test "$count" -eq 1 || die "mutation $name anchor occurs $count times"
331 awk -v f="$from" -v t="$to" '$0 == f { print t; next } { print }' "$repo/src/goal_microjobs/kernel.om" > "$work/mutant.om"
332 bash "$repo/scripts/goal_microjobs/build.sh" "$work/mutant.om" "$work/mutant" > /dev/null || die "mutant $name did not compile"
333 want=$(cat "$work/probes/$probe.code")
334 set +e; "$work/mutant" < "$work/probes/$probe.in" > /dev/null; rc=$?; set -e
335 test "$rc" -ne "$want" || die "mutant $name survived probe $probe"
336 printf '%s\t%s\t%s\t%s\tCAUGHT\n' "$name" "$probe" "$want" "$rc" >> "$run/mutations.tsv"
337 ok "mutant $name caught by $probe ($want -> $rc)"
338}
339mutate verifier-identity 'if ne ev 4 nd i 10' 'if eq ev 4 0' wrong-verifier
340mutate self-verification 'if eq ev 4 sg i 4' 'if eq ev 4 0' self-reported-success
341mutate dependency-gate 'fail 43' 'put Tot 7 0' dispatch-before-dependencies
342mutate generation-bump 'ss j 1 add sg j 1 1' 'ss j 1 sg j 1' stale-generation-dispatch
343mutate duplicate-effect 'if eq sg i 9 sg i 1' 'if eq sg i 9 99' duplicate-effect
344mutate model-budget 'fail 37' 'put Tot 7 0' model-call-budget
345mutate objective-cancel 'put Tot 5 1' 'put Tot 7 1' cancel-twice
346mutate cycle-check 'fail 20' 'put Tot 7 0' plan-cycle
347mutate privacy-owner 'fail 17' 'put Tot 7 0' plan-changed-privacy-owner
348
349echo '== receipt' >> "$log"
350sha() { sha256sum "$1" | cut -d' ' -f1; }
351cat > "$run/receipt.json" <<EOF
352{
353 "schema": "aien.allen.goal-microjobs.offline-gate/1",
354 "verdict": "PASS",
355 "scope": "seeded .om admission and journal replay kernel; synthetic fixture workers and verifiers; local journal, not Cortex",
356 "signed": false,
357 "allen_source_commit": "$(git -C "$repo" rev-parse HEAD)",
358 "allen_tree_dirty": $(if test -n "$(git -C "$repo" status --porcelain -- src scripts tests)"; then echo true; else echo false; fi),
359 "omega_source_commit": "$(git -C "$OMEGA_WORKTREE" rev-parse HEAD)",
360 "compiler_sha256": "$(sha "$OMEGA_WORKTREE/build/L574/toolchain/build/bootstrap/omc")",
361 "kernel_source_sha256": "$(sha "$repo/src/goal_microjobs/kernel.om")",
362 "kernel_executable_sha256": "$(sha "$GM_KERNEL")",
363 "driver_sha256": "$(sha "$drv")",
364 "gate_sha256": "$(sha "$repo/tests/goal_microjobs/gate.sh")",
365 "acceptance_journal_sha256": "$(sha "$run/acceptance.journal")",
366 "acceptance_status_sha256": "$(sha "$run/acceptance.status")",
367 "mutation_log_sha256": "$(sha "$run/mutations.tsv")",
368 "host": "$(uname -smr)",
369 "checks_passed": $checks,
370 "mutants_caught": $(wc -l < "$run/mutations.tsv"),
371 "model_inference": "NOT_RUN",
372 "omega_or_core_dispatch": "NOT_RUN",
373 "cortex_write_and_restart": "NOT_RUN",
374 "canonical_mjb1_binary_abi": "NOT_RUN",
375 "routing_comparison": "NOT_RUN",
376 "gpu_or_physical_qualification": "NOT_RUN",
377 "deployment": "OFF"
378}
379EOF
380printf 'PASS %s checks=%d\n' "$run/receipt.json" "$checks" | tee -a "$log"