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

GitHub aien-dev/aien-sovereign-core-mv#255 (code only)

closed derived 3111cc282fc8fe69 #255

Imported from GitHub aien-dev/aien-sovereign-core-mv#255 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 845f58feedfa139dc1f341c7038c0ab4f919f874 · Head 82af958b3b158e9939db5e4a52943f58f00e89ae

Fetch it

A git bundle of the pull request's head, 8808 bytes.

curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/3111cc282fc8fe69.bundle -o 3111cc282fc8fe69.bundle
git fetch 3111cc282fc8fe69.bundle refs/pull/255/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-sovereign-core-mv
255
82af958b3b158e9939db5e4a52943f58f00e89ae
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":255,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/255","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:32Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 9a3cd32a..c8af7d2d 100644
--- a/.crumb
+++ b/.crumb
@@ -64,8 +64,8 @@
     "generated": {
       "children": [
         {
-          "digest": "7e21bed3084195dacdd52d79c7d4c7c95837b474fd35b74dd087e6067bdeb58c",
-          "last_commit": "296c4ac",
+          "digest": "f95432625ccdd27c1732e380e4ddb227483bdce00f37fb0effd5a5fddfea149b",
+          "last_commit": "71fbd51",
           "name": "scripts",
           "purpose": ""
         },
@@ -76,15 +76,15 @@
           "purpose": ""
         }
       ],
-      "children_root": "sha256:009593670dc7accc2b442a6a8c6f3b848ab73de4d6e61df57401bf4bf00b294a",
-      "compiled_at": "2026-10-07T01:44:05Z",
+      "children_root": "sha256:4ff1a56b7c8ac606ad5709f2ba1141f16055c34f5f242ac491233dca20d5153e",
+      "compiled_at": "2026-10-07T01:56:30Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:97c0b81eda30d727e0519d33363788e53d53d2ed5f910f3b069465bbd6f71eb3",
+      "digest": "sha256:1c548de22ebc625f5612a8a3cfcf58f3e464d98d7d3a9c560db819b3e8420d03",
       "evidence_files": 155,
       "evidence_root": "sha256:ff6dddfecfcc02cea55f46acaccc7eaecd27557209e98c3d5616ec02bdde31db",
-      "files": 1057,
-      "generated_at_commit": "5bd3919db55dc2d66ad73e7b81b7d778cbf383b1",
-      "source_tree": "sha256:33dd2811e84286ee2a0038b7176ba9dbc3a84fe6ae807398a6542703aa361828"
+      "files": 1060,
+      "generated_at_commit": "71fbd511c5d246c1c45ce24db14430813ba53e47",
+      "source_tree": "sha256:0f6c1c7a067d98e1dc7bc544e3139815f2300a1893250dd074cf9e8a07a6c501"
     }
   },
   "history": [],
diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml
new file mode 100644
index 00000000..15982390
--- /dev/null
+++ b/.github/workflows/release-dry-run.yml
@@ -0,0 +1,28 @@
+name: Release Dry Run (no publish, no secrets)
+
+# Runs the release gate checks offline on every pull request. It cannot publish: read-only permissions, no secrets,
+# no signing, no upload. Guarded by scripts/test-dry-run-workflow.sh. Decision D1 (aien-architecture#156): no signing
+# key is generated or stored now and nothing is published.
+on:
+  pull_request:
+  workflow_dispatch:
+
+permissions:
+  contents: read
+
+jobs:
+  gate-dry-run:
+    name: Release gate dry run
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout Source
+        uses: actions/checkout@v4
+
+      - name: Workflow cannot publish (static guard)
+        run: bash scripts/test-dry-run-workflow.sh
+
+      - name: Tree gate on this revision (candidate named, omega.lock and Cargo.lock pins equal the candidate's)
+        run: scripts/check-release-candidate.sh
+
+      - name: Gate refuses non-candidate trees and packages (real CAND manifest, throwaway binaries)
+        run: bash scripts/test-release-real-tree.sh
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index afd2f506..4d929bcb 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -22,21 +22,13 @@ jobs:
       fail-fast: false
       matrix:
         include:
-          - os: ubuntu-latest
-            target: x86_64-unknown-linux-gnu
-            artifact_name: sovereign-linux-x86_64.tar.gz
-            use_tar: true
-            native_engine: false
+          # Only the native candidate target is released: the candidate manifest has executable digests for it alone,
+          # and the gate refuses any package without them (scripts/check-release-candidate.sh --native is required).
           - os: ubuntu-24.04-arm
             target: aarch64-unknown-linux-gnu
             artifact_name: sovereign-linux-aarch64.tar.gz
             use_tar: true
             native_engine: true
-          - os: macos-latest
-            target: aarch64-apple-darwin
-            artifact_name: sovereign-macos-arm64.tar.gz
-            use_tar: true
-            native_engine: false
 
     steps:
       - name: Checkout Source
@@ -105,12 +97,11 @@ jobs:
           printf '%s  %s  native_engine=%s\n' "${AIEN_SHA%% *}" "${{ matrix.artifact_name }}" "${{ matrix.native_engine }}" > "aien-cli-sha256-${{ matrix.target }}.txt"
           cat "aien-cli-sha256-${{ matrix.target }}.txt"
 
-      - name: Check the package against the candidate (model inputs, files, aien-cli digest; native build also the candidate digest)
+      - name: Check the package against the candidate (model inputs, files, aien-cli and helper digests, all bound to the candidate manifest)
         id: pkgcheck
         continue-on-error: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
         run: |
-          if [ "${{ matrix.native_engine }}" = "true" ]; then NATIVE=--native; else NATIVE=; fi
-          scripts/check-release-candidate.sh --package "${{ matrix.artifact_name }}" $NATIVE
+          scripts/check-release-candidate.sh --package "${{ matrix.artifact_name }}" --native
 
       - name: Record dry-run status
         if: always() && github.event_name == 'workflow_dispatch' && inputs.dry_run
diff --git a/docs/release/BUILD_RECIPE.md b/docs/release/BUILD_RECIPE.md
index 1016e45b..d9eb4307 100644
--- a/docs/release/BUILD_RECIPE.md
+++ b/docs/release/BUILD_RECIPE.md
@@ -27,10 +27,10 @@ package aien-proof or aien-test.
   labels it `NOT-RELEASABLE`, which the checks reject).
 - `scripts/check-release-candidate.sh` (tree): candidate named, `omega.lock` equals `omega-commit`, `Cargo.lock`
   holds exactly the `[pins]` revisions (aien-protocols, crumb-spec, spark-crumbs), `[model]` complete.
