From d8bd4d922a556e00af2fb4d4b2dd8059c0740d2f Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 5 Oct 2026 12:52:32 -0500 Subject: [PATCH 1/2] qualification: check_candidate_pins.sh (pins vs what the pinned code consumes); CAND-1 contract pins recorded as wrong check_candidate.sh proves each pin exists; the new script proves the pins agree with each other, reading lock files from GitHub at the pinned commits: sovereign-core omega.lock and Cargo.lock (aien-protocols, crumb-spec, spark-crumbs), omega physics.lock and aienos.lock, and the known [consumed_pins] entries. 14 offline tests. On the frozen manifests: CAND-0 disagrees on aienos (its recorded gap G1); CAND-1 pins the crumb-spec and spark-crumbs heads (10b8251, 98bb7cb) while its Cargo.lock consumes 24194d1 and 9355a92. CAND-1.toml is frozen and stays as is; CAND-1.gates.md section 3 records the error. Co-Authored-By: Claude Opus 5.5 --- .crumb | 16 ++-- docs/.crumb | 10 +-- docs/qualification/CANDIDATE.md | 2 + qualification/candidates/CAND-1.gates.md | 5 ++ scripts/.crumb | 10 +-- scripts/check_candidate_pins.sh | 106 ++++++++++++++++++++++ scripts/test_check_candidate_pins.sh | 107 +++++++++++++++++++++++ 7 files changed, 238 insertions(+), 18 deletions(-) create mode 100755 scripts/check_candidate_pins.sh create mode 100755 scripts/test_check_candidate_pins.sh diff --git a/.crumb b/.crumb index 94ccf63..e91f416 100644 --- a/.crumb +++ b/.crumb @@ -21,7 +21,7 @@ "generated": { "children": [ { - "digest": "7a274e73dd98c83d87711fb503bf433361846084959462cc56e01a70b11f1871", + "digest": "4e1642f63092b7a66dba3b40e8cffe7a748d025a201ed2effb4c37ad1ab81957", "last_commit": "9403e34", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." @@ -33,7 +33,7 @@ "purpose": "Directory doctrine. Purpose not yet described by a human." }, { - "digest": "fa990e71f6e3b3dbe1ab8072cf5ed51f8a4bcb0759756c60fc09b647bfcc6904", + "digest": "733206d3f9ad3c20951c29f8411d41bf3220ab12403fbec816c450f6f616a286", "last_commit": "a44d5da", "name": "scripts", "purpose": "Directory scripts. Purpose not yet described by a human." @@ -45,15 +45,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:e06d2dd2d9c99dd3961b3578b2f5785aae4053595f77dffac35c710525764e0a", - "compiled_at": "2026-10-05T14:07:13Z", + "children_root": "sha256:d897d2b76b0b0f99e33be598e574c7a2ce974d4a5d110070f453fd7d8b1aa72a", + "compiled_at": "2026-10-05T17:52:17Z", "compiler": "crumb-compile/1", - "digest": "sha256:fa8dac7d8ad92a1f3d2007f6f86fb5434e67010a74d58f23a46932517459cab8", + "digest": "sha256:31975a3b81b17dde7e665a920efd018066bb230c343553466537efd0e5087987", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 219, - "generated_at_commit": "86266343f979875419e3239226bbd9e2a287b9d1", - "source_tree": "sha256:2ee849f0678d85a7a1f298d1507e60811097edf46ed4a839d98e0bd69000aca0" + "files": 221, + "generated_at_commit": "d0fe710a7289b7ad025dd73b062835fbb75f659c", + "source_tree": "sha256:ec6c089539c15fa78923ae08acce5ad14902659aebabeec4ef836c052d67ddeb" }, "owner_lane": "", "provenance": { diff --git a/docs/.crumb b/docs/.crumb index dac8c3d..06cab60 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -56,7 +56,7 @@ }, { "digest": "2812aeb880835afae274e0a164ed976362b191717bd958d54a4c5c5f48ed05af", - "last_commit": "d2a49e0", + "last_commit": "9403e34", "name": "plans", "purpose": "Directory docs/plans. Purpose not yet described by a human." }, @@ -74,14 +74,14 @@ } ], "children_root": "sha256:bde813bd3da2022fdea0b51909fffcaf9185928075df4868d9520f7c42fcff99", - "compiled_at": "2026-10-05T12:34:11Z", + "compiled_at": "2026-10-05T17:52:10Z", "compiler": "crumb-compile/1", - "digest": "sha256:7a274e73dd98c83d87711fb503bf433361846084959462cc56e01a70b11f1871", + "digest": "sha256:4e1642f63092b7a66dba3b40e8cffe7a748d025a201ed2effb4c37ad1ab81957", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 121, - "generated_at_commit": "d2a49e0fb4dac777271bf7c184ff048d5c63b4ba", - "source_tree": "sha256:11300a4e990a14754138c6d4a38cb2c2288a6b90136d405792df12cf49089d6b" + "generated_at_commit": "d0fe710a7289b7ad025dd73b062835fbb75f659c", + "source_tree": "sha256:2efff52ac67b33d36a95ee3da2dc3c342a8d91edd802a07f126658db46efb08e" }, "owner_lane": "", "provenance": { diff --git a/docs/qualification/CANDIDATE.md b/docs/qualification/CANDIDATE.md index 8b73076..7aab384 100644 --- a/docs/qualification/CANDIDATE.md +++ b/docs/qualification/CANDIDATE.md @@ -58,3 +58,5 @@ Promotion checks (for example `evidence-immutable`) are mandatory. A bypass need ## Checker `scripts/check_candidate.sh ` 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` (the 2026-10-01 draft is kept as `scripts/testdata/cand-draft-fixture.toml`; 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. + +`scripts/check_candidate_pins.sh ` verifies that the pins agree with what the pinned code consumes: the sovereign-core `omega.lock` equals `[commits] omega`; the sovereign-core `Cargo.lock` git revisions of aien-protocols, crumb-spec and spark-crumbs equal `[commits] aien-protocols` and the two `[contracts]`; the omega `physics.lock` and `aienos.lock` equal `[commits] physics` and `aienos`; each known `[consumed_pins]` entry equals the value read. Lock files are read from GitHub at the pinned commits. A repo with two revisions in `Cargo.lock`, or an unreadable lock file, fails. Test: `scripts/test_check_candidate_pins.sh` (offline, lock files served by a stub). Results on the frozen manifests (2026-10-05): CAND-0 disagrees on aienos (its recorded gap G1); CAND-1 disagrees on both contracts: it pins the crumb-spec and spark-crumbs heads (`10b8251`, `98bb7cb`), while its sovereign-core `Cargo.lock` consumes `24194d1` and `9355a92`, the values CAND-0 pins. Frozen manifests are not edited; CAND-1.gates.md and later candidates record it. diff --git a/qualification/candidates/CAND-1.gates.md b/qualification/candidates/CAND-1.gates.md index 725ae47..8e2ef6f 100644 --- a/qualification/candidates/CAND-1.gates.md +++ b/qualification/candidates/CAND-1.gates.md @@ -75,6 +75,11 @@ omega #290 (the R15 sampler no longer leaves a 24 h `sleep` holding the quiet fl - **TRUST-1 M5:** 11 gates need attended hardware boots or operator ceremonies; 5 have no implementation; the Gate 7 preflight refuses because Secure Boot is off on this machine (operator setting). Not qualified. - **Physical machine:** every AIENOS result is QEMU. Nothing here qualifies the Spark booting AIENOS. +- **Contract pins in the manifest are wrong** (found 2026-10-05 by `scripts/check_candidate_pins.sh`). `CAND-1.toml` + `[contracts]` pins the crumb-spec and spark-crumbs heads (`10b8251`, `98bb7cb`); the sovereign-core `Cargo.lock` at + `2eec75b` consumes `24194d1` and `9355a92` (two commits behind each head, the revisions CAND-0 pins). The built + executables used the consumed revisions, so the digests are unaffected; the manifest line is wrong. A frozen + manifest is not edited; CAND-2 pins the consumed revisions. - **Path independence** tested 2026-10-05 by a build at a second checkout path (`CAND1-PATH2-2eec75b`): 8 of 9 executables reproduce the CAND-1 digests, including aien-cli. omegatool (`omega-runtime`) does not: it embeds the physics checkout path in three strings (control: the second-path omega checkout built with the physics path set diff --git a/scripts/.crumb b/scripts/.crumb index dc606b8..ca085af 100644 --- a/scripts/.crumb +++ b/scripts/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-05T03:32:07Z", + "compiled_at": "2026-10-05T17:52:17Z", "compiler": "crumb-compile/1", - "digest": "sha256:fa990e71f6e3b3dbe1ab8072cf5ed51f8a4bcb0759756c60fc09b647bfcc6904", + "digest": "sha256:733206d3f9ad3c20951c29f8411d41bf3220ab12403fbec816c450f6f616a286", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 5, - "generated_at_commit": "c5d80978c7a22cc039e67def9745cede5010f388", - "source_tree": "sha256:9fcc43ef8155c0c5705c20333999b2a919de931f6d160ea822e13bfb6894f6cc" + "files": 7, + "generated_at_commit": "d0fe710a7289b7ad025dd73b062835fbb75f659c", + "source_tree": "sha256:25a9c3b11cd44fd50b9649b9237e6c8540be50ec1b516a47926b19f9e4c82c11" }, "owner_lane": "", "provenance": { diff --git a/scripts/check_candidate_pins.sh b/scripts/check_candidate_pins.sh new file mode 100755 index 0000000..367e8a0 --- /dev/null +++ b/scripts/check_candidate_pins.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +# check_candidate_pins.sh: do the pins of a candidate manifest equal what the pinned code consumes? +# Usage: scripts/check_candidate_pins.sh +# check_candidate.sh proves each pinned commit exists; this script proves the pins agree with each other. +# It reads the lock files of the pinned commits from GitHub and compares: +# sovereign-core omega.lock = [commits] omega +# sovereign-core Cargo.lock aien-protocols rev = [commits] aien-protocols +# sovereign-core Cargo.lock crumb-spec rev = [contracts] crumb-spec +# sovereign-core Cargo.lock spark-crumbs rev = [contracts] spark-crumbs +# omega physics.lock = [commits] physics (when pinned) +# omega aienos.lock = [commits] aienos +# every [consumed_pins] key below = the value read from its lock file +# A Cargo.lock package with more than one git revision, or a lock file that cannot be read, fails. +# Exit 0 = every pin agrees, 1 = any mismatch or read failure. Pure bash plus `gh api`. +# Override the reader with CAND_FILE_AT (a command run as: $CAND_FILE_AT , printing the +# file) for offline tests. +set -u +f="${1:-}" +[ -f "$f" ] || { echo "usage: $0 " >&2; exit 1; } +fail=0 +ok() { echo "OK: $*"; } +err() { echo "FAIL: $*" >&2; fail=1; } + +file_at() { + if [ -n "${CAND_FILE_AT:-}" ]; then $CAND_FILE_AT "$1" "$2" "$3" + else gh api -H "Accept: application/vnd.github.raw" "repos/aien-dev/$1/contents/$3?ref=$2"; fi +} + +# Same parser as check_candidate.sh: "section.key" -> value, for lines `key = "value"`. +declare -A kv +sec="" +while IFS= read -r line; do + 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" + +# first 40-hex token of a lock file (the rest of the line or file may be a comment) +lock_sha() { grep -o -m1 '[0-9a-f]\{40\}' | head -1; } + +# git revision of the aien-dev repo $2 in Cargo.lock text $1: every package whose source is that repo (a repo +# that ships several crates, such as aien-protocols, counts once); fails on zero or several revisions +cargo_rev() { + local revs + revs=$(printf '%s\n' "$1" | grep -E "^source = \"git\+https://github\.com/aien-dev/$2(\.git)?[?#]" \ + | grep -oE '#[0-9a-f]{40}"' | cut -c2-41 | sort -u) + [ -n "$revs" ] || { echo "none"; return 1; } + [ "$(printf '%s\n' "$revs" | wc -l)" -eq 1 ] || { echo "several:$(echo $revs)"; return 1; } + echo "$revs" +} + +same() { # same