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/test-release-checks.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 / test-release-checks.sh` 170 lines ยท 12017 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 # Negative and positive tests for the release gate (check-release-candidate.sh, package-release.sh, 18 # verify-release-assets.sh). Runs offline in a throwaway fixture tree; no cargo, no network. 19 # scripts/test-release-checks.sh 20 set -euo pipefail 21 ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" 22 W="$(mktemp -d "${TMPDIR:-/tmp}/aien-test-release-checks.XXXXXX")" 23 trap 'rm -rf "$W"' EXIT 24 fail() { echo "FAIL: $*" >&2; exit 1; } 25 pass() { echo "ok: $*"; } 26 27 # fixture tree 28 T="$W/tree"; mkdir -p "$T/scripts" "$T/release" "$W/bins" 29 cp "$ROOT/scripts/check-release-candidate.sh" "$ROOT/scripts/package-release.sh" "$ROOT/scripts/verify-release-assets.sh" "$T/scripts/" 30 echo licence > "$T/LICENSE"; echo notice > "$T/NOTICE"; echo third > "$T/THIRD_PARTY.md"; echo constitution > "$T/CONSTITUTION.md"; echo readme > "$T/README.md"; echo '#!/bin/sh' > "$T/install.sh" 31 OM=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 32 PR=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; CS=cccccccccccccccccccccccccccccccccccccccc; SC=dddddddddddddddddddddddddddddddddddddddd 33 H64() { printf '%064d' "$1"; } 34 for b in aien-cli spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger; do 35 printf '#!/bin/sh\necho %s\n' "$b" > "$W/bins/$b"; chmod 755 "$W/bins/$b" 36 done 37 AIEN_DIGEST="$(sha256sum "$W/bins/aien-cli" | cut -d' ' -f1)" 38 write_candidate() { # aien-digest 39 cat > "$T/release/candidate.toml" < "$T/omega.lock" 65 { 66 echo "[[package]]"; echo "source = \"git+https://github.com/aien-dev/aien-protocols?rev=$PR#$PR\"" 67 echo "[[package]]"; echo "source = \"git+https://github.com/aien-dev/crumb-spec?rev=$CS#$CS\"" 68 echo "[[package]]"; echo "source = \"git+https://github.com/aien-dev/spark-crumbs?rev=$SC#$SC\"" 69 } > "$T/Cargo.lock" 70 } 71 gate() { (cd "$T" && bash scripts/check-release-candidate.sh "$@" > "$W/log" 2>&1); } 72 must_pass() { gate "$@" || { cat "$W/log" >&2; fail "gate refused: $*"; }; } 73 must_fail() { # expected-text args... 74 local want="$1"; shift 75 if gate "$@"; then fail "gate accepted ($want)"; fi 76 grep -q -- "$want" "$W/log" || { cat "$W/log" >&2; fail "refused for the wrong reason, wanted: $want"; } 77 } 78 write_candidate "$AIEN_DIGEST"; write_locks 79 must_pass; pass "matching tree accepted" 80 sed -i \ 81 -e "s|github.com/aien-dev/crumb-spec?|github.com/aien-dev/crumb-spec-mv?|" \ 82 -e "s|github.com/aien-dev/spark-crumbs?|github.com/aien-dev/spark-crumbs-mv?|" \ 83 "$T/Cargo.lock" 84 must_pass; pass "-mv repo URLs accepted at the pinned revisions" 85 write_locks 86 87 # source pins 88 echo "$(H64 9 | cut -c1-40)" > "$T/omega.lock"; must_fail "omega.lock is"; write_locks; pass "omega.lock mismatch rejected" 89 sed -i "s/crumb-spec?rev=$CS#$CS/crumb-spec?rev=$SC#$SC/" "$T/Cargo.lock"; must_fail "consumes crumb-spec"; write_locks; pass "Cargo.lock crumb-spec mismatch rejected" 90 sed -i "s/aien-protocols?rev=$PR#$PR/aien-protocols?rev=$CS#$CS/" "$T/Cargo.lock"; must_fail "consumes aien-protocols"; write_locks; pass "Cargo.lock aien-protocols mismatch rejected" 91 echo "source = \"git+https://github.com/aien-dev/spark-crumbs?rev=$PR#$PR\"" >> "$T/Cargo.lock"; must_fail "several revisions of spark-crumbs"; write_locks; pass "two revisions of one pin rejected" 92 grep -v spark-crumbs "$T/Cargo.lock" > "$W/cl" && mv "$W/cl" "$T/Cargo.lock"; must_fail "no git source for spark-crumbs"; write_locks; pass "missing Cargo.lock pin rejected" 93 94 # candidate file 95 cp "$T/release/candidate.toml" "$W/cand.ok" 96 sed -i 's/^candidate = .*/candidate = "unknown"/' "$T/release/candidate.toml"; must_fail "missing or 'unknown'"; cp "$W/cand.ok" "$T/release/candidate.toml"; pass "candidate unknown rejected" 97 sed -i '/^config-json-sha256/d' "$T/release/candidate.toml"; must_fail "config-json-sha256 is missing"; cp "$W/cand.ok" "$T/release/candidate.toml"; pass "incomplete [model] rejected" 98 sed -i 's/^tokenizer-json-sha256 = .*/tokenizer-json-sha256 = "xyz"/' "$T/release/candidate.toml"; must_fail "not a sha256"; cp "$W/cand.ok" "$T/release/candidate.toml"; pass "malformed model digest rejected" 99 100 # package: build one with the real packager 101 pkg() { (cd "$T" && AIEN_RELEASE_BIN_DIR="$W/bins" bash scripts/package-release.sh "$1" > "$W/plog" 2>&1) || { cat "$W/plog" >&2; fail "package-release failed"; }; } 102 pkg "$W/good.tar.gz" 103 must_pass --package "$W/good.tar.gz" --native; pass "good package accepted (native digest matches)" 104 # the packager refuses a tree that fails the gate, and labels a dry run 105 echo `0000000000000000000000000000000000000000` > "$T/omega.lock" 106 if (cd "$T" && AIEN_RELEASE_BIN_DIR="$W/bins" bash scripts/package-release.sh "$W/x.tar.gz" >/dev/null 2>&1); then fail "packager packaged a tree that fails the gate"; fi 107 (cd "$T" && AIEN_DRY_RUN=1 AIEN_RELEASE_BIN_DIR="$W/bins" bash scripts/package-release.sh "$W/dry.tar.gz" >/dev/null 2>&1) || fail "dry-run packaging failed" 108 write_locks 109 must_fail "names candidate 'NOT-RELEASABLE'" --package "$W/dry.tar.gz"; pass "dry-run package is not a releasable package" 110 tar -xzOf "$W/dry.tar.gz" ./release.toml | grep -qx 'dry-run = true' || fail "dry-run package manifest is not labelled dry-run" 111 ! tar -xzOf "$W/good.tar.gz" ./release.toml | grep -q '^dry-run' || fail "release package manifest carries a dry-run label" 112 pass "dry-run package manifest labelled dry-run = true; release package is not" 113 114 # executable digest mismatch: a different aien binary against the candidate's pinned digest 115 mkdir "$W/bins2"; cp "$W/bins/"* "$W/bins2/"; printf '#!/bin/sh\necho other build\n' > "$W/bins2/aien-cli" 116 (cd "$T" && AIEN_RELEASE_BIN_DIR="$W/bins2" bash scripts/package-release.sh "$W/otherbin.tar.gz" >/dev/null 2>&1) 117 must_fail "is not CAND-T's aien-cli-native-release" --package "$W/otherbin.tar.gz" --native; pass "executable digest mismatch rejected (--native)" 118 must_fail "no candidate digest for this package kind" --package "$W/otherbin.tar.gz"; pass "package without --native refused (no candidate digest for the kind)" 119 must_fail "no candidate digest for this package kind" --package "$W/good.tar.gz"; pass "even a matching package is refused without --native" 120 # a helper binary changed after the candidate: its sc- digest differs 121 mkdir "$W/bins3"; cp "$W/bins/"* "$W/bins3/"; printf "#!/bin/sh\necho other cortex\n" > "$W/bins3/cortex-rs" 122 (cd "$T" && AIEN_RELEASE_BIN_DIR="$W/bins3" bash scripts/package-release.sh "$W/otherhelper.tar.gz" >/dev/null 2>&1) 123 must_fail "is not CAND-T's sc-cortex-rs" --package "$W/otherhelper.tar.gz" --native; pass "helper binary digest mismatch rejected" 124 125 # repack helper: edit a package then re-tar 126 repack() { # src dst edit-command (run inside the unpacked dir) 127 rm -rf "$W/u"; mkdir "$W/u"; tar -xzf "$1" -C "$W/u"; (cd "$W/u" && eval "$3"); tar -czf "$2" -C "$W/u" . 128 } 129 # release.toml lies about aien-cli digest 130 repack "$W/good.tar.gz" "$W/lie.tar.gz" "sed -i 's/^aien-cli-sha256 = .*/aien-cli-sha256 = \"$(H64 7)\"/' release.toml" 131 must_fail "not the digest of bin/aien" --package "$W/lie.tar.gz" --native; pass "release.toml digest that is not bin/aien rejected" 132 # model input mismatch in the package 133 for key in model-id model-safetensors-sha256 tokenizer-json-sha256 config-json-sha256; do 134 repack "$W/good.tar.gz" "$W/m.tar.gz" "sed -i 's/^$key = \"[^\"]*\"/$key = \"$(H64 8)\"/' release.toml" 135 must_fail "package \[model\] table differs" --package "$W/m.tar.gz" --native; pass "package $key mismatch rejected" 136 done 137 repack "$W/good.tar.gz" "$W/nomodel.tar.gz" "sed -i '/^\[model\]/,/^\$/d' release.toml" 138 must_fail "no \[model\] table" --package "$W/nomodel.tar.gz"; pass "package without [model] rejected" 139 # a file changed after packaging 140 repack "$W/good.tar.gz" "$W/edit.tar.gz" "echo x >> bin/cortex-rs" 141 must_fail "does not match release.toml" --package "$W/edit.tar.gz"; pass "tampered package file rejected" 142 repack "$W/good.tar.gz" "$W/extra.tar.gz" "echo x > bin/extra" 143 must_fail "holds" --package "$W/extra.tar.gz"; pass "unlisted extra file rejected" 144 145 # signatures 146 ssh-keygen -q -t `ed25519` -N '' -C t -f "$W/key"; ssh-keygen -q -t `ed25519` -N '' -C o -f "$W/other" 147 printf 'aien-release %s\n' "$(cut -d' ' -f1,2 "$W/key.pub")" > "$W/signers" 148 assets() { rm -rf "$W/a"; mkdir "$W/a"; cp "$W/good.tar.gz" "$W/a/sovereign-linux-aarch64.tar.gz"; (cd "$W/a" && sha256sum sovereign-* > SHA256SUMS.txt); } 149 sign() { (cd "$W/a" && rm -f SHA256SUMS.txt.sig && ssh-keygen -q -Y sign -f "$1" -n aien-release SHA256SUMS.txt); } 150 verify() { bash "$ROOT/scripts/verify-release-assets.sh" "$W/a" "$W/signers" > "$W/log" 2>&1; } 151 vfail() { if verify; then fail "assets accepted ($1)"; fi; grep -q -- "$1" "$W/log" || { cat "$W/log" >&2; fail "wrong reason, wanted: $1"; }; } 152 assets; sign "$W/key"; verify || { cat "$W/log" >&2; fail "valid signed assets refused"; }; pass "valid signed assets accepted" 153 assets; vfail "SHA256SUMS.txt.sig is missing"; pass "missing signature rejected" 154 assets; sign "$W/other"; vfail "NOT valid"; pass "signature from another key rejected" 155 assets; sign "$W/key"; echo "garbage" > "$W/a/SHA256SUMS.txt.sig"; vfail "NOT valid"; pass "corrupt signature rejected" 156 assets; sign "$W/key"; echo tamper >> "$W/a/SHA256SUMS.txt"; vfail "NOT valid"; pass "edited checksum list rejected" 157 assets; sign "$W/key"; echo x >> "$W/a/sovereign-linux-aarch64.tar.gz"; vfail "does not match the signed checksum"; pass "tampered archive rejected" 158 assets; (cd "$W/a" && cp sovereign-linux-aarch64.tar.gz sovereign-macos-arm64.tar.gz); sign "$W/key"; vfail "not covered"; pass "archive missing from signed list rejected" 159 assets; : > "$W/empty"; if bash "$ROOT/scripts/verify-release-assets.sh" "$W/a" "$W/empty" >/dev/null 2>&1; then fail "empty signer file accepted"; fi; pass "empty signer file rejected" 160 # the production signer file holds exactly one aien-release key, or (until the key ceremony) only a labelled 161 # PLACEHOLDER that verify-release-assets.sh refuses by name; the internal test key is never in it 162 PROD="$ROOT/docs/release/allowed_signers"; KEYS="$(grep -cvE '^[[:space:]]*(#|$)' "$PROD" || true)" 163 if [[ "$KEYS" -eq 0 ]]; then 164 grep -q PLACEHOLDER "$PROD" || fail "allowed_signers has no key and no PLACEHOLDER label" 165 assets; sign "$W/key"; cp "$PROD" "$W/signers"; vfail "PLACEHOLDER"; pass "placeholder allowed_signers refuses a signed release by name" 166 else 167 [[ "$KEYS" -eq 1 ]] && grep -qE '^aien-release ssh-`ed25519` [A-Za-z0-9+/=]+$' "$PROD" || fail "allowed_signers must hold exactly one aien-release `ed25519` key" 168 fi 169 ! grep -qF "$(grep -vE '^[[:space:]]*(#|$)' "$ROOT/docs/release/internal_test_signers" | cut -d' ' -f3)" "$PROD" || fail "the internal test key is in allowed_signers" 170 echo "PASS: release gate rejects inconsistent source pins, executable digest and model input mismatches, missing or invalid signatures"