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 / docs / campaigns / next-phase-1 / test-wiring-v7.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 | # NEXT-PHASE-1 v7: the v7 harness wiring (ACCEPTANCE-v7 Section 2). Shell + jq |
| 18 | # only. Usage: test-wiring-v7.sh. Exit 0 only if every case holds. |
| 19 | # |
| 20 | # 1. The real v4 run (tests-v5/v4-run) with its S3 report set to an explicit |
| 21 | # "committed": false, through make-receipt.sh as N1: the default module |
| 22 | # (rows-v6.jq, every existing caller) still turns false into null, and |
| 23 | # V6_ROWS=rows-v7.jq keeps it false and records the module and its sha256. |
| 24 | # Any other V6_ROWS is refused. |
| 25 | # 2. run-v7.sh differs from run-v6.sh only in the v7 wiring lines. |
| 26 | # 3. np1-v7.decl.json declares the same 73 rows as np1-v6.decl.json. |
| 27 | set -u |
| 28 | HERE=$(cd "$(dirname "$0")" && pwd) |
| 29 | pass=0 fail=0 |
| 30 | check() { # check NAME EXPECTED ACTUAL |
| 31 | if [ "$2" = "$3" ]; then pass=$((pass + 1)); echo "ok $1 (got: ${3:-none})" |
| 32 | else fail=$((fail + 1)); echo "FAIL $1: expected [${2}] got [${3}]"; fi |
| 33 | } |
| 34 | |
| 35 | # ---- 1. make-receipt.sh with and without V6_ROWS -------------------------------- |
| 36 | tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT |
| 37 | tmp=$(cd "$tmp" && pwd -P) |
| 38 | cp -R "$HERE/tests-v5/v4-run" "$tmp/run" |
| 39 | for f in "$tmp"/run/run.json "$tmp"/run/steps/*.json; do sed -i "s#@RUN@#$tmp/run#g" "$f"; done |
| 40 | jq '.report.committed = false' "$tmp/run/steps/S3.json" >"$tmp/s3" && cp "$tmp/s3" "$tmp/run/steps/S3.json" |
| 41 | rec() { # rec [extra env...] -> receipt path |
| 42 | local o; o=$(mktemp -d "$tmp/out.XXXX") |
| 43 | env "$@" V6_TASK=N1 V6_MAX_TOKENS=48 bash "$HERE/make-receipt.sh" "$tmp/run" "$o" t t t 0 >"$o.sum" 2>"$o.err" \ |
| 44 | || { echo "make-receipt.sh failed:"; cat "$o.err"; exit 1; } |
| 45 | ls "$o"/*.json |
| 46 | } |
| 47 | c3() { jq -r '[.acceptance_v6[] | select(.row == "N1-C")][0].value.s3_committed' "$1"; } |
| 48 | r6=$(rec); r7=$(rec V6_ROWS=rows-v7.jq) |
| 49 | check "default module: explicit false read as null (the v6 defect, unchanged)" "null" "$(c3 "$r6")" |
| 50 | check "default module: no v6_rows_module field" "null" "$(jq -r .v6_rows_module "$r6")" |
| 51 | check "V6_ROWS=rows-v7.jq: explicit false stays false" "false" "$(c3 "$r7")" |
| 52 | check "V6_ROWS=rows-v7.jq: receipt records the module" \ |
| 53 | "rows-v7.jq $(sha256sum "$HERE/rows-v7.jq" | cut -d' ' -f1)" "$(jq -r '"\(.v6_rows_module.file) \(.v6_rows_module.sha256)"' "$r7")" |
| 54 | check "V6_ROWS=rows-v7.jq: legacy verdict and other v6 rows as the default module" \ |
| 55 | "$(jq -c '[.verdict, (.acceptance_v6 | map(select(.row != "N1-C")) | map({row, result}))]' "$r6")" \ |
| 56 | "$(jq -c '[.verdict, (.acceptance_v6 | map(select(.row != "N1-C")) | map({row, result}))]' "$r7")" |
| 57 | check "V6_ROWS=anything else: refused" "refused" \ |
| 58 | "$(V6_ROWS=../rows-v6.jq V6_TASK=N1 bash "$HERE/make-receipt.sh" "$tmp/run" "$tmp/out-bad" t t t 0 >/dev/null 2>&1 && echo accepted || echo refused)" |
| 59 | |
| 60 | # ---- 2. run-v7.sh is run-v6.sh plus the v7 wiring ------------------------------ |
| 61 | check "run-v7.sh: only the v7 wiring lines differ from run-v6.sh" "5c5 7c7 10c10 29,31c29,31 42,43c42,43" \ |
| 62 | "$(diff <(sed -n '12,$p' "$HERE/run-v6.sh") <(sed -n '14,$p' "$HERE/run-v7.sh") | grep -E '^[0-9]' | paste -sd' ')" |
| 63 | check "run-v7.sh: v7 module, declaration and spec" "1 1 1" \ |
| 64 | "$(for p in 'V6_ROWS=rows-v7.jq V6_TASK=' 'declarations/np1-v7.decl.json' 'SPEC="ACCEPTANCE-v7.md spec_version 7"'; do grep -cF -- "$p" "$HERE/run-v7.sh"; done | paste -sd' ')" |
| 65 | |
| 66 | # ---- 3. the v7 declaration ------------------------------------------------------ |
| 67 | D=$HERE/../scoring/declarations |
| 68 | check "np1-v7.decl.json: same 73 rows as np1-v6" "73 true" \ |
| 69 | "$(jq -r --slurpfile v6 "$D/np1-v6.decl.json" '"\(.rows | length) \([.rows[].row] == [$v6[0].rows[].row])"' "$D/np1-v7.decl.json")" |
| 70 | |
| 71 | echo "test-wiring-v7: $pass passed, $fail failed" |
| 72 | [ "$fail" = 0 ] |