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-2 / make-receipt.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-2 receipt (ACCEPTANCE-v4 section 6 over v3 section 6, superseding v2) from |
| 18 | # one fixture F0 and one `run-faults.sh cases` run root. Shell + jq only. Usage: |
| 19 | # make-receipt.sh FIX_ROOT RUN_ROOT OUT_DIR SC_COMMIT OMEGA_COMPOSE_COMMIT GPU_BIN CPU_BIN \ |
| 20 | # BUILD_ENV_JSON LINK_PROOF_JSON [NOTE] |
| 21 | # FIXTURE_KIND=F0v4 (default) or F0v3-fallback (ACCEPTANCE-v4 section 4: the C3 |
| 22 | # control is then NOT_RUN). FIX_OLD = the F0v2 root used by C8a (recorded). |
| 23 | # Writes OUT_DIR/<sha256 of content>.json (never edited afterwards), appends one |
| 24 | # line to OUT_DIR/INDEX.md, writes OUT_DIR/<sha256>.summary.txt, prints it. |
| 25 | # Row verdicts: a row PASSes only if every repetition PASSes and its uninjected |
| 26 | # control passed; a failed control or a variant that could not be injected is |
| 27 | # NOT_RUN; NOT_RUN is never PASS. C6d may be NOT_APPLICABLE (its guard), which |
| 28 | # is named in the verdict and never counted as a PASS. |
| 29 | set -eu |
| 30 | FIX=$1 R=$2 OUT=$3 SC=$4 OMC=$5 GPU=$6 CPU=$7 BENV=$8 LPROOF=$9 NOTE=${10:-} |
| 31 | KIND=${FIXTURE_KIND:-F0v4} |
| 32 | old=null |
| 33 | if [ -n "${FIX_OLD:-}" ]; then old=$(jq -c '{sha256:.files_sha256, s3_committed, machine_id, backend}' "$FIX_OLD/fixture.json"); fi |
| 34 | mkdir -p "$OUT" |
| 35 | sha() { sha256sum "$1" | cut -d' ' -f1; } |
| 36 | fixture=$(jq -c --arg fj "$(sha "$FIX/fixture.json")" --arg s3 "$(sha "$FIX/steps/S3.json")" \ |
| 37 | --arg log "$(sha "$FIX/daemon-fixture.log")" \ |
| 38 | '{sha256:.files_sha256, s3_committed, machine_id, proposal_path, backend, daemon_start_ms, |
| 39 | evidence_digests:[{file:"fixture.json", sha256:$fj}, {file:"steps/S3.json", sha256:$s3}, {file:"daemon-fixture.log", sha256:$log}]}' \ |
| 40 | "$FIX/fixture.json") |
| 41 | tmp=$(mktemp "$OUT/.receipt.XXXXXX") |
| 42 | jq -n --slurpfile runs "$R/results.jsonl" --argjson fixture "$fixture" --arg sc "$SC" --arg omc "$OMC" \ |
| 43 | --arg gpu "$(sha "$GPU")" --arg cpu "$(sha "$CPU")" --arg note "$NOTE" --arg kind "$KIND" \ |
| 44 | --argjson old "$old" --slurpfile benv "$BENV" --slurpfile lproof "$LPROOF" ' |
| 45 | def control_of($row): if ($row | startswith("C3")) then "F0" |
| 46 | else "control-" + ($row | capture("^(?<c>C[0-9])").c) end; |
| 47 | ($runs | map(select(.row | startswith("control-")))) as $controls |
| 48 | | ($fixture.s3_committed == true) as $f0 |
| 49 | | (($fixture.backend // "") | test("OmegaGb10Backend")) as $c3ok |
| 50 | | [ "C1a","C1b","C2a","C2b","C2c","C2d","C3a","C3b","C4","C5a","C5b","C5c", |
| 51 | "C6a","C6b","C6c","C6c-ctl","C6d","C6e","C6f","C6g","C6h","C6i", |
| 52 | "C7a","C7b","C7c","C8a","C8b" ] as $order |
| 53 | | ($order | map(. as $row |
| 54 | | ($runs | map(select(.row == $row))) as $reps |
| 55 | | (control_of($row)) as $c |
| 56 | | (if $c == "F0" then $f0 else ($controls | map(select(.row == $c)) | (length > 0 and all(.verdict == "PASS"))) end) as $cok |
| 57 | | {row:$row, control:$c, control_pass:$cok, reps:($reps | length), |
| 58 | verdict:(if ($reps | length) == 0 or ($cok | not) or ($reps | any(.verdict == "NOT_RUN")) then "NOT_RUN" |
| 59 | elif ($reps | all(.verdict == "PASS")) then "PASS" |
| 60 | elif $row == "C6d" and ($reps | all(.verdict == "PASS" or .verdict == "NOT_APPLICABLE")) then "NOT_APPLICABLE" |
| 61 | else "FAIL" end), |
| 62 | outcomes:($reps | map(.outcome) | unique)})) as $rowv |
| 63 | | ($rowv + [{row:"C3 control", control:"F0", control_pass:$f0, reps:1, |
| 64 | verdict:(if $kind != "F0v4" then "NOT_RUN" elif $f0 and $c3ok then "PASS" else "FAIL" end), |
| 65 | outcomes:[(if $kind != "F0v4" then "fixture " + $kind + " (pre-registered fallback): " else "" end) |
| 66 | + "gpu daemon with AIEN_REQUIRE_BLACKWELL=1: " + ($fixture.backend // "none")]}]) as $all |
| 67 | | { |
| 68 | gate:"NEXT_PHASE_2", |
| 69 | commit:$sc, |
| 70 | omega_compose_commit:$omc, |
| 71 | acceptance_spec:"docs/campaigns/next-phase-2/ACCEPTANCE-v4.md spec_version 4 (amends ACCEPTANCE-v3.md, which amends ACCEPTANCE-v2.md)", |
| 72 | builds:[{name:"gpu", sha256:$gpu}, {name:"cpu-fault", sha256:$cpu}], |
| 73 | build_env:$benv[0], |
| 74 | link_proof:$lproof[0], |
| 75 | fixture:($fixture + {kind:$kind}), |
| 76 | old_install_fixture_c8a:$old, |
| 77 | verdict:(if $f0 and ($all | all(.verdict == "PASS" or (.row == "C6d" and .verdict == "NOT_APPLICABLE"))) then "PASS" else "FAIL" end), |
| 78 | not_applicable:($all | map(select(.verdict == "NOT_APPLICABLE") | .row)), |
| 79 | row_verdicts:$all, |
| 80 | controls:($controls | map({row, rep, injected_at, outcome, verdict, checks, evidence_digests})), |
| 81 | rows:($runs | map(select(.row | startswith("control-") | not)) |
| 82 | | map({row, rep, injected_at, outcome, verdict, checks, evidence_digests})), |
| 83 | not_proved:[ |
| 84 | "runtime loss of the GPU in a GPU-linked build", |
| 85 | "omega in-settle crash hooks (A12)", |
| 86 | "caproot revoke on the effect path (A11)", |
| 87 | "Cortex and J-Space rolled back together (omega known limit)", |
| 88 | "torn writes below the file level", |
| 89 | "tamper resistance of the record mark (journal and mark rewritten together, mark deleted then journal cut, compose dir and mark rolled back together)", |
| 90 | "a real process kill between an append and its mark update (C6c-ctl reproduces the on-disk state only)", |
| 91 | "J-Space spill damage while compose never spills (C6d)", |
| 92 | "the Err(e) arm of server.rs (Reconcile: failed:), unreachable in release builds (panic = abort)", |
| 93 | "the cause of a real start-up panic (C7c proves only that the daemon stops before serving and writes nothing)"], |
| 94 | note:(if $note == "" then null else $note end) |
| 95 | }' >"$tmp" |
| 96 | h=$(sha256sum "$tmp" | cut -d' ' -f1) |
| 97 | mv "$tmp" "$OUT/$h.json" |
| 98 | v=$(jq -r .verdict "$OUT/$h.json") |
| 99 | { |
| 100 | echo "NEXT_PHASE_2 receipt $h.json verdict $v" |
| 101 | echo "sovereign-core $SC; omega compose $OMC" |
| 102 | jq -r '.builds[] | "build \(.name) \(.sha256)"' "$OUT/$h.json" |
| 103 | jq -r '.fixture | "fixture F0 \(.sha256): s3_committed \(.s3_committed), machine \(.machine_id), backend \(.backend)"' "$OUT/$h.json" |
| 104 | echo "Rows (ACCEPTANCE-v4 section 5 over v3 and v2; injected variants x3, C6i once, control once per case):" |
| 105 | jq -r '"build_env: \(.build_env | tojson)"' "$OUT/$h.json" |
| 106 | jq -r '"link_proof: \(.link_proof | tojson | .[0:400])"' "$OUT/$h.json" |
| 107 | jq -r 'if (.not_applicable | length) > 0 then "NOT_APPLICABLE (not counted as PASS): \(.not_applicable | join(", "))" else empty end' "$OUT/$h.json" |
| 108 | jq -r '.row_verdicts[] | " \(.verdict) \(.row) (\(.reps) run(s), control \(.control) \(if .control_pass then "PASS" else "FAIL" end)) \(.outcomes | join(" | ") | .[0:200])"' "$OUT/$h.json" |
| 109 | echo "Failed checks:" |
| 110 | jq -r '(.controls + .rows)[] | . as $r | .checks[] | select(.ok | not) | " \($r.row) rep \($r.rep): \(.check) \(.value | tojson | .[0:160])"' "$OUT/$h.json" |
| 111 | echo "Not proved (declared): $(jq -r '.not_proved | join("; ")' "$OUT/$h.json")" |
| 112 | if [ -n "$NOTE" ]; then echo "Note: $NOTE"; fi |
| 113 | } >"$OUT/$h.summary.txt" |
| 114 | [ -f "$OUT/INDEX.md" ] || printf '# NEXT-PHASE-2 campaign receipts\n\nEach receipt is named by the sha256 of its content and never edited.\n\n' >"$OUT/INDEX.md" |
| 115 | echo "- \`$h.json\` verdict $v, sovereign-core $SC ($(date -u +%Y-%m-%dT%H:%MZ))" >>"$OUT/INDEX.md" |
| 116 | cat "$OUT/$h.summary.txt" |