aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / scripts / verify-r16-status.sh
| 1 | #!/bin/sh |
| 2 | # Refuse an overall R16 PASS without its candidate-bound qualification receipt. |
| 3 | # Usage: scripts/verify-r16-status.sh <omega-checkout> [roadmap-file] |
| 4 | # Needs: awk, sha256sum, jq. |
| 5 | set -u |
| 6 | |
| 7 | fail() { echo "$*" >&2; exit 1; } |
| 8 | |
| 9 | [ $# -ge 1 ] || fail "usage: $0 <omega-checkout> [roadmap-file]" |
| 10 | omega=$1 |
| 11 | root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) |
| 12 | roadmap=${2:-$root/doctrine/ROADMAP.md} |
| 13 | [ -f "$roadmap" ] || fail "roadmap not found: $roadmap" |
| 14 | |
| 15 | status=$(awk -F'|' 'index($0, "| R16 orchestrator retirement |") == 1 { |
| 16 | s = $3; gsub(/^[ \t]+|[ \t]+$/, "", s); print s; exit }' "$roadmap") |
| 17 | [ -n "$status" ] || fail "R16 row not found in $roadmap" |
| 18 | |
| 19 | if [ "$status" = "IN PROGRESS" ]; then |
| 20 | echo "R16 overall qualification is not claimed" |
| 21 | exit 0 |
| 22 | fi |
| 23 | |
| 24 | command -v jq >/dev/null 2>&1 || fail "jq is required to check R16 receipts" |
| 25 | |
| 26 | for path in "$omega"/evidence/R16/*.json; do |
| 27 | [ -f "$path" ] || continue |
| 28 | name=$(basename "$path" .json) |
| 29 | digest=$(sha256sum "$path" | awk '{print $1}') |
| 30 | [ "$name" = "$digest" ] || continue |
| 31 | if jq -e ' |
| 32 | type == "object" |
| 33 | and .schema == "AIEN_RX_R16_ORCHESTRATOR_RETIRED_V1" |
| 34 | and .candidate_bound == true |
| 35 | and .tree_dirty == false |
| 36 | and .silicon_observed == true |
| 37 | and (.candidate_commit | type) == "string" |
| 38 | and (.candidate_commit | length) == 40 |
| 39 | and .candidate_commit == .run_commit |
| 40 | and ((.gates // {}) | type) == "object" |
| 41 | and ([range(1; 9) as $i | (.gates // {})["R16-G\($i)"] == "PASS"] | all) |
| 42 | and ((.production_entry_point // false) | if type == "string" then length > 0 else . == true end) |
| 43 | and .remaining_unclassified_semantic_loop_count == 0 |
| 44 | ' "$path" >/dev/null 2>&1; then |
| 45 | echo "R16 qualified receipt: $(basename "$path")" |
| 46 | exit 0 |
| 47 | fi |
| 48 | done |
| 49 | |
| 50 | fail "R16 status '$status' has no valid final G1-G8 candidate-bound silicon receipt; inventory alone is insufficient" |