interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

GitHub aien-dev/aien-architecture-mv#111 (code only)

closed derived 65bc292cb75db191 #111

Imported from GitHub aien-dev/aien-architecture-mv#111 (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 fb41e813747963b95d38b5fb1d98bb0727484c63 · Head 3425c2684ae0cb361a51c105a3cf551d00f7d91f

Apply it

git checkout -b patch-65bc292cb75db191 fb41e813747963b95d38b5fb1d98bb0727484c63
curl -fsSL https://interplane.io/drakestapleton/aien-architecture-mv/patches/65bc292cb75db191.patch | git am

Raw patch (mbox) · 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-architecture-mv
111
3425c2684ae0cb361a51c105a3cf551d00f7d91f
{"kind":"github-import","owner":"aien-dev","repo":"aien-architecture-mv","number":111,"url":"https://github.com/aien-dev/aien-architecture-mv/pull/111","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:42Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/docs/qualification/CANDIDATE.md b/docs/qualification/CANDIDATE.md
index 81a8637..87225a8 100644
--- a/docs/qualification/CANDIDATE.md
+++ b/docs/qualification/CANDIDATE.md
@@ -16,8 +16,9 @@ Results are `EvidenceReceiptV1` receipts from `aien-sovereign-core/crates/aien-p
 A candidate is a TOML file `qualification/candidates/CAND-<n>.toml`, schema `CandidateManifestV1`, with:
 
 - `schema`, `id`, `status`, `created`.
-- `[commits]`: one full 40-hex commit per repo: `omega`, `aienos`, `aien-sovereign-core` (FORGE and `aien-proof`), `aien-protocols`, `aien-architecture`. The contracts and wire schemas live in `aien-protocols`, so its pin is the contracts pin. UNVERIFIED: no separate contracts repo appears in `gh repo list aien-dev`.
+- `[commits]`: one full 40-hex commit per repo: `omega`, `aienos`, `aien-sovereign-core` (FORGE and `aien-proof`), `aien-protocols`, `aien-architecture`. The contracts and wire schemas live in `aien-protocols`, so its pin is the contracts pin. The crumb contracts are pinned separately in `[contracts]`.
 - `[executables]`: a content digest for every built binary or image under test. `UNBUILT` is allowed only while status begins with `draft`.
+- `[contracts]`: one full 40-hex commit for each contract repo: `crumb-spec` (the Crumb Protocol specification) and `spark-crumbs` (its event ledger implementation). Orchestrator decision 2026-10-01: both are contracts and are pinned in every candidate. Both repos are archived on GitHub, so the pins are stable.
 
 `status` is one of: `draft, not frozen`, `frozen`, `superseded`. Only a `frozen` candidate may be qualified.
 
@@ -34,16 +35,16 @@ Each result (a receipt, or the campaign table row pointing to one) carries:
 
 | Field | Meaning | EvidenceReceiptV1 home |
 |---|---|---|
-| source commits | the candidate id and each pinned commit used | `repo`, `commit`, `dirty` (must be false), `external_refs` carries the candidate id |
-| executable digest | digest of the binary or image run | `input_artifacts` |
+| source commits | the candidate id and each pinned commit used (including `[contracts]`) | `repo`, `commit`, `dirty` (must be false); `external_refs` carries the candidate id as `cand:<id>` |
+| executable digest | digest of the binary or image run; must equal the manifest `[executables]` entry | `external_refs`, one entry `exe:<name>=<digest>` per executable (kept apart from inputs; `input_artifacts` is a digest list with no role tag) |
 | execution environment | host, QEMU, or physical GB10 | `env_class`, `machine` |
-| inputs | data, models, seeds | `input_artifacts` |
+| inputs | data, models, seeds (never the executable) | `input_artifacts` |
 | commands | exact procedure | `procedure`, `toolchain` |
 | raw output location | where the full output is stored | `output_artifacts`, `output_digest` |
 | acceptance criteria | the pass condition, written before the run | `assertions` |
 | status | `PASS`, `FAIL`, `SKIPPED`, or `BLOCKED` | `result` |
 
-A result with a missing field, a dirty tree, or a commit not in the manifest is not a PASS. `SKIPPED` and `BLOCKED` are never reported as PASS. Note: `Verdict` in `evidence.rs` also has `INCOMPLETE`; for campaign tables treat it as not-PASS and report it as `BLOCKED`.
+A result with a missing field, a dirty tree, or a commit not in the manifest is not a PASS. `SKIPPED` and `BLOCKED` are never reported as PASS. `Verdict` in `evidence.rs` also has `INCOMPLETE` (the run did not finish or lacked a required field). Campaign tables report it as `INCOMPLETE`, never as `BLOCKED`: `BLOCKED` means something outside the run (hardware, access, a dependency) stopped it, `INCOMPLETE` means the result itself is missing evidence. Both are not-PASS.
 
 ## Old receipts
 
@@ -55,4 +56,4 @@ Promotion checks (for example `evidence-immutable`) are mandatory. A bypass need
 
 ## Checker
 
-`scripts/check_candidate.sh <manifest.toml>` verifies that all required fields are present, that each pinned commit is 40 hex digits and exists in its repo, and that a non-draft manifest has real executable digests. Test: `scripts/test_check_candidate.sh`. Wiring into CI is not done and needs Drake's approval.
+`scripts/check_candidate.sh <manifest.toml>` verifies that all required fields are present, that each pinned commit (`[commits]` and `[contracts]`) is 40 hex digits and exists in its repo (checked with `gh api`), that executable digests are 64 hex and not all zero, that a `#` inside a quoted value is kept (only a trailing comment is dropped), and that a non-draft manifest has real executable digests. Test: `scripts/test_check_candidate.sh` (offline: a fake `gh` on PATH exercises the real `gh` code path, and mutant copies of the checker prove each check bites). Wiring into CI is not done and needs Drake's approval.
diff --git a/qualification/candidates/CAND-0.toml b/qualification/candidates/CAND-0.toml
index ed43f11..e078f60 100644
--- a/qualification/candidates/CAND-0.toml
+++ b/qualification/candidates/CAND-0.toml
@@ -12,6 +12,10 @@ aien-sovereign-core = "e58742acbb781ad4e472b3355b9b6ac8624617d9"
 aien-protocols = "4a4877a88e141cb0c2d397191459912b8bfa993a"
 aien-architecture = "f11ac55bd96908e004af625c8b53dc02b6188bca"
 
+[contracts]
+crumb-spec = "10b825133580f7a4388ce78aca64b5db52c5d35b"
+spark-crumbs = "98bb7cbf7b7b5aba2d3f03c73b6e7045ad0f07eb"
+
 # Executable digests (SHA-256 or BLAKE3 hex of each built binary or image).
 # "UNBUILT" is allowed only while status starts with "draft".
 [executables]
diff --git a/scripts/check_candidate.sh b/scripts/check_candidate.sh
index 70c8ede..11b3032 100755
--- a/scripts/check_candidate.sh
+++ b/scripts/check_candidate.sh
@@ -5,6 +5,7 @@
 # `gh api repos/aien-dev/<repo>/commits/<sha>`. Override with env var
 # CAND_SHA_CHECK (a command run as: $CAND_SHA_CHECK <repo> <sha>) for tests.
 set -u
+# Commit pins: [commits] (5 repos) and [contracts] (crumb-spec, spark-crumbs).
 f="${1:-}"
 [ -f "$f" ] || { echo "usage: $0 <manifest.toml>" >&2; exit 1; }
 fail=0
@@ -19,13 +20,13 @@ sha_exists() {
 declare -A kv
 sec=""
 while IFS= read -r line; do
-  line="${line%%#*}"
-  line="$(echo "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
-  [ -z "$line" ] && continue
-  if [[ "$line" =~ ^\[([A-Za-z0-9_.-]+)\]$ ]]; then sec="${BASH_REMATCH[1]}."; continue; fi
-  if [[ "$line" =~ ^([A-Za-z0-9_.-]+)[[:space:]]*=[[:space:]]*\"(.*)\"$ ]]; then
-    kv["${sec}${BASH_REMATCH[1]}"]="${BASH_REMATCH[2]}"
+  # A quoted value may contain #; only a trailing comment after the closing quote is dropped.
+  if [[ "$line" =~ ^[[:space:]]*([A-Za-z0-9_.-]+)[[:space:]]*=[[:space:]]*\"([^\"]*)\"[[:space:]]*(#.*)?$ ]]; then
+    kv["${sec}${BASH_REMATCH[1]}"]="${BASH_REMATCH[2]}"; continue
   fi
+  line="$(echo "$line" | sed -e 's/^[[:space:]]*#.*//' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
+  [ -z "$line" ] && continue
+  if [[ "$line" =~ ^\[([A-Za-z0-9_.-]+)\][[:space:]]*(#.*)?$ ]]; then sec="${BASH_REMATCH[1]}."; continue; fi
 done < "$f"
 
 for k in schema id status created; do
@@ -37,11 +38,11 @@ case "${kv[status]:-}" in
   *) err "status must be 'draft, not frozen', 'frozen' or 'superseded'" ;;
 esac
 
-for r in omega aienos aien-sovereign-core aien-protocols aien-architecture; do
-  s="${kv[commits.$r]:-}"
+for r in commits.omega commits.aienos commits.aien-sovereign-core commits.aien-protocols commits.aien-architecture contracts.crumb-spec contracts.spark-crumbs; do
+  s="${kv[$r]:-}"; repo="${r#*.}"
   if [ -z "$s" ]; then err "missing commit: $r"; continue; fi
   [[ "$s" =~ ^[0-9a-f]{40}$ ]] || { err "commit for $r is not 40 lowercase hex: $s"; continue; }
-  sha_exists "$r" "$s" || err "commit $s not found in aien-dev/$r"
+  sha_exists "$repo" "$s" || err "commit $s not found in aien-dev/$repo"
 done
 
 nexe=0
@@ -53,6 +54,7 @@ for k in "${!kv[@]}"; do
     [[ "${kv[status]:-}" == draft* ]] || err "$k is UNBUILT but status is not draft"
   else
     [[ "$v" =~ ^[0-9a-f]{64}$ ]] || err "$k digest is not 64 lowercase hex"
+    [[ "$v" =~ ^0{64}$ ]] && err "$k digest is all zero (placeholder, not a real digest)"
   fi
 done
 [ "$nexe" -gt 0 ] || err "no [executables] entries"
diff --git a/scripts/test_check_candidate.sh b/scripts/test_check_candidate.sh
index 531a8f6..47922e4 100755
--- a/scripts/test_check_candidate.sh
+++ b/scripts/test_check_candidate.sh
@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
-# Test for check_candidate.sh using a stub sha checker (no network).
+# Test for check_candidate.sh. Offline: sha existence is stubbed (CAND_SHA_CHECK) and,
+# for the real gh code path, a fake `gh` on PATH. No network or auth needed.
 set -u
 here="$(cd "$(dirname "$0")" && pwd)"
 chk="$here/check_candidate.sh"
@@ -23,5 +24,62 @@ sed 's/^omega = .*/omega = "abc123"/' "$good" > "$tmp/c.toml"; expect 1 "short s
 sed 's/^aienos = .*/aienos = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"/' "$good" > "$tmp/d.toml"; expect 1 "nonexistent sha" "$tmp/d.toml"
 sed 's/^status = .*/status = "frozen"/' "$good" > "$tmp/e.toml"; expect 1 "frozen with UNBUILT" "$tmp/e.toml"
 sed '/^omega-runtime/d;/^aienos-boot/d;/^aien-proof =/d' "$good" > "$tmp/f.toml"; expect 1 "no executables" "$tmp/f.toml"
+H64a=$(printf 'a%.0s' $(seq 64)); H64b=$(printf 'b%.0s' $(seq 64)); H64c=$(printf 'c%.0s' $(seq 64))
+Z64=$(printf '0%.0s' $(seq 64))
+frozen() { # frozen <out> : valid frozen manifest with real-looking digests
+  sed -e 's/^status = .*/status = "frozen"/' -e "s/^omega-runtime = .*/omega-runtime = \"$H64a\"/" \
+      -e "s/^aienos-boot-image = .*/aienos-boot-image = \"$H64b\"/" -e "s/^aien-proof = .*/aien-proof = \"$H64c\"/" "$good" > "$1"
+}
+
+# --- new: positive frozen case
+frozen "$tmp/fz.toml";                                          expect 0 "frozen with real digests" "$tmp/fz.toml"
+# --- new: all-zero digest rejected (frozen and draft)
+sed "s/^aien-proof = .*/aien-proof = \"$Z64\"/" "$tmp/fz.toml" > "$tmp/z.toml"; expect 1 "all-zero digest (frozen)" "$tmp/z.toml"
+sed "s/^aien-proof = .*/aien-proof = \"$Z64\"/" "$good" > "$tmp/z2.toml";        expect 1 "all-zero digest (draft)" "$tmp/z2.toml"
+# --- new: '#' inside a quoted value is kept, not truncated
+sed "s/^aien-proof = .*/aien-proof = \"${H64c}#frag\"/" "$tmp/fz.toml" > "$tmp/h.toml"; expect 1 "digest with # is not truncated into validity" "$tmp/h.toml"
+sed 's/^note = .*/note = "issue #5 and #6"  # trailing comment/' "$good" > "$tmp/n.toml"; expect 0 "# in note and trailing comment ok" "$tmp/n.toml"
+# --- new: contracts pinned
+sed '/^crumb-spec = /d' "$good" > "$tmp/k1.toml";               expect 1 "missing crumb-spec" "$tmp/k1.toml"
+sed '/^spark-crumbs = /d' "$good" > "$tmp/k2.toml";             expect 1 "missing spark-crumbs" "$tmp/k2.toml"
+sed 's/^spark-crumbs = .*/spark-crumbs = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"/' "$good" > "$tmp/k3.toml"; expect 1 "nonexistent spark-crumbs sha" "$tmp/k3.toml"
+sed 's/^crumb-spec = .*/crumb-spec = "abc"/' "$good" > "$tmp/k4.toml"; expect 1 "short crumb-spec sha" "$tmp/k4.toml"
+
+# --- new: real gh code path, via a faithful offline stub of `gh` on PATH.
+# The stub accepts `gh api repos/aien-dev/<repo>/commits/<sha> -q .sha`, prints the sha and
+# exits 0 for known shas, prints a 404 message and exits 1 for deadbeef..., and logs argv.
+mkdir -p "$tmp/bin"; log="$tmp/gh.log"
+cat > "$tmp/bin/gh" <<'S'
+#!/usr/bin/env bash
+echo "$*" >> "$GH_STUB_LOG"
+[ "$1" = "api" ] || exit 2
+sha="${2##*/}"
+if [ "$sha" = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ]; then echo "gh: Not Found (HTTP 404)" >&2; exit 1; fi
+echo "$sha"
+S
+chmod +x "$tmp/bin/gh"
+ghexpect() { # ghexpect <rc> <label> <file>
+  ( unset CAND_SHA_CHECK; PATH="$tmp/bin:$PATH" GH_STUB_LOG="$log" "$chk" "$3" >/dev/null 2>&1 ); rc=$?
+  if [ "$rc" = "$1" ]; then pass=$((pass+1)); else bad=$((bad+1)); echo "TEST FAIL: $2 (rc=$rc)"; fi
+}
+: > "$log"
+ghexpect 0 "gh path: CAND-0 valid" "$good"
+grep -q 'api repos/aien-dev/crumb-spec/commits/10b825133580f7a4388ce78aca64b5db52c5d35b ' "$log" \
+  && pass=$((pass+1)) || { bad=$((bad+1)); echo "TEST FAIL: gh was not called for crumb-spec"; }
+[ "$(wc -l < "$log")" -eq 7 ] && pass=$((pass+1)) || { bad=$((bad+1)); echo "TEST FAIL: expected 7 gh calls, got $(wc -l < "$log")"; }
+ghexpect 1 "gh path: 404 sha rejected" "$tmp/d.toml"
+ghexpect 1 "gh path: 404 contract sha rejected" "$tmp/k3.toml"
+
+# --- new: mutants. Each broken copy of the checker must wrongly accept the bad input,
+# proving the new test above really depends on the new check.
+mutant() { # mutant <label> <sed-expr> <input-file>
+  sed "$2" "$chk" > "$tmp/mut.sh"; chmod +x "$tmp/mut.sh"
+  if cmp -s "$chk" "$tmp/mut.sh"; then bad=$((bad+1)); echo "TEST FAIL: mutant '$1' did not change the checker"; return; fi
+  "$tmp/mut.sh" "$3" >/dev/null 2>&1; rc=$?
+  if [ "$rc" = 0 ]; then pass=$((pass+1)); else bad=$((bad+1)); echo "TEST FAIL: mutant '$1' still rejected (rc=$rc), test does not bite"; fi
+}
+mutant "no zero-digest check" '/all zero/d' "$tmp/z.toml"
+mutant "old # truncation" 's/^while IFS= read -r line; do$/while IFS= read -r line; do line="${line%%#*}"/' "$tmp/h.toml"
+mutant "contracts not required" 's/ contracts.crumb-spec contracts.spark-crumbs;/;/' "$tmp/k1.toml"
 echo "passed=$pass failed=$bad"
 [ "$bad" -eq 0 ]