omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / qualify_visor.sh
| 1 | #!/bin/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 | # qualify_visor.sh -- Omega Visor V1 qualification glue (lane 8). |
| 18 | # |
| 19 | # tools/qualify_visor.sh [--skip-regression] [--no-asan] [out-dir] (default out-dir: evidence/VISOR) |
| 20 | # |
| 21 | # Runs the make targets and tests/visor/qualification/run_qualification.sh, collects |
| 22 | # their counts and writes ONE new receipt <out-dir>/<sha256 of its own bytes>.json. |
| 23 | # Every assertion lives in the C tests, the .omega-session goldens and the runner; this |
| 24 | # script only runs, counts and records. It never rewrites a tracked file: nothing under |
| 25 | # evidence/ is modified, only the new content-addressed receipt is added. A plain-text |
| 26 | # gate summary goes to stdout. |
| 27 | # |
| 28 | # Steps (all make / test runs wrapped in `flock $BENCH_LOCK`): |
| 29 | # 0. the Aienux capability library, rebuilt from `git archive` of the commit in |
| 30 | # aienos.lock (AIENOS_REPO, default ~/workspace/aienos-repo), as |
| 31 | # tools/effect_cap64_receipt.sh and CI do; its identity goes into the receipt |
| 32 | # 1. physics-free omega binary (build/q8r) + physics-free Visor suites and link checks |
| 33 | # 2. runtime-linked suites test-visor-world, test-visor-authority (pinned library) |
| 34 | # 3. CPU regression gates (build/q8reg); GPU/silicon targets are never run |
| 35 | # 4. the console campaign (runner) on the release binary, then on an ASan+UBSan build |
| 36 | # 5. five gates -> verdict OMEGA_VISOR_V1_PASS / OMEGA_VISOR_V1_FAIL |
| 37 | # Verdict PASS needs all five gates PASS, a tree that did not change during the run |
| 38 | # (HEAD and each dirty file's sha256), the Aienux library built from aienos.lock and the |
| 39 | # physics checkout at physics.lock. The ASan pass is recorded but, as before, does not |
| 40 | # gate the verdict. Builds only into private OUT_DIRs; never touches build/ itself |
| 41 | # (except the pre-existing test-m5 QEMU path, see non_claims). |
| 42 | # Shell and coreutils only (git, sha256sum, grep, sed, awk, sort, tar, make, flock). |
| 43 | set -u |
| 44 | LC_ALL=C |
| 45 | export LC_ALL |
| 46 | |
| 47 | HERE=$(cd "$(dirname "$0")/.." && pwd) |
| 48 | cd "$HERE" || exit 2 |
| 49 | |
| 50 | SKIP_REG=0 |
| 51 | NO_ASAN=0 |
| 52 | OUTDIR=evidence/VISOR |
| 53 | for a in "$@"; do |
| 54 | case "$a" in |
| 55 | --skip-regression) SKIP_REG=1 ;; |
| 56 | --no-asan) NO_ASAN=1 ;; |
| 57 | -h|--help) sed -n '2,4p' "$0"; exit 0 ;; |
| 58 | -*) echo "usage: tools/qualify_visor.sh [--skip-regression] [--no-asan] [out-dir]" >&2; exit 2 ;; |
| 59 | *) OUTDIR=$a ;; |
| 60 | esac |
| 61 | done |
| 62 | |
| 63 | AIENOS_REPO=${AIENOS_REPO:-$HOME/workspace/aienos-repo} |
| 64 | PHYSICS_DIR=${PHYSICS_DIR:-$HOME/workspace/physics-r13} |
| 65 | BENCH_LOCK=${BENCH_LOCK:-$HOME/workspace/.argus-bench.lock} |
| 66 | OUT=build/q8r |
| 67 | ASAN_OUT=build/q8asan |
| 68 | REG_OUT=build/q8reg |
| 69 | Q=build/q8q |
| 70 | LOGS=$Q/logs |
| 71 | REASONS=() |
| 72 | |
| 73 | json_str() { # JSON string body: escape \ and ", tabs; drop other control bytes; join lines with \n |
| 74 | printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/\t/\\t/g' | tr -d '\000-\010\013-\037' | |
| 75 | awk 'BEGIN{ORS=""} {if (NR>1) print "\\n"; print}' |
| 76 | } |
| 77 | |
| 78 | tree_state() { # -> "<dirty-file JSON array body>" ; one element per `git status --short` line |
| 79 | local line st path sha out="" |
| 80 | while IFS= read -r line; do |
| 81 | [ -n "$line" ] || continue |
| 82 | st=$(printf '%s' "${line:0:2}" | tr -d ' ') |
| 83 | path=${line:3} |
| 84 | if [ -f "$path" ]; then sha="\"$(sha256sum "$path" | awk '{print $1}')\""; else sha=null; fi |
| 85 | out+="${out:+, }{\"status\": \"$(json_str "$st")\", \"path\": \"$(json_str "$path")\", \"sha256\": $sha}" |
| 86 | done < <(git status --short) |
| 87 | printf '%s' "$out" |
| 88 | } |
| 89 | |
| 90 | run_id=$(date -u +%Y%m%dT%H%M%SZ) |
| 91 | head0=$(git rev-parse HEAD) |
| 92 | tree0=$(git rev-parse 'HEAD^{tree}') |
| 93 | st0=$(git status --short) |
| 94 | files0=$(tree_state) |
| 95 | |
| 96 | rm -rf "$Q" && mkdir -p "$LOGS" "$Q/aienos" |
| 97 | |
| 98 | # ---- pins ------------------------------------------------------------------- |
| 99 | aienos_pin=$(awk 'NF && $1 !~ /^#/ {print $1; exit}' aienos.lock) |
| 100 | physics_pin=$(awk 'NF && $1 !~ /^#/ {print $1; exit}' physics.lock) |
| 101 | physics_head=$(git -C "$PHYSICS_DIR" rev-parse HEAD 2>/dev/null || echo missing) |
| 102 | [ "$physics_head" = "$physics_pin" ] || REASONS+=("physics checkout $PHYSICS_DIR at $physics_head != physics.lock $physics_pin") |
| 103 | |
| 104 | aienos_src_tree=$(git -C "$AIENOS_REPO" rev-parse "$aienos_pin:native/capability" 2>/dev/null || echo missing) |
| 105 | if git -C "$AIENOS_REPO" archive "$aienos_pin" native/capability | tar -x -C "$Q/aienos" && |
| 106 | flock "$BENCH_LOCK" make -C "$Q/aienos/native/capability" > "$LOGS/aienos-lib.log" 2>&1; then |
| 107 | lib_ok=1 |
| 108 | else |
| 109 | lib_ok=0 |
| 110 | REASONS+=("AIENOS capability library did not build from aienos.lock $aienos_pin ($AIENOS_REPO)") |
| 111 | fi |
| 112 | LIB=$Q/aienos/native/capability/out/libaienos_capability.a |
| 113 | lib_sha=null; [ -f "$LIB" ] && lib_sha="\"$(sha256sum "$LIB" | awk '{print $1}')\"" |
| 114 | hdr_sha=null; [ -f "$Q/aienos/native/capability/aienos_capability.h" ] && |
| 115 | hdr_sha="\"$(sha256sum "$Q/aienos/native/capability/aienos_capability.h" | awk '{print $1}')\"" |
| 116 | |
| 117 | # ---- suites ----------------------------------------------------------------- |
| 118 | PF=(PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 AIENOS_R7_DIR="$HERE/$Q/aienos") |
| 119 | RT=(PHYSICS_DIR="$PHYSICS_DIR" AIENOS_R7_DIR="$HERE/$Q/aienos" VISOR_AUTH_CAP_LIB="$HERE/$LIB") |
| 120 | FREE_SUITES=(test-visor-semantic test-language test-visor-verify test-visor-evidence |
| 121 | test-visor-machine test-visor-realization test-visor-console) |
| 122 | LINKED_SUITES=(test-visor-world test-visor-authority) |
| 123 | REGRESSION=(test test-m5 test-m6 test-m7 test-m8 test-m9 test-m10 test-m13 test-m14) |
| 124 | NEVER=("test-m12|GPU (living matvec)" "test-m15|accelerator/GPU" "test-m17|Blackwell GPU" |
| 125 | "test-m18|GPU" "test-m19|GPU") |
| 126 | |
| 127 | declare -A STATUS RUN FAILED |
| 128 | SUITES_JSON="" |
| 129 | |
| 130 | counts() { # "PASS n/m" / "FAIL n/m" lines + omegatool "TOTAL GATES: n | PASSED: n | FAILED: n" -> "run failed" |
| 131 | awk '/^(PASS|FAIL)[ \t]+[0-9]+\/[0-9]+[ \t]*$/ { split($2, x, "/"); r += x[2]; f += x[2] - x[1] } |
| 132 | { s = $0 |
| 133 | while (match(s, /TOTAL GATES:[ \t]*[0-9]+[ \t]*\|[ \t]*PASSED:[ \t]*[0-9]+[ \t]*\|[ \t]*FAILED:[ \t]*[0-9]+/)) { |
| 134 | m = substr(s, RSTART, RLENGTH); s = substr(s, RSTART + RLENGTH) |
| 135 | split(m, p, "|"); t = p[1]; u = p[3]; gsub(/[^0-9]/, "", t); gsub(/[^0-9]/, "", u) |
| 136 | r += t; f += u } } |
| 137 | END { printf "%d %d\n", r, f }' "$1" |
| 138 | } |
| 139 | |
| 140 | suite() { # suite <target> <out-dir> <make args...> |
| 141 | local name=$1 out=$2 log=$LOGS/$1.log rc n f status marker="" |
| 142 | shift 2 |
| 143 | flock "$BENCH_LOCK" make OUT_DIR="$out" "$@" "$name" > "$log" 2>&1 |
| 144 | rc=$? |
| 145 | case "$name" in |
| 146 | visor-authority-check) marker=OMEGA_VISOR_AUTHORITY_ISOLATION_PASS ;; |
| 147 | visor-physics-free-check) marker=OMEGA_VISOR_PHYSICS_FREE_BUILD_PASS ;; |
| 148 | esac |
| 149 | if [ -n "$marker" ]; then |
| 150 | n=1; f=1; { grep -aq "$marker" "$log" && [ "$rc" -eq 0 ]; } && f=0 |
| 151 | else |
| 152 | read -r n f < <(counts "$log") |
| 153 | fi |
| 154 | status=FAIL |
| 155 | [ "$rc" -eq 0 ] && [ "$n" -gt 0 ] && [ "$f" -eq 0 ] && status=PASS |
| 156 | STATUS[$name]=$status; RUN[$name]=$n; FAILED[$name]=$f |
| 157 | SUITES_JSON+="${SUITES_JSON:+,} |
| 158 | {\"target\": \"$name\", \"rc\": $rc, \"tests_run\": $n, \"tests_failed\": $f, \"status\": \"$status\", \"log_sha256\": \"$(sha256sum "$log" | awk '{print $1}')\"}" |
| 159 | echo "suite $name: $status (rc=$rc run=$n failed=$f)" >&2 |
| 160 | } |
| 161 | |
| 162 | not_run() { # not_run <target> <reason> |
| 163 | STATUS[$1]=NOT_RUN |
| 164 | SUITES_JSON+="${SUITES_JSON:+,} |
| 165 | {\"target\": \"$1\", \"status\": \"NOT_RUN\", \"reason\": \"$(json_str "$2")\"}" |
| 166 | } |
| 167 | |
| 168 | # 1. physics-free omega binary + physics-free suites (fresh private OUT_DIR) |
| 169 | rm -rf "$OUT" |
| 170 | flock "$BENCH_LOCK" make OUT_DIR="$OUT" "${PF[@]}" "$OUT/omega" > "$LOGS/omega-build.log" 2>&1 |
| 171 | binary_rc=$? |
| 172 | for t in "${FREE_SUITES[@]}" visor-authority-check visor-physics-free-check; do suite "$t" "$OUT" "${PF[@]}"; done |
| 173 | # 2. runtime-linked suites (Aienux capability library pinned by aienos.lock) |
| 174 | for t in "${LINKED_SUITES[@]}"; do suite "$t" "$OUT" "${RT[@]}"; done |
| 175 | # 3. regression (CPU gates only) |
| 176 | for t in "${REGRESSION[@]}"; do |
| 177 | if [ "$SKIP_REG" -eq 1 ]; then not_run "$t" "--skip-regression"; else suite "$t" "$REG_OUT" "${RT[@]}"; fi |
| 178 | done |
| 179 | for e in "${NEVER[@]}"; do not_run "${e%%|*}" "GPU/silicon target excluded by lane-8 brief: ${e#*|}"; done |
| 180 | not_run test-m11 "not in the lane-8 regression list" |
| 181 | |
| 182 | # 4. console campaign (runner) on the release binary, then on an ASan+UBSan build |
| 183 | failed_cases() { # runner log -> "section<TAB>case<TAB>detail" for every QUAL ... FAIL line |
| 184 | awk '/^QUAL / { sec = $2; rest = substr($0, length("QUAL " sec " ") + 1) |
| 185 | fi = index(rest, " FAIL"); pi = index(rest, " PASS") |
| 186 | if (fi > 1 && (pi == 0 || fi < pi)) { |
| 187 | d = substr(rest, fi + 5); sub(/^ /, "", d) |
| 188 | printf "%s\t%s\t%s\n", sec, substr(rest, 1, fi - 1), d } }' "$1" |
| 189 | } |
| 190 | RLOG=$LOGS/runner.log |
| 191 | flock "$BENCH_LOCK" env QUAL_WORK="$OUT/qual-work" bash tests/visor/qualification/run_qualification.sh "$OUT/omega" > "$RLOG" 2>&1 |
| 192 | runner_rc=$? |
| 193 | declare -A SEC_RUN SEC_FAILED |
| 194 | SECTIONS_JSON="" |
| 195 | while read -r _ sec r f; do |
| 196 | r=${r#run=}; f=${f#failed=} |
| 197 | SEC_RUN[$sec]=$r; SEC_FAILED[$sec]=$f |
| 198 | SECTIONS_JSON+="${SECTIONS_JSON:+, }\"$sec\": {\"run\": $r, \"failed\": $f}" |
| 199 | done < <(grep -aE '^QUAL_SECTION [^ ]+ run=[0-9]+ failed=[0-9]+$' "$RLOG") |
| 200 | hline=$(grep -aE '^QUAL_HOSTILE run=[0-9]+ failed_closed=[0-9]+ crashed=[0-9]+ noop=[0-9]+$' "$RLOG" | tail -n 1) |
| 201 | dline=$(grep -aE '^QUAL_DETERMINISM runs=[0-9]+ identical=[A-Za-z0-9_]+$' "$RLOG" | tail -n 1) |
| 202 | field() { printf '%s\n' "$1" | tr ' ' '\n' | awk -F= -v k="$2" '$1 == k {print $2; exit}'; } |
| 203 | if [ -n "$hline" ]; then |
| 204 | hostile_json="{\"run\": $(field "$hline" run), \"failed_closed\": $(field "$hline" failed_closed), \"crashed\": $(field "$hline" crashed), \"benign_noop\": $(field "$hline" noop), |
| 205 | \"note\": \"benign_noop = blank/whitespace/comment lines, a spec'd no-op (exit 0); the rest must exit 1 with an error line\"}" |
| 206 | else |
| 207 | hostile_json=null |
| 208 | fi |
| 209 | if [ -n "$dline" ]; then |
| 210 | det_ident=false; [ "$(field "$dline" identical)" = yes ] && det_ident=true |
| 211 | det_json="{\"runs\": $(field "$dline" runs), \"identical\": $det_ident, \"scope\": \"same host, fresh processes; text, --json and realization ids\"}" |
| 212 | else |
| 213 | det_json=null |
| 214 | fi |
| 215 | FAILED_CASES=$(failed_cases "$RLOG") |
| 216 | FAILED_JSON="" |
| 217 | while IFS=$'\t' read -r sec name detail; do |
| 218 | [ -n "$sec" ] || continue |
| 219 | FAILED_JSON+="${FAILED_JSON:+,} |
| 220 | {\"section\": \"$(json_str "$sec")\", \"case\": \"$(json_str "$name")\", \"detail\": \"$(json_str "$detail")\"}" |
| 221 | done <<< "$FAILED_CASES" |
| 222 | |
| 223 | asan_json='{"status": "NOT_RUN"}' |
| 224 | if [ "$NO_ASAN" -eq 0 ]; then |
| 225 | rm -rf "$ASAN_OUT" |
| 226 | flock "$BENCH_LOCK" make OUT_DIR="$ASAN_OUT" "${PF[@]}" \ |
| 227 | "CC=cc -fsanitize=address,undefined -fno-omit-frame-pointer -g" "$ASAN_OUT/omega" > "$LOGS/asan-build.log" 2>&1 |
| 228 | asan_brc=$? |
| 229 | ALOG=$LOGS/runner-asan.log |
| 230 | flock "$BENCH_LOCK" env QUAL_WORK="$ASAN_OUT/qual-work" bash tests/visor/qualification/run_qualification.sh "$ASAN_OUT/omega" > "$ALOG" 2>&1 |
| 231 | asan_st=RUN; [ "$asan_brc" -eq 0 ] || asan_st=BUILD_FAILED |
| 232 | san=PRESENT_OR_UNKNOWN |
| 233 | grep -aqE '^QUAL hostile no-sanitizer-reports-in-any-transcript PASS' "$ALOG" && san=none |
| 234 | ahl=$(grep -aE '^QUAL_HOSTILE run=[0-9]+ failed_closed=[0-9]+ crashed=[0-9]+' "$ALOG" | tail -n 1) |
| 235 | acr=null; [ -n "$ahl" ] && acr=$(field "$ahl" crashed) |
| 236 | same=false |
| 237 | [ "$(failed_cases "$ALOG" | cut -f2 | sort)" = "$(printf '%s' "$FAILED_CASES" | cut -f2 | sort)" ] && same=true |
| 238 | asan_json="{\"status\": \"$asan_st\", \"sanitizer_reports\": \"$san\", \"crashed\": $acr, \"same_case_failures_as_release\": $same}" |
| 239 | fi |
| 240 | |
| 241 | files1=$(tree_state) |
| 242 | head1=$(git rev-parse HEAD) |
| 243 | stable=true |
| 244 | { [ "$head0" = "$head1" ] && [ "$files0" = "$files1" ]; } || stable=false |
| 245 | |
| 246 | # 5. gates |
| 247 | GATE_NAMES=(OMEGA_VISOR_SEMANTIC_PASS OMEGA_VISOR_VERIFY_PASS OMEGA_VISOR_REALIZE_PASS |
| 248 | OMEGA_VISOR_AUTHORITY_ISOLATION_PASS OMEGA_VISOR_REGRESSION_PASS) |
| 249 | declare -A G_SUITES G_SECTIONS |
| 250 | G_SUITES[OMEGA_VISOR_SEMANTIC_PASS]="test-visor-semantic test-language" |
| 251 | G_SECTIONS[OMEGA_VISOR_SEMANTIC_PASS]="semantic determinism" |
| 252 | G_SUITES[OMEGA_VISOR_VERIFY_PASS]="test-visor-verify test-visor-evidence test-visor-world" |
| 253 | G_SECTIONS[OMEGA_VISOR_VERIFY_PASS]="usability" |
| 254 | G_SUITES[OMEGA_VISOR_REALIZE_PASS]="test-visor-machine test-visor-realization test-visor-console" |
| 255 | G_SECTIONS[OMEGA_VISOR_REALIZE_PASS]="realize scriptability" |
| 256 | G_SUITES[OMEGA_VISOR_AUTHORITY_ISOLATION_PASS]="visor-authority-check test-visor-authority" |
| 257 | G_SECTIONS[OMEGA_VISOR_AUTHORITY_ISOLATION_PASS]="hostile authority" |
| 258 | G_SUITES[OMEGA_VISOR_REGRESSION_PASS]="${REGRESSION[*]} visor-physics-free-check" |
| 259 | G_SECTIONS[OMEGA_VISOR_REGRESSION_PASS]="" |
| 260 | |
| 261 | GATES_JSON="" |
| 262 | SUMMARY="" |
| 263 | all_pass=1 |
| 264 | for g in "${GATE_NAMES[@]}"; do |
| 265 | run=0; failed=0; srcs=""; notrun="" |
| 266 | for t in ${G_SUITES[$g]}; do |
| 267 | s=${STATUS[$t]:-NOT_RUN} |
| 268 | if [ "$s" = NOT_RUN ]; then notrun+="${notrun:+, }\"$t\""; continue; fi |
| 269 | run=$((run + RUN[$t])); failed=$((failed + FAILED[$t])) |
| 270 | [ "$s" = FAIL ] && [ "${FAILED[$t]}" -eq 0 ] && failed=$((failed + 1)) |
| 271 | srcs+="${srcs:+, }\"make $t\"" |
| 272 | done |
| 273 | for sec in ${G_SECTIONS[$g]}; do |
| 274 | if [ -n "${SEC_RUN[$sec]+x}" ]; then |
| 275 | run=$((run + SEC_RUN[$sec])); failed=$((failed + SEC_FAILED[$sec])) |
| 276 | srcs+="${srcs:+, }\"run_qualification.sh:$sec\"" |
| 277 | else |
| 278 | notrun+="${notrun:+, }\"runner:$sec\"" |
| 279 | fi |
| 280 | done |
| 281 | if [ "$run" -eq 0 ]; then st=NOT_RUN |
| 282 | elif [ "$failed" -eq 0 ] && [ -z "$notrun" ]; then st=PASS |
| 283 | else st=FAIL; fi |
| 284 | GATES_JSON+="${GATES_JSON:+,} |
| 285 | \"$g\": {\"status\": \"$st\", \"tests_run\": $run, \"tests_failed\": $failed, \"sources\": [$srcs]${notrun:+, \"not_run\": [$notrun]}}" |
| 286 | SUMMARY+="$g=$st ($run run, $failed failed)"$'\n' |
| 287 | if [ "$st" != PASS ]; then |
| 288 | all_pass=0 |
| 289 | REASONS+=("$g $st ($failed/$run failed${notrun:+; not run: $(printf '%s' "$notrun" | tr -d '"')})") |
| 290 | fi |
| 291 | done |
| 292 | while IFS=$'\t' read -r sec name detail; do |
| 293 | [ -n "$sec" ] && REASONS+=("runner $sec: $name FAIL ${detail:0:140}") |
| 294 | done <<< "$FAILED_CASES" |
| 295 | [ "$stable" = true ] || REASONS+=("tree changed during the run (HEAD or modified-file hashes differ): receipt INVALID") |
| 296 | |
| 297 | verdict=OMEGA_VISOR_V1_PASS |
| 298 | { [ "$all_pass" -eq 1 ] && [ "$stable" = true ] && [ "$lib_ok" -eq 1 ] && |
| 299 | [ "$physics_head" = "$physics_pin" ]; } || verdict=OMEGA_VISOR_V1_FAIL |
| 300 | |
| 301 | tree_dirty=false; [ -z "$st0" ] || tree_dirty=true |
| 302 | dirty_detail="see dirty_files" |
| 303 | if [ -n "$st0" ] && ! printf '%s\n' "$st0" | cut -c4- | |
| 304 | grep -qvE '^(tests/visor/qualification|tools/qualify_visor\.sh|evidence/VISOR)'; then |
| 305 | dirty_detail="only lane-8 files (untracked, not yet committed)" |
| 306 | fi |
| 307 | bin_json="\"built\": false, \"sha256\": null" |
| 308 | [ "$binary_rc" -eq 0 ] && [ -f "$OUT/omega" ] && |
| 309 | bin_json="\"built\": true, \"sha256\": \"$(sha256sum "$OUT/omega" | awk '{print $1}')\"" |
| 310 | scr_json=null |
| 311 | [ -n "${SEC_RUN[scriptability]+x}" ] && |
| 312 | scr_json="{\"run\": ${SEC_RUN[scriptability]}, \"failed\": ${SEC_FAILED[scriptability]}}" |
| 313 | reasons_json="" |
| 314 | for r in "${REASONS[@]}"; do reasons_json+="${reasons_json:+, |
| 315 | }\"$(json_str "$r")\""; done |
| 316 | product=$(cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null) |
| 317 | |
| 318 | body=$(cat <<EOF |
| 319 | { |
| 320 | "schema": "omega-visor-v1-qualification/1", |
| 321 | "tool": "tools/qualify_visor.sh", |
| 322 | "run_id": "$run_id", |
| 323 | "candidate_commit": "$head0", |
| 324 | "candidate_tree": "$tree0", |
| 325 | "tree_dirty": $tree_dirty, |
| 326 | "tree_dirty_detail": "$dirty_detail", |
| 327 | "dirty_files": [$files0], |
| 328 | "tree_stable_during_run": $stable, |
| 329 | "physics_commit": "$physics_pin", |
| 330 | "physics": {"lock": "$physics_pin", "checkout": "$(json_str "$PHYSICS_DIR")", "checkout_head": "$physics_head"}, |
| 331 | "aienos": {"lock": "$aienos_pin", "source": "git archive $aienos_pin native/capability (tree $aienos_src_tree)", "header_sha256": $hdr_sha, "lib_sha256": $lib_sha, "lib_built": $([ "$lib_ok" -eq 1 ] && echo true || echo false), |
| 332 | "used_by": "test-visor-authority (VISOR_AUTH_CAP_LIB) and every make run (AIENOS_R7_DIR)"}, |
| 333 | "host": {"uname_m": "$(uname -m)", "uname_r": "$(uname -r)", "product_name": "$(json_str "$product")"}, |
| 334 | "hardware_scope": "host-only: no GPU/silicon claim; no QEMU claim by the Visor (the pre-existing test-m5 gate runs its own QEMU check)", |
| 335 | "omega_binary": {"path": "$OUT/omega", $bin_json, |
| 336 | "build": "make OUT_DIR=$OUT PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 $OUT/omega"}, |
| 337 | "gates": {$GATES_JSON |
| 338 | }, |
| 339 | "suites": [$SUITES_JSON |
| 340 | ], |
| 341 | "runner_rc": $runner_rc, |
| 342 | "runner_log_sha256": "$(sha256sum "$RLOG" | awk '{print $1}')", |
| 343 | "runner_sections": {$SECTIONS_JSON}, |
| 344 | "runner_failed_cases": [$FAILED_JSON |
| 345 | ], |
| 346 | "hostile_cases": $hostile_json, |
| 347 | "sanitizer_pass": $asan_json, |
| 348 | "determinism": $det_json, |
| 349 | "scriptability": {"section": $scr_json, |
| 350 | "contract": "exit 0 = every line ok; 1 = at least one line errored; 2 = usage error or unopenable script; --json = one object per non-blank line with keys command/status/class/result/error; no prompt when stdin is not a tty; --script - reads stdin"}, |
| 351 | EOF |
| 352 | ) |
| 353 | body+=$'\n' |
| 354 | body+=$(cat <<'EOF' |
| 355 | "ux_findings": [ |
| 356 | "`true`/`false` echo as 1/0 although `type _` says bool; a user reads 1 as an integer.", |
| 357 | "`why <x>` is described as 'explain where x came from' but only explains realizations; on a value it says `use realize x first`, and `realize x` then refuses a value, a dead end.", |
| 358 | "Errors raised before parsing, and unknown commands, are labelled `unknown` (`error: unknown: invalid UTF-8 at byte 4`, `error: unknown: unknown command or invalid source line: 'authorize'`).", |
| 359 | "`id` prints the same hash three times (id, canonical_sha256) plus canonical_len; the relation is not explained.", |
| 360 | "After `realize _`, `_` silently becomes the realization, so `inspect _`/`type _` now refer to a different object than one line earlier.", |
| 361 | "Every u64 ADD has the same realization id (`realized` = the ADD operation, not the apply), so `x + y` and `x + 1` share one realization id; correct per spec but surprising in `bindings`/`compare`.", |
| 362 | "`run _ a b` (exactly all operands) on a binary-apply realization runs the operation on the given numbers, not on the object's operands (7+11 -> `run _ 1 2` prints 3); allowed by design after the D2 fix, but the output does not say the object's own operands were replaced.", |
| 363 | "Machine/realization output uses hex profile codes (`profile 0x01 vs machine 0x01`), `physics flag=set seal=builder-constant placeholder`, and C function names (`omega_machine_estimate_latency(...)`, `omega_exec_native_f3`) as explanations; not readable without the C source.", |
| 364 | "`verify` row INVARIANTS reports 399 generic checks that are 'not object-specific'; a user may read the PASS as evidence about their object.", |
| 365 | "`evidence <name>` for a session object always says `no evidence`: receipts are repository files, not linked to session objects; 'what evidence supports this object' cannot be answered in V1.", |
| 366 | "Blank lines produce no JSON object while comment-only lines produce one (`kind: none`); a script driver counting lines must know this.", |
| 367 | "Commands after `quit` in --command/--script mode are silently dropped (exit 0).", |
| 368 | "`--script /dev/null` (a character device, not a regular file) is accepted as an empty script (exit 0), although the round-2 note says non-regular files exit 2; harmless, but the claim and behaviour differ." |
| 369 | ], |
| 370 | "defects": [ |
| 371 | { |
| 372 | "id": "D1", |
| 373 | "severity": "high; FIXED in ec2ec0b (found at 4fab549)", |
| 374 | "what": "The ./omega shipped at commit 4fab549 (sha256 543d874d...d4d3) crashed on every realize/run path (exit 139 SIGSEGV in om_realization_show; 'stack smashing detected', exit 134). Cause: omega_main.d missing from VISOR_DEPS, so tools/omega.c was not rebuilt when src/visor/visor.h changed. ec2ec0b adds it; a clean-checkout build of 4fab549 was not tested." |
| 375 | }, |
| 376 | { |
| 377 | "id": "D2", |
| 378 | "severity": "medium; FIXED in d7e8a4c (open in receipt #1)", |
| 379 | "what": "`run` did not check arity: `run f` -> 1, `run f 5 6` -> 11, `run _ 1` -> 12, `run _ 1 2 3` -> 3, all exit 0. At d7e8a4c: 'program f takes 1 input; give it on the command line', 'program f takes 1 input; got 2', '_ takes 2 operands; got 1 (give none, or all 2)', '... got 3 ...'; exit 1." |
| 380 | }, |
| 381 | { |
| 382 | "id": "D3", |
| 383 | "severity": "low; FIXED in d7e8a4c", |
| 384 | "what": "`./omega --script /` exited 0; at d7e8a4c it prints 'error: --script: / is a directory' and exits 2." |
| 385 | }, |
| 386 | { |
| 387 | "id": "D4", |
| 388 | "severity": "cosmetic; FIXED in d7e8a4c", |
| 389 | "what": "Doubled 'alternatives:' prefix, `effects x` error without 'error:', help `graph [x]` and `let x = <expr>`, parser jargon for `authorize x`/`execute _`: all corrected (hostile.expected and usability.expected regenerated; the only other changed line is the `run <type-id>` message, now '... is not an APPLY; only pure binary u64 applies run in V1', still exit 1)." |
| 390 | } |
| 391 | ], |
| 392 | "non_claims": [ |
| 393 | "Host-only qualification on one DGX Spark (aarch64); no GPU, no silicon, no QEMU claim by the Visor.", |
| 394 | "No measured or qualified cost: the Visor fills only predicted (static) and estimated (assumed machine model) cost; measured/qualified are ABSENT by design.", |
| 395 | "Machine identity is the assumed canonical profile chosen from DMI, not an observed descriptor; the physics seal is a builder placeholder.", |
| 396 | "World is unattached in the omega binary: `world` observes nothing; the snapshot API is covered only by the runtime-linked test-visor-world.", |
| 397 | "Language V0 scope only: explicit-width unsigned integers, bool, let, + - * / & |, fn chains (x op c)...; realize/run cover u64 binary ADD/SUB/MUL/AND/OR only.", |
| 398 | "Effects: the language cannot build an EFFECT object, so `run` on an effect is not reachable from the console; effect-request refusal is covered only by the C hostile suite (test-visor-authority) and the link check.", |
| 399 | "GPU targets test-m12, test-m15, test-m17, test-m18, test-m19 and all Blackwell paths were not run (lane-8 brief); test-m11 was not in the list.", |
| 400 | "The pre-existing test-m5 gate launches QEMU and writes build/qemu_omega_runner.bin under the shared build/ directory (hard-coded path in omegatool).", |
| 401 | "The e2e session golden (tests/visor/sessions/e2e.expected) is compared host-independently only after ec2ec0b; the lane-8 goldens mask the machine block, machine name/id and estimated cycles.", |
| 402 | "Determinism is shown across fresh processes on this host only, not across hosts, compilers or ABIs (golden bytes are pinned to LP64/aarch64).", |
| 403 | "Visor V1 is not claimed safe against a hostile local user with write access to the binary or the evidence directory." |
| 404 | ] |
| 405 | EOF |
| 406 | ) |
| 407 | body+=$(cat <<EOF |
| 408 | , |
| 409 | "verdict": "$verdict", |
| 410 | "verdict_reasons": [$reasons_json] |
| 411 | } |
| 412 | EOF |
| 413 | ) |
| 414 | mkdir -p "$OUTDIR" |
| 415 | tmp=$(mktemp "$OUTDIR/.tmp-XXXXXX") |
| 416 | printf '%s\n' "$body" > "$tmp" |
| 417 | digest=$(sha256sum "$tmp" | awk '{print $1}') |
| 418 | final=$OUTDIR/$digest.json |
| 419 | if [ -e "$final" ]; then rm -f "$tmp"; else mv "$tmp" "$final"; fi |
| 420 | chmod 0644 "$final" |
| 421 | printf '%s' "$SUMMARY" |
| 422 | [ ${#REASONS[@]} -eq 0 ] || printf 'reason: %s\n' "${REASONS[@]}" |
| 423 | echo "RECEIPT $final" |
| 424 | echo "VERDICT $verdict" |
| 425 | [ "$verdict" = OMEGA_VISOR_V1_PASS ] |