Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/blob/main/scripts/check-release-candidate.sh # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / scripts / check-release-candidate.sh` 117 lines ยท 8087 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 # Fail closed unless this tree (or a built package) may be released as the candidate in release/candidate.toml. 18 # scripts/check-release-candidate.sh tree check; prints "candidate=" on success 19 # scripts/check-release-candidate.sh --model F also write the [model] table to file F 20 # scripts/check-release-candidate.sh --package A.tar.gz --native 21 # also check a built package (see below) 22 # Tree checks: candidate is set and not "unknown"; omega.lock equals omega-commit; Cargo.lock holds exactly the 23 # [pins] revisions (aien-protocols, crumb-spec, spark-crumbs); the [model] table is complete (every digest is 64 hex). 24 # Package checks: release.toml names this candidate; its [model] table equals the candidate's (model id, safetensors, 25 # tokenizer, config, fixture digests); aien-cli-sha256 equals the sha256 of bin/aien in the archive; every [files] 26 # entry matches; --native is REQUIRED (the linux-aarch64 build that links the omega engine): aien-cli-sha256 must equal 27 # [executables] aien-cli-native-release and every helper binary must equal its sc- entry. A package without --native 28 # is refused (no candidate digest for that kind). Build recipe: docs/release/BUILD_RECIPE.md. 29 # Env: AIEN_CANDIDATE_ROOT overrides the tree root (tests). 30 set -euo pipefail 31 cd "${AIEN_CANDIDATE_ROOT:-$(dirname "${BASH_SOURCE[0]}")/..}" 32 M=release/candidate.toml 33 die() { echo "release gate: $*" >&2; exit 1; } 34 [[ -f "$M" ]] || die "$M is missing" 35 MODEL_OUT=""; PKG=""; NATIVE=0 36 while [[ $# -gt 0 ]]; do 37 case "$1" in 38 --model) MODEL_OUT="${2:?--model needs a file}"; shift 2 ;; 39 --package) PKG="${2:?--package needs an archive}"; shift 2 ;; 40 --native) NATIVE=1; shift ;; 41 *) die "unknown argument $1" ;; 42 esac 43 done 44 sha() { if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi; } 45 # get
: value of key = "value" inside [section] ("" = before the first section) 46 get() { awk -v s="$1" -v k="$2" ' 47 /^\[/ { cur=$0; gsub(/[\[\] \t]/,"",cur); next } 48 cur==s && match($0, "^" k "[ \t]*=[ \t]*\"") { v=substr($0,RLENGTH+1); sub(/"[ \t]*(#.*)?$/,"",v); print v; exit }' "$3"; } 49 model_table() { awk '/^\[/ { inm = ($0 ~ /^\[model\]/); next } inm && NF && $0 !~ /^#/ { print }' "$1" | sort; } 50 51 cand="$(get "" candidate "$M")"; omega="$(get "" omega-commit "$M")" 52 [[ -n "$cand" && "$cand" != unknown ]] || die "candidate in $M is missing or 'unknown'" 53 [[ "$omega" =~ ^[0-9a-f]{40}$ ]] || die "omega-commit in $M is not a full commit hash" 54 [[ -f omega.lock ]] || die "omega.lock is missing" 55 lock="$(tr -d '[:space:]' < omega.lock)" 56 [[ "$lock" == "$omega" ]] || die "omega.lock is $lock but candidate $cand names omega $omega. This tree is not $cand and cannot be released as it." 57 grep -q '^\[model\]' "$M" || die "no [model] table in $M" 58 for k in model-id model-safetensors-sha256 tokenizer-json-sha256 config-json-sha256 oracle-fixture-safetensors-sha256 oracle-fixture-manifest-sha256; do 59 v="$(get model "$k" "$M")"; [[ -n "$v" ]] || die "[model] $k is missing in $M" 60 [[ "$k" == model-id || "$v" =~ ^[0-9a-f]{64}$ ]] || die "[model] $k in $M is not a sha256" 61 done 62 63 # Cargo.lock source pins: each repo must resolve to exactly the candidate's revision. 64 # crumb-spec and spark-crumbs may use the -mv repo (issue 815). aien-protocols does not: 65 # this lockfile still carries both aien-protocols and aien-protocols-mv, and folding -mv 66 # into that pin would report two revisions. 67 [[ -f Cargo.lock ]] || die "Cargo.lock is missing" 68 for repo in aien-protocols crumb-spec spark-crumbs; do 69 want="$(get pins "$repo" "$M")" 70 [[ "$want" =~ ^[0-9a-f]{40}$ ]] || die "[pins] $repo in $M is missing or not a full commit hash" 71 case "$repo" in 72 crumb-spec|spark-crumbs) repo_re="${repo}(-mv)?" ;; 73 *) repo_re="$repo" ;; 74 esac 75 have="$(grep -E "^source = \"git\+https://github\.com/aien-dev/${repo_re}(\.git)?[?#]" Cargo.lock | grep -oE '#[0-9a-f]{40}"' | cut -c2-41 | sort -u || true)" 76 [[ -n "$have" ]] || die "Cargo.lock has no git source for $repo (candidate $cand pins $want)" 77 [[ "$(printf '%s\n' "$have" | wc -l)" -eq 1 ]] || die "Cargo.lock has several revisions of $repo: $(echo $have)" 78 [[ "$have" == "$want" ]] || die "Cargo.lock consumes $repo $have but candidate $cand pins $want" 79 done 80 81 if [[ -n "$MODEL_OUT" ]]; then sed -n '/^\[model\]/,$p' "$M" | sed '/^$/q' > "$MODEL_OUT"; fi 82 83 if [[ -n "$PKG" ]]; then 84 [[ -f "$PKG" ]] || die "package $PKG not found" 85 X="$(mktemp -d)"; trap 'rm -rf "$X"' EXIT 86 tar -xzf "$PKG" -C "$X" || die "package $PKG is not a readable archive" 87 R="$X/release.toml"; [[ -f "$R" ]] || die "package has no release.toml" 88 [[ "$(get "" schema "$R")" == AienReleaseV1 ]] || die "package release.toml schema is not AienReleaseV1" 89 [[ "$(get "" candidate "$R")" == "$cand" ]] || die "package names candidate '$(get "" candidate "$R")', not $cand" 90 [[ -z "$(get model model-id "$R")" ]] && die "package release.toml has no [model] table" 91 [[ "$(model_table "$R")" == "$(model_table "$M")" ]] || die "package [model] table differs from the candidate's (model id or input digests)" 92 want_aien="$(get "" aien-cli-sha256 "$R")" 93 [[ "$want_aien" =~ ^[0-9a-f]{64}$ ]] || die "package aien-cli-sha256 is missing or not a sha256" 94 [[ -f "$X/bin/aien" && "$(sha "$X/bin/aien")" == "$want_aien" ]] || die "package aien-cli-sha256 is not the digest of bin/aien" 95 n=0 96 while IFS= read -r line; do 97 [[ "$line" =~ ^\"([^\"]+)\"[[:space:]]*=[[:space:]]*\"([0-9a-f]{64})\"$ ]] || die "bad [files] line: $line" 98 f="${BASH_REMATCH[1]}"; case "$f" in /*|*..*) die "unsafe path in release.toml: $f" ;; esac 99 [[ -f "$X/$f" && "$(sha "$X/$f")" == "${BASH_REMATCH[2]}" ]] || die "package file $f does not match release.toml" 100 n=$((n+1)) 101 done < <(sed -n '/^\[files\]/,$p' "$R" | sed '1d;/^$/d') 102 [[ "$n" -gt 0 ]] || die "release.toml lists no files" 103 have_n="$(find "$X" -type f ! -name release.toml | grep -c .)" 104 [[ "$have_n" -eq "$n" ]] || die "package holds $have_n files but release.toml lists $n" 105 # Every shipped executable must be bound to a candidate manifest digest. Only the native build (linux aarch64, omega 106 # linked) has digests in [executables]; a package of any other kind has none and is refused, never passed. 107 [[ "$NATIVE" -eq 1 ]] || die "no candidate digest for this package kind: $cand has [executables] digests only for the native build (--native); a non-native package cannot be released as $cand" 108 exe="$(get executables aien-cli-native-release "$M")" 109 [[ "$exe" =~ ^[0-9a-f]{64}$ ]] || die "[executables] aien-cli-native-release missing in $M" 110 [[ "$want_aien" == "$exe" ]] || die "aien-cli digest $want_aien is not $cand's aien-cli-native-release $exe (build with scripts/release-build.sh, see docs/release/BUILD_RECIPE.md)" 111 for helper in spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger; do 112 hexe="$(get executables "sc-$helper" "$M")" 113 [[ "$hexe" =~ ^[0-9a-f]{64}$ ]] || die "[executables] sc-$helper missing in $M" 114 [[ -f "$X/bin/$helper" && "$(sha "$X/bin/$helper")" == "$hexe" ]] || die "package bin/$helper is not $cand's sc-$helper ($hexe)" 115 done 116 fi 117 echo "candidate=$cand"