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
aien-sovereign-core-mv / tools / aien-local-ci / tests / crumb_real_test.sh
| 1 | #!/usr/bin/env 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 | # test-crumb-real.sh <shim> <old-tool>: Spark-only historical replay. A PR |
| 18 | # checkout may be inspected, but its lock or own source cannot select a tool. |
| 19 | set -u |
| 20 | SHIM=$(readlink -f "$1"); OLD=$(readlink -f "$2") |
| 21 | C=~/workspace/pipeline/clones; T=$(mktemp -d); trap 'rm -rf "$T"' EXIT |
| 22 | D0=~/.local/state/aien-local-ci/crumb-tools/d0f0b95d344b4c6628c3d868346932fd247ce168/crumb |
| 23 | GATE_SANDBOX=/usr/local/bin/crumb |
| 24 | pass=0; fail=0 |
| 25 | ok() { pass=$((pass+1)); echo "ok $1"; } |
| 26 | bad() { fail=$((fail+1)); echo "FAIL $1: $2"; } |
| 27 | tree() { # resolve the rev in the SOURCE clone (its origin/main), never the copy's idea of it |
| 28 | local sha; sha=$(git -C "$C/$1" rev-parse --verify "$2^{commit}") || { echo "no $2 in $1"; return 1; } |
| 29 | rm -rf "$T/$1"; git clone -q --shared --no-checkout "$C/$1" "$T/$1" && git -C "$T/$1" -c advice.detachedHead=false checkout -q --detach "$sha"; } |
| 30 | v() { (cd "$1" && "$2" verify . 2>&1 | tail -1); } |
| 31 | g() { git -c user.name=t -c user.email=t@t -c commit.gpgsign=false "$@"; } |
| 32 | |
| 33 | # 1. readiness on mains that pin d0f0b95d: old tool says stale, shim says what the gate says |
| 34 | for r in omega aienux physics; do |
| 35 | tree $r origin/main |
| 36 | o=$(v "$T/$r" "$OLD"); s=$(v "$T/$r" "$SHIM"); gt=$(v "$T/$r" "$D0") |
| 37 | [[ $o == *FAIL* ]] && [[ $s == *OK* ]] && [[ $gt == *OK* ]] && ok "$r main: old=FAIL shim=OK gate=OK" || bad "$r main" "old='$o' shim='$s' gate='$gt'" |
| 38 | done |
| 39 | # 2. Historical PR heads: a detached candidate's own source is not the |
| 40 | # trusted architecture clone. Resolve the authority from its origin/main. |
| 41 | for x in aegis-runtime:aeefa8dad09954129a06ee429128ae640cb5d0bd aien-protocols:083601ab spark-rsi:d272ecb7 aien-architecture:00034398; do |
| 42 | r=${x%%:*}; tree $r "${x#*:}" |
| 43 | w=$(cd "$T/$r" && CRUMB_SHIM_WHICH=1 "$SHIM" verify .) |
| 44 | pin=$(git -C "$C/$r" show origin/main:crumb.lock 2>/dev/null | tr -d '[:space:]') |
| 45 | if [ -n "$pin" ]; then |
| 46 | [[ $w == *"crumb.lock:$pin "* ]] && ok "$r candidate uses main pin" || bad "$r candidate pin" "$w" |
| 47 | else |
| 48 | [[ $w == *" sandbox "* ]] && ok "$r candidate uses sandbox not its source" || bad "$r candidate tool" "$w" |
| 49 | fi |
| 50 | done |
| 51 | # 3. legacy repos without a lock: shim (sandbox tool) and old tool give the same verdict on main |
| 52 | for r in aien-sovereign-core aegis-runtime aien-protocols spark-rsi aien-architecture synapse; do |
| 53 | tree $r origin/main |
| 54 | o=$(v "$T/$r" "$OLD"); s=$(v "$T/$r" "$SHIM") |
| 55 | [ "$o" = "$s" ] && ok "$r main legacy verdict unchanged by shim ($s)" || bad "$r main legacy" "old='$o' shim='$s'" |
| 56 | done |
| 57 | # 4. author replay on real failing heads: recompile the head's crumbs, then ask the GATE's tool |
| 58 | # sc 2d16cb94: author compiled with d0f0b95d, sc gate (sandbox tool) said 1 stale (2026-10-16) |
| 59 | # omega 05d0d8e9: author compiled with 94fffbcf, omega gate (crumb.lock d0f0b95d) said 10 stale |
| 60 | replay() { # replay <repo> <sha> <gate-tool> <author-tool> <label> |
| 61 | tree "$1" "$2"; (cd "$T/$1" && "$4" compile . >/dev/null 2>&1) |
| 62 | v "$T/$1" "$3" |
| 63 | } |
| 64 | s=$(replay aien-sovereign-core 2d16cb94 "$GATE_SANDBOX" "$D0"); [[ $s == *FAIL* ]] && ok "sc 2d16cb94 RED: compiled with d0f0b95d, gate says '$s'" || bad "sc replay red" "$s" |
| 65 | s=$(replay aien-sovereign-core 2d16cb94 "$GATE_SANDBOX" "$SHIM"); [[ $s == *OK* ]] && ok "sc 2d16cb94 GREEN: compiled with shim, gate says '$s'" || bad "sc replay green" "$s" |
| 66 | s=$(replay omega 05d0d8e9 "$D0" "$OLD"); [[ $s == *FAIL* ]] && ok "omega 05d0d8e9 RED: compiled with old tool, gate says '$s'" || bad "omega replay red" "$s" |
| 67 | s=$(replay omega 05d0d8e9 "$D0" "$SHIM"); [[ $s == *OK* ]] && ok "omega 05d0d8e9 GREEN: compiled with shim, gate says '$s'" || bad "omega replay green" "$s" |
| 68 | # 5. after migration an old-tool compile is refused by the gate (the protocol's own guard): proves the |
| 69 | # remaining failure mode is loud, not silent |
| 70 | tree aegis-runtime aeefa8dad09954129a06ee429128ae640cb5d0bd; (cd "$T/aegis-runtime" && "$OLD" compile . >/dev/null 2>&1) |
| 71 | s=$(v "$T/aegis-runtime" "$GATE_SANDBOX"); [[ $s == *FAIL* ]] && ok "old-tool compile on a migrated tree is caught by the gate ('$s')" || bad "migrated old compile" "$s" |
| 72 | tree aegis-runtime aeefa8dad09954129a06ee429128ae640cb5d0bd; (cd "$T/aegis-runtime" && "$SHIM" compile . >/dev/null 2>&1) |
| 73 | d=$(git -C "$T/aegis-runtime" status --porcelain | wc -l); s=$(v "$T/aegis-runtime" "$GATE_SANDBOX") |
| 74 | (( d == 0 )) && [[ $s == *OK* ]] && ok "shim compile on a migrated tree changes nothing and verifies" || bad "migrated shim compile" "dirty=$d '$s'" |
| 75 | |
| 76 | echo "real-tree tests: $pass passed, $fail failed"; (( fail == 0 )) |