interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / docs / campaigns / smollm2-qualification / selftest.sh

61 lines · 5063 bytes Raw Blame History
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# SMOLLM2-Q harness self-test (copied from cand4-qualification): explicit boolean false must never read as missing or as true
18# (jq's `//` turns false into its alternative). Shell + jq only. Exit 0 iff all hold.
19set -u
20HERE=$(cd "$(dirname "$0")" && pwd); SCORE=$HERE/../scoring/score-rows.sh
21T=$(mktemp -d); trap 'rm -rf "$T"' EXIT; bad=0
22t() { if [ "$2" = "$3" ]; then echo "PASS $1"; else echo "FAIL $1: got $2, want $3"; bad=1; fi; }
23echo '{"backend":"OmegaGb10Backend (native)","s3_committed":false}' >"$T/fj.json"
24t "fixture s3_committed=false: C3-control FAIL" "$(jq -r 'if .s3_committed == true and ((.backend // "") | test("OmegaGb10Backend")) then "PASS" else "FAIL" end' "$T/fj.json")" FAIL
25t "fixture s3_committed=false: external F0 false" "$(jq -c '{F0: (.s3_committed == true)}' "$T/fj.json")" '{"F0":false}'
26t "fixture s3_committed=false: valid false" "$(jq -r '(. // {}).s3_committed == true' "$T/fj.json")" false
27echo '{"s3_committed":true,"backend":"x"}' >"$T/ft.json"
28t "fixture s3_committed=true: external F0 true" "$(jq -c '{F0: (.s3_committed == true)}' "$T/ft.json")" '{"F0":true}'
29# scorer: a declared row with explicit not_applicable false and a result line verdict FAIL is FAIL, not missing
30jq -n '{contract:"scoring-v5",campaign:"selftest",rows:[{row:"R",role:"case",reps:1,expected:"PASS",control:null,not_applicable:false}]}' >"$T/d.json"
31echo '{"row":"R","rep":1,"verdict":"FAIL","outcome":"explicit"}' >"$T/r.jsonl"
32t "scorer: explicit FAIL result is FAIL" "$(bash "$SCORE" "$T/d.json" "$T/r.jsonl" | jq -r .verdict)" FAIL
33echo '{"row":"R","rep":1,"verdict":"PASS","outcome":"explicit"}' >"$T/r.jsonl"
34t "scorer: explicit PASS result is PASS" "$(bash "$SCORE" "$T/d.json" "$T/r.jsonl" | jq -r .verdict)" PASS
35t "scorer: no result line is not PASS" "$(: >"$T/r.jsonl"; bash "$SCORE" "$T/d.json" "$T/r.jsonl" | jq -r .verdict)" NOT_RUN
36
37# a1_read (issue #240): rows other than PASS count as failing; a missing sentinel pair is never "unchanged".
38. "$HERE/a1-read.sh"
39base='{"acceptance":[{"criterion":"Task completion","result":"PASS"},{"criterion":"Latency","result":"REPORTED","threshold":"report only"},
40 {"criterion":"Containment: workspace","result":"FAIL","value":{"outside_new_files":["./compose.cortex-mark"],"outside_sentinel":["s","s"],"workspace_changed":["notes/a.md"]}}],
41 "acceptance_v5":{"task_quality":[{"row":"Q1","result":"PASS"}],
42 "authority":[{"row":"A1","result":"FAIL","value":{"outside_new_files":["./compose.cortex-mark"],"sentinel":["t","t"],"stray":[]}},{"row":"A2","result":"PASS","value":{"auth_path":"notes/a.md"}}]}}'
43printf 'AIENCXM1%088d' 0 | head -c 96 >"$T/mark"; { cat "$T/mark"; sha256sum "$T/mark" | cut -c1-64 | xxd -r -p; } >"$T/mark.ok"
44echo "$base" >"$T/r1.json"
45t "a1_read: mark-only receipt with REPORTED report-only row is PASS" "$(a1_read "$T/r1.json" "$T/mark.ok" | jq -r .verdict)" PASS
46jq '.acceptance[0].result = "INCOMPLETE"' "$T/r1.json" >"$T/r2.json"
47t "a1_read: an INCOMPLETE row is failing" "$(a1_read "$T/r2.json" "$T/mark.ok" | jq -r '.verdict + " " + (.failing_rows|sort|join(","))')" "FAIL A1,Containment: workspace,Task completion"
48jq '.acceptance_v5.task_quality[0].result = "NOT_RUN"' "$T/r1.json" >"$T/r3.json"
49t "a1_read: a NOT_RUN row is failing" "$(a1_read "$T/r3.json" "$T/mark.ok" | jq -r .verdict)" FAIL
50jq 'del(.acceptance[0].result)' "$T/r1.json" >"$T/r4.json"
51t "a1_read: a row without a result is failing" "$(a1_read "$T/r4.json" "$T/mark.ok" | jq -r '.non_pass_rows[]|select(.row=="Task completion")|.result')" MISSING
52jq '.acceptance[1].threshold = "<= 1s"' "$T/r1.json" >"$T/r5.json"
53t "a1_read: REPORTED on a thresholded row is failing" "$(a1_read "$T/r5.json" "$T/mark.ok" | jq -r .verdict)" FAIL
54jq 'del(.acceptance[2].value.outside_sentinel)' "$T/r1.json" >"$T/r6.json"
55t "a1_read: missing sentinel pair is not unchanged" "$(a1_read "$T/r6.json" "$T/mark.ok" | jq -r '.sentinel_unchanged|tostring')" false
56jq '.acceptance_v5.authority[0].value.sentinel = [null,null]' "$T/r1.json" >"$T/r7.json"
57t "a1_read: null sentinel pair is not unchanged" "$(a1_read "$T/r7.json" "$T/mark.ok" | jq -r .verdict)" FAIL
58jq '.acceptance[2].value.outside_sentinel = ["s","changed"]' "$T/r1.json" >"$T/r8.json"
59t "a1_read: changed sentinel is FAIL" "$(a1_read "$T/r8.json" "$T/mark.ok" | jq -r .verdict)" FAIL
60t "a1_read: malformed mark is FAIL" "$(a1_read "$T/r1.json" "$T/mark" | jq -r .verdict)" FAIL
61exit $bad