-- `scripts/check-release-candidate.sh --package A.tar.gz [--native]`: candidate id, `[model]` table (model id,
+- `scripts/check-release-candidate.sh --package A.tar.gz --native`: candidate id, `[model]` table (model id,
   safetensors, tokenizer, config, oracle fixture digests), `aien-cli-sha256` equals the digest of `bin/aien`, every
-  listed file, no unlisted file; with `--native` (linux aarch64, omega linked) the digest must equal
-  `[executables] aien-cli-native-release`. Other targets build the CPU stub and are not the candidate.
+  listed file, no unlisted file; `--native` is required (linux aarch64, omega linked): the digest must equal
+  `[executables] aien-cli-native-release`, and each helper binary must equal its `sc-<name>` entry. A package without `--native` is refused (no candidate digest for that kind); the release matrix builds only the native target.
 - `scripts/verify-release-assets.sh <dir> <allowed_signers>`: signature on `SHA256SUMS.txt` valid for the pinned
   signer, every listed file matches, every `sovereign-*` archive is covered.
 - `scripts/test-release-checks.sh` (also in CI) proves each of these rejects: wrong omega.lock or Cargo.lock pins,
diff --git a/scripts/.crumb b/scripts/.crumb
index de647e08..0a5a2576 100644
--- a/scripts/.crumb
+++ b/scripts/.crumb
@@ -4,14 +4,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-06T18:59:59Z",
+      "compiled_at": "2026-10-07T01:19:42Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:7e21bed3084195dacdd52d79c7d4c7c95837b474fd35b74dd087e6067bdeb58c",
+      "digest": "sha256:f95432625ccdd27c1732e380e4ddb227483bdce00f37fb0effd5a5fddfea149b",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 20,
-      "generated_at_commit": "18737034e52a286e9e31675cdc6711fd6e564d10",
-      "source_tree": "sha256:ef8b0a729763826370f05efde41418ebea6d056b2260e07aa6114a569d87990d"
+      "files": 22,
+      "generated_at_commit": "eed8b7570cef04c816f4e2a2ceb4391c8c60c61c",
+      "source_tree": "sha256:2970306b1dd7053625dcb4e85381f930467d75fa5ca62bad935bbf6be6ac3779"
     }
   },
   "parent": {
diff --git a/scripts/check-release-candidate.sh b/scripts/check-release-candidate.sh
index 926fe63a..7fa102d9 100755
--- a/scripts/check-release-candidate.sh
+++ b/scripts/check-release-candidate.sh
@@ -2,14 +2,15 @@
 # Fail closed unless this tree (or a built package) may be released as the candidate in release/candidate.toml.
 #   scripts/check-release-candidate.sh                         tree check; prints "candidate=<id>" on success
 #   scripts/check-release-candidate.sh --model F               also write the [model] table to file F
-#   scripts/check-release-candidate.sh --package A.tar.gz [--native]
+#   scripts/check-release-candidate.sh --package A.tar.gz --native
 #                                                              also check a built package (see below)
 # Tree checks: candidate is set and not "unknown"; omega.lock equals omega-commit; Cargo.lock holds exactly the
 # [pins] revisions (aien-protocols, crumb-spec, spark-crumbs); the [model] table is complete (every digest is 64 hex).
 # Package checks: release.toml names this candidate; its [model] table equals the candidate's (model id, safetensors,
 # tokenizer, config, fixture digests); aien-cli-sha256 equals the sha256 of bin/aien in the archive; every [files]
-# entry matches; with --native (the linux-aarch64 build that links the omega engine) aien-cli-sha256 must also equal
-# [executables] aien-cli-native-release. Build recipe: docs/release/BUILD_RECIPE.md.
+# entry matches; --native is REQUIRED (the linux-aarch64 build that links the omega engine): aien-cli-sha256 must equal
+# [executables] aien-cli-native-release and every helper binary must equal its sc-<name> entry. A package without --native
+# is refused (no candidate digest for that kind). Build recipe: docs/release/BUILD_RECIPE.md.
 # Env: AIEN_CANDIDATE_ROOT overrides the tree root (tests).
 set -euo pipefail
 cd "${AIEN_CANDIDATE_ROOT:-$(dirname "${BASH_SOURCE[0]}")/..}"
@@ -79,10 +80,16 @@ if [[ -n "$PKG" ]]; then
     [[ "$n" -gt 0 ]] || die "release.toml lists no files"
     have_n="$(find "$X" -type f ! -name release.toml | grep -c .)"
     [[ "$have_n" -eq "$n" ]] || die "package holds $have_n files but release.toml lists $n"
-    if [[ "$NATIVE" -eq 1 ]]; then
-        exe="$(get executables aien-cli-native-release "$M")"
-        [[ "$exe" =~ ^[0-9a-f]{64}$ ]] || die "[executables] aien-cli-native-release missing in $M"
-        [[ "$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)"
-    fi
+    # Every shipped executable must be bound to a candidate manifest digest. Only the native build (linux aarch64, omega
+    # linked) has digests in [executables]; a package of any other kind has none and is refused, never passed.
+    [[ "$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"
+    exe="$(get executables aien-cli-native-release "$M")"
+    [[ "$exe" =~ ^[0-9a-f]{64}$ ]] || die "[executables] aien-cli-native-release missing in $M"
+    [[ "$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)"
+    for helper in spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger; do
+        hexe="$(get executables "sc-$helper" "$M")"
+        [[ "$hexe" =~ ^[0-9a-f]{64}$ ]] || die "[executables] sc-$helper missing in $M"
+        [[ -f "$X/bin/$helper" && "$(sha "$X/bin/$helper")" == "$hexe" ]] || die "package bin/$helper is not $cand's sc-$helper ($hexe)"
+    done
 fi
 echo "candidate=$cand"
diff --git a/scripts/test-dry-run-workflow.sh b/scripts/test-dry-run-workflow.sh
new file mode 100755
index 00000000..e1c21838
--- /dev/null
+++ b/scripts/test-dry-run-workflow.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# Static guard: .github/workflows/release-dry-run.yml (runs on pull_request) must not be able to publish.
+# It may read the repository and run the offline release checks; nothing else.
+#   scripts/test-dry-run-workflow.sh [workflow-file]
+# Mutation note: adding a `gh release`, `secrets.` reference, `contents: write` or an upload step to the workflow
+# makes this fail; the self-checks below prove each pattern fires on a mutated copy.
+set -euo pipefail
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+F="${1:-$ROOT/.github/workflows/release-dry-run.yml}"
+[[ -f "$F" ]] || { echo "FAIL: $F missing" >&2; exit 1; }
+BAD='gh release|gh api|secrets\.|GH_TOKEN|GITHUB_TOKEN|contents: *write|id-token|packages: *write|upload-artifact|upload-release|action-gh-release|ssh-keygen|release create|workflow_run|pull_request_target'
+violations() { grep -nE "$BAD" "$1" | grep -vE '^[0-9]+:[[:space:]]*#' || true; }
+v="$(violations "$F")"
+[[ -z "$v" ]] || { echo "FAIL: dry-run workflow contains publish or secret patterns:" >&2; echo "$v" >&2; exit 1; }
+grep -qE '^permissions:' "$F" && grep -qE '^[[:space:]]+contents: read$' "$F" || { echo "FAIL: workflow must declare permissions contents: read" >&2; exit 1; }
+grep -qE '^[[:space:]]*pull_request:' "$F" || { echo "FAIL: workflow must run on pull_request" >&2; exit 1; }
+M="$(mktemp)"; trap 'rm -f "$M"' EXIT
+for bad in 'run: gh release create v1' 'x: ${{ secrets.AIEN_RELEASE_SIGNING_KEY }}' 'contents: write' 'uses: actions/upload-artifact@v4'; do
+    { cat "$F"; echo "      $bad"; } > "$M"
+    [[ -n "$(violations "$M")" ]] || { echo "FAIL: guard does not catch: $bad" >&2; exit 1; }
+done
+echo "ok: dry-run workflow has no publish, secrets, signing or upload, and only contents: read"
diff --git a/scripts/test-release-checks.sh b/scripts/test-release-checks.sh
index 5008aad4..048e1840 100755
--- a/scripts/test-release-checks.sh
+++ b/scripts/test-release-checks.sh
@@ -42,6 +42,7 @@ spark-crumbs = "$SC"
 
 [executables]
 aien-cli-native-release = "$1"
+$(for b in spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger; do echo "sc-$b = \"$(sha256sum "$W/bins/$b" | cut -d" " -f1)\""; done)
 EOT
 }
 write_locks() {
@@ -90,7 +91,12 @@ must_fail "names candidate 'NOT-RELEASABLE'" --package "$W/dry.tar.gz"; pass "dr
 mkdir "$W/bins2"; cp "$W/bins/"* "$W/bins2/"; printf '#!/bin/sh\necho other build\n' > "$W/bins2/aien-cli"
 (cd "$T" && AIEN_RELEASE_BIN_DIR="$W/bins2" bash scripts/package-release.sh "$W/otherbin.tar.gz" >/dev/null 2>&1)
 must_fail "is not CAND-T's aien-cli-native-release" --package "$W/otherbin.tar.gz" --native; pass "executable digest mismatch rejected (--native)"
-must_pass --package "$W/otherbin.tar.gz"; pass "same package accepted without --native (non-native targets are not the candidate)"
+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)"
+must_fail "no candidate digest for this package kind" --package "$W/good.tar.gz"; pass "even a matching package is refused without --native"
+# a helper binary changed after the candidate: its sc-<name> digest differs
+mkdir "$W/bins3"; cp "$W/bins/"* "$W/bins3/"; printf "#!/bin/sh\necho other cortex\n" > "$W/bins3/cortex-rs"
+(cd "$T" && AIEN_RELEASE_BIN_DIR="$W/bins3" bash scripts/package-release.sh "$W/otherhelper.tar.gz" >/dev/null 2>&1)
+must_fail "is not CAND-T's sc-cortex-rs" --package "$W/otherhelper.tar.gz" --native; pass "helper binary digest mismatch rejected"
 
 # repack helper: edit a package then re-tar
 repack() { # src dst edit-command (run inside the unpacked dir)
diff --git a/scripts/test-release-real-tree.sh b/scripts/test-release-real-tree.sh
new file mode 100755
index 00000000..986d0e1c
--- /dev/null
+++ b/scripts/test-release-real-tree.sh
@@ -0,0 +1,92 @@
+#!/usr/bin/env bash
+# Release gate against the REAL candidate manifest (release/candidate.toml, omega.lock, Cargo.lock), CPU only, offline.
+# scripts/test-release-checks.sh uses an invented candidate; this one proves the gate refuses a package or tree that
+# is not CAND-4, using the committed manifest. No signing key is read or generated; the binaries are throwaway
+# scripts, never real builds. Nothing is published.
+#
+# How the gate binds a package to the candidate revision (scripts/check-release-candidate.sh):
+#   tree:    omega.lock == omega-commit, Cargo.lock holds exactly the [pins] revisions.
+#   package: release.toml candidate + [model] table match, and with --native the sha256 of bin/aien must equal
+#            [executables] aien-cli-native-release. The binary digest is what ties a package to a source revision:
+#            a build from any other sovereign-core source gives another digest and is refused.
+#   NOT bound: the sovereign-core-commit field in candidate.toml is informational (candidate.toml itself changed after
+#            that commit); the executable digests are the binding. A package without --native is refused (no digest).
+#
+# Mutation note: the negative "post-candidate binary refused" case passes wrongly if the line
+#   [[ "$want_aien" == "$exe" ]] || die ...
+# in check-release-candidate.sh is removed or weakened (for example `true ||`). The mutation section below applies
+# that change to a copy of the gate and requires the negative check to turn red, so it cannot pass vacuously.
+set -euo pipefail
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+W="$(mktemp -d "${TMPDIR:-/tmp}/aien-test-release-real.XXXXXX")"
+trap 'rm -rf "$W"' EXIT
+fail() { echo "FAIL: $*" >&2; exit 1; }
+pass() { echo "ok: $*"; }
+sha() { sha256sum "$1" | cut -d' ' -f1; }
+
+# fixture: the real manifest and locks, the real gate and packager, throwaway binaries
+T="$W/tree"; mkdir -p "$T/scripts" "$T/release" "$W/bins"
+cp "$ROOT/scripts/check-release-candidate.sh" "$ROOT/scripts/package-release.sh" "$T/scripts/"
+cp "$ROOT/release/candidate.toml" "$T/release/"; cp "$ROOT/omega.lock" "$ROOT/Cargo.lock" "$T/"
+echo constitution > "$T/CONSTITUTION.md"; echo readme > "$T/README.md"; echo '#!/bin/sh' > "$T/install.sh"
+for b in aien-cli spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger; do
+    printf '#!/bin/sh\necho throwaway %s\n' "$b" > "$W/bins/$b"; chmod 755 "$W/bins/$b"
+done
+gate() { (cd "$T" && bash scripts/check-release-candidate.sh "$@" > "$W/log" 2>&1); }
+must_pass() { gate "$@" || { cat "$W/log" >&2; fail "gate refused: $*"; }; }
+must_fail() { local want="$1"; shift; if gate "$@"; then fail "gate accepted ($want)"; fi
+    grep -q -- "$want" "$W/log" || { cat "$W/log" >&2; fail "refused for the wrong reason, wanted: $want"; }; }
+
+CAND="$(sed -n 's/^candidate = "\(.*\)"/\1/p' "$T/release/candidate.toml")"
+NATIVE_DIGEST="$(sed -n 's/^aien-cli-native-release = "\([0-9a-f]\{64\}\)".*/\1/p' "$T/release/candidate.toml")"
+[[ "$CAND" == CAND-4 && -n "$NATIVE_DIGEST" ]] || fail "release/candidate.toml is not CAND-4 with a native digest"
+grep -Eq '^sovereign-core-commit = "[0-9a-f]{40}"' "$T/release/candidate.toml" || fail "sovereign-core-commit is not a full hash"
+
+# positive control, tree: the committed tree is the candidate tree
+(cd "$ROOT" && bash scripts/check-release-candidate.sh >"$W/log" 2>&1) || { cat "$W/log" >&2; fail "real tree refused by the gate"; }
+grep -q "candidate=CAND-4" "$W/log"; pass "real tree passes the tree gate as CAND-4"
+
+# negative, tree: a tree on other pins than the candidate's (what a later main would look like) is refused
+cp "$T/omega.lock" "$W/omega.ok"; cp "$T/Cargo.lock" "$W/cargo.ok"
+printf '%s\n' "0000000000000000000000000000000000000000" > "$T/omega.lock"; must_fail "omega.lock is"; cp "$W/omega.ok" "$T/omega.lock"
+pass "omega.lock after the candidate refused"
+want_pr="$(sed -n 's/^aien-protocols = "\(.*\)"/\1/p' "$T/release/candidate.toml")"
+sed -i "s/$want_pr/1111111111111111111111111111111111111111/g" "$T/Cargo.lock"; must_fail "consumes aien-protocols"; cp "$W/cargo.ok" "$T/Cargo.lock"
+pass "Cargo.lock aien-protocols after the candidate refused"
+must_pass; pass "tree restored, accepted again"
+
+# packages built by the real packager from the real tree, with throwaway binaries
+(cd "$T" && AIEN_RELEASE_BIN_DIR="$W/bins" bash scripts/package-release.sh "$W/post.tar.gz" >"$W/plog" 2>&1) || { cat "$W/plog" >&2; fail "packaging failed"; }
+# negative, package: a binary that is not the candidate's (any post-candidate build) is refused on the native target
+native_negative() { # gate-script
+    (cd "$T" && bash "$1" --package "$W/post.tar.gz" --native > "$W/log" 2>&1) && return 1
+    grep -q "is not CAND-4's aien-cli-native-release" "$W/log"
+}
+native_negative scripts/check-release-candidate.sh || { cat "$W/log" >&2; fail "post-candidate binary not refused for the right reason"; }
+grep -q "$NATIVE_DIGEST" "$W/log" || fail "refusal does not name the candidate digest"
+pass "package from a non-candidate binary refused (--native): digest differs from CAND-4 aien-cli-native-release"
+# no --native: the manifest has no digest for that package kind, so it is refused (never passed)
+must_fail "no candidate digest for this package kind" --package "$W/post.tar.gz"; pass "package without --native refused: no candidate digest for the kind"
+# a package that names another candidate is refused
+rm -rf "$W/u"; mkdir "$W/u"; tar -xzf "$W/post.tar.gz" -C "$W/u"; sed -i 's/^candidate = .*/candidate = "CAND-3"/' "$W/u/release.toml"
+tar -czf "$W/cand3.tar.gz" -C "$W/u" .
+must_fail "names candidate 'CAND-3', not CAND-4" --package "$W/cand3.tar.gz"; pass "package naming CAND-3 refused"
+
+# positive control, package: manifest whose native digest is this package's binary
+GOOD="$(sha "$W/bins/aien-cli")"
+sed -i "s/^aien-cli-native-release = \"[0-9a-f]\{64\}\"/aien-cli-native-release = \"$GOOD\"/" "$T/release/candidate.toml"
+must_fail "is not CAND-4's sc-" --package "$W/post.tar.gz" --native; pass "aien-cli matches but helper digests do not: refused"
+for h in spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger; do
+    sed -i "s/^sc-$h = \"[0-9a-f]\{64\}\"/sc-$h = \"$(sha "$W/bins/$h")\"/" "$T/release/candidate.toml"
+done
+must_pass --package "$W/post.tar.gz" --native; pass "positive control: every shipped executable matches its manifest digest, package passes"
+cp "$ROOT/release/candidate.toml" "$T/release/candidate.toml"
+
+# mutation: weaken the digest comparison in a copy of the gate; the negative must turn red
+sed 's/\[\[ "\$want_aien" == "\$exe" \]\] ||/true ||/' "$T/scripts/check-release-candidate.sh" > "$T/scripts/mutant.sh"
+cmp -s "$T/scripts/mutant.sh" "$T/scripts/check-release-candidate.sh" && fail "mutation did not apply (gate text changed; update this test)"
+if native_negative scripts/mutant.sh; then fail "negative test stayed green against a gate that skips the digest comparison"; fi
+pass "mutation (digest comparison removed) is caught"
+
+bash "$ROOT/scripts/test-dry-run-workflow.sh"
+echo "PASS: release gate refuses non-candidate trees and packages against the real CAND-4 manifest"