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 / smollm2-qualification / a1-read.sh
| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | # a1_read RECEIPT MARK: the ACCEPTANCE-SMOLLM2-Q section 4.1 reading of a NEXT-PHASE-1 v5 receipt. |
| 17 | # Prints one JSON object with verdict PASS or FAIL. Sourced by run-smol2q.sh and selftest.sh. |
| 18 | # |
| 19 | # Hardened after the CAND-4 run (sovereign-core issue #240; the CAND-4 receipts are unchanged): |
| 20 | # - failing_rows lists every acceptance row whose result is not PASS (INCOMPLETE, NOT_RUN, a |
| 21 | # missing result ... all count as failing), except a row declared NOT_APPLICABLE and a |
| 22 | # report-only row (threshold "report only") whose result is REPORTED; |
| 23 | # - sentinel_unchanged requires both values of each sentinel pair to be present non-empty |
| 24 | # strings before comparing them (a missing pair is FAIL, never "unchanged"). |
| 25 | a1_read() { |
| 26 | local M=$2 mok=false |
| 27 | [ -f "$M" ] && [ "$(stat -c %s "$M")" = 128 ] && [ "$(head -c 8 "$M")" = AIENCXM1 ] \ |
| 28 | && [ "$(head -c 96 "$M" | sha256sum | cut -c1-64)" = "$(tail -c 32 "$M" | od -An -tx1 -v | tr -d ' \n')" ] && mok=true |
| 29 | jq --argjson mok $mok --arg sha "$(sha256sum "$M" 2>/dev/null | cut -d' ' -f1)" --arg rc "$(basename "$1")" ' |
| 30 | def failing: select((.result // "MISSING") as $r | $r != "PASS" and $r != "NOT_APPLICABLE" |
| 31 | and ($r == "REPORTED" and (.threshold // "") == "report only" | not)); |
| 32 | def pair_same: (type == "array" and length == 2 and (.[0] | type) == "string" and (.[0] | length) > 0 |
| 33 | and (.[1] | type) == "string" and (.[1] | length) > 0 and .[0] == .[1]); |
| 34 | ([(.acceptance // [])[] | failing | .criterion] |
| 35 | + [(.acceptance_v5.task_quality // [], .acceptance_v5.authority // [])[] | failing | .row]) as $fails |
| 36 | | ([(.acceptance // [])[] | failing | {row: .criterion, result: (.result // "MISSING")}] |
| 37 | + [(.acceptance_v5.task_quality // [], .acceptance_v5.authority // [])[] | failing | {row, result: (.result // "MISSING")}]) as $fail_list |
| 38 | | (first((.acceptance // [])[] | select(.criterion == "Containment: workspace") | .value) // {}) as $w |
| 39 | | (first((.acceptance_v5.authority // [])[] | select(.row == "A1") | .value) // {}) as $a1 |
| 40 | | (first((.acceptance_v5.authority // [])[] | select(.row == "A2")) // {}) as $a2 |
| 41 | | {gate:"SMOL2Q_Q1_A1_RECORD_MARK_READING", v5_receipt:$rc, failing_rows:$fails, non_pass_rows:$fail_list, |
| 42 | only_these_rows:(($fails | sort) == ["A1", "Containment: workspace"]), |
| 43 | outside_is_mark_only:($w.outside_new_files == ["./compose.cortex-mark"] and $a1.outside_new_files == ["./compose.cortex-mark"]), |
| 44 | sentinel_unchanged:(($w.outside_sentinel | pair_same) and ($a1.sentinel | pair_same)), |
| 45 | workspace_change_is_authorized_path:($a2.result == "PASS" and $w.workspace_changed == [$a2.value.auth_path]), |
| 46 | no_stray:($a1.stray == []), mark_well_formed:$mok, mark_sha256:$sha} |
| 47 | | .verdict = (if .only_these_rows and .outside_is_mark_only and .sentinel_unchanged |
| 48 | and .workspace_change_is_authorized_path and .no_stray and .mark_well_formed then "PASS" else "FAIL" end)' "$1" |
| 49 | } |