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/aien-sovereign-core-mv/blob/main/om/effects/run.sh # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / om / effects / run.sh` 113 lines · 5872 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: Apache-2.0 3 # Parity of the seeded .om effect world check (om/effects/world.om) with the Rust reference world 4 # check (aien-runtime effects::world_state + effects::reconcile_text; not the confined production 5 # path confined_world_state): same stdout bytes and exit code 6 # on every fixture, refusals on inputs Rust's u64 parse refuses, and two mutants caught. 7 # Usage: OMEGA_OMC= bash om/effects/run.sh 8 set -u 9 ROOT=$(cd "$(dirname "$0")/../.." && pwd) 10 PIN=`734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61` 11 OMC=${OMEGA_OMC:?set OMEGA_OMC to the seed compiler (omega-mv seed/out/omc)} 12 O=$ROOT/target/om-effects 13 got=$(sha256sum < "$OMC" | cut -d' ' -f1) 14 [ "$got" = "$PIN" ] || { echo "FAIL omc sha256 $got, pinned $PIN"; exit 1; } 15 rm -rf "$O"; mkdir -p "$O/fx" 16 fails=0 17 pass() { echo "PASS $1"; } 18 fail() { echo "FAIL $1"; fails=$((fails + 1)); } 19 build() { cat "$ROOT/om/vendor/sha256.om" "$1" | "$OMC" > "$2" && chmod +x "$2"; } 20 build "$ROOT/om/effects/world.om" "$O/world" || { echo "FAIL build world.om"; exit 1; } 21 (cd "$ROOT" && cargo build --offline -q -p aien-runtime --example om_world_reference) || { echo "FAIL build reference"; exit 1; } 22 REF=$ROOT/target/debug/examples/om_world_reference 23 OMW=$O/world 24 25 # Fixtures (relative to $O/fx, so paths in error messages are short and stable). 26 cd "$O/fx" 27 printf abc > abc 28 printf 'prior bytes' > prior 29 : > empty 30 head -c `1048579` /dev/urandom > big 31 mkdir dir 32 ln -s abc link 33 ln -s loop loop 34 mkfifo fifo 35 printf secret > noread; chmod 000 noread 36 WEIRD=$'we"ird\\na\nme\001' 37 printf w > "$WEIRD" 38 mkdir "$WEIRD.d" 39 LONG=$(printf 'n%.0s' $(seq 300)) 40 H() { sha256sum < "$1" | cut -d' ' -f1; } 41 A=$(H abc); P=$(H prior); E=$(H empty); B=$(H big); W=$(H "$WEIRD") 42 UP=$(printf '%s' "$A" | tr a-f A-F) 43 CTL=$(printf 'c%b' '\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\177') 44 n=0 45 same() { 46 n=$((n + 1)); label=$1; want=$2; shift 2 47 "$REF" "$@" > "$O/r$n.out" 2> /dev/null; rr=$? 48 "$OMW" "$@" > "$O/w$n.out" 2> /dev/null; wr=$? 49 st=$(grep -o '"state":"[A-Z_]*"' "$O/w$n.out" | cut -d'"' -f4) 50 if [ $rr = 0 ] && [ $wr = 0 ] && cmp -s "$O/r$n.out" "$O/w$n.out" && [ "$st" = "$want" ]; then 51 pass "$label: $st, identical bytes" 52 else fail "$label (want $want, got $st; rust exit $rr, om exit $wr; $O/r$n.out vs $O/w$n.out)"; fi 53 } 54 same "content written" DONE abc "$A" - 3 2 'reconcile@start' 55 same "absent, no prior" NOT_DONE absent "$A" - 3 2 'reconcile@start' 56 same "prior bytes still there" NOT_DONE prior "$A" "$P" 3 2 x 57 same "absent, prior named" UNRESOLVED absent "$A" "$P" 3 2 x 58 same "other bytes, no prior" UNRESOLVED prior "$A" - 3 2 x 59 same "content equals prior" DONE abc "$A" "$A" 3 2 x 60 same "uppercase content digest" UNRESOLVED abc "$UP" - 3 2 x 61 same "empty file" DONE empty "$E" - 3 2 x 62 same "1 MiB + 3 bytes" DONE big "$B" - 3 2 x 63 same "directory" UNRESOLVED dir "$A" - 3 2 x 64 same "symlink to a file" UNRESOLVED link "$A" - 3 2 x 65 same "fifo" UNRESOLVED fifo "$A" - 3 2 x 66 same "unreadable file (or read by root: other bytes)" UNRESOLVED noread "$A" - 3 2 x 67 same "path through a file (ENOTDIR)" UNRESOLVED abc/x "$A" - 3 2 x 68 same "symlink loop (ELOOP)" UNRESOLVED loop/x "$A" - 3 2 x 69 same "300-byte name (ENAMETOOLONG)" UNRESOLVED "$LONG" "$A" - 3 2 x 70 same "empty path" NOT_DONE "" "$A" - 3 2 x 71 same "quote, backslash, newline, 0x01 in the name" DONE "$WEIRD" "$W" - 3 2 x 72 same "that name inside disk_error" UNRESOLVED "$WEIRD.d" "$A" - 3 2 x 73 same "every control byte and 0x7f in by" DONE abc "$A" - 3 2 "$CTL" 74 same "quote, backslash, slash, UTF-8 in by" DONE abc "$A" - 3 2 'q"b\s/é ✓' 75 same "u64 parse: + and leading zeros" DONE abc "$A" - +7 007 x 76 same "largest u64 intent, authorization 0" DONE abc "$A" - `18446744073709551615` 0 x 77 same "empty by" DONE abc "$A" - 3 2 "" 78 79 # Refusals: Rust's parse refuses these (the reference panics); world exits 2 with no output. 80 refuse() { 81 "$REF" "$@" > /dev/null 2>&1; rr=$? 82 "$OMW" "$@" > "$O/ref.out" 2> /dev/null; wr=$? 83 if [ $rr != 0 ] && [ $wr = 2 ] && [ ! -s "$O/ref.out" ]; then pass "both refuse intent '$4'" 84 else fail "refusal intent '$4' (rust exit $rr, om exit $wr)"; fi 85 } 86 refuse abc "$A" - `18446744073709551616` 2 x 87 refuse abc "$A" - -1 2 x 88 refuse abc "$A" - + 2 x 89 refuse abc "$A" - "" 2 x 90 "$OMW" abc "$A" - 3 2 > "$O/ref.out" 2> /dev/null; wr=$? 91 if [ $wr = 2 ] && [ ! -s "$O/ref.out" ]; then pass "world refuses five arguments"; else fail "five arguments (exit $wr)"; fi 92 93 # Mutants: one byte of the record and one decision; each must run to completion (exit 0 on both 94 # fixtures) and make a fixture's output differ. A mutant that refuses or crashes is not a catch. 95 mutant() { 96 sed "$2" "$ROOT/om/effects/world.om" > "$O/m.om" 97 cmp -s "$O/m.om" "$ROOT/om/effects/world.om" && { fail "mutant $1 did not change the source"; return; } 98 build "$O/m.om" "$O/m" || { fail "mutant $1 did not build"; return; } 99 "$REF" abc "$A" - 3 2 x > "$O/mr.out"; "$O/m" abc "$A" - 3 2 x > "$O/mw.out"; m1=$? 100 "$REF" absent "$A" - 3 2 x >> "$O/mr.out"; "$O/m" absent "$A" - 3 2 x >> "$O/mw.out"; m2=$? 101 if [ $m1 != 0 ] || [ $m2 != 0 ]; then fail "mutant $1 did not complete (exit $m1, $m2)" 102 elif cmp -s "$O/mr.out" "$O/mw.out"; then fail "mutant $1 not caught"; else pass "mutant $1 caught"; fi 103 } 104 mutant "key by -> bx" 's/,\\"by\\":/,\\"bx\\":/' 105 mutant "absent with no prior -> UNRESOLVED" '/^if eq pnone 1$/{n;s/^ret 1$/ret 2/}' 106 107 chmod 600 "$O/fx/noread" 108 echo "world.om $(sha256sum < "$ROOT/om/effects/world.om" | cut -d' ' -f1)" 109 echo "sha256.om $(sha256sum < "$ROOT/om/vendor/sha256.om" | cut -d' ' -f1)" 110 echo "world binary $(sha256sum < "$OMW" | cut -d' ' -f1)" 111 echo "omc $got" 112 if [ "$fails" -ne 0 ]; then echo "OM-EFFECT-WORLD FAIL $fails"; exit 1; fi 113 echo "OM-EFFECT-WORLD PASS ($n fixtures)"