aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / tools / candidate / parity / mkcases.sh
| 1 | #!/usr/bin/env bash |
| 2 | # tools/candidate/parity/mkcases.sh <repo> <outdir>: (re)build the case directories of the parity |
| 3 | # corpus from scripts/testdata/cand-draft-fixture.toml, the live CAND-0/CAND-4 manifests and the |
| 4 | # recipes of the two test suites, plus the adversarial cases. The committed cases/ were made by |
| 5 | # this script; expected/ was then recorded with run.sh ... record from the bash checkers at |
| 6 | # 1dd84d1 (git show 1dd84d1:scripts/check_candidate.sh), which the .om binaries must reproduce. |
| 7 | # Each case is a directory: m.toml (+ amendments, files/), optional `args` (one arg per line, |
| 8 | # default "m.toml"), `mode` (sha | shawords | emptysha | gh | files | fileswords, see run.sh) and |
| 9 | # optional `limit` (a named difference from the bash; README "Limits"). |
| 10 | set -eu |
| 11 | repo="$1"; out="$2" |
| 12 | good="$repo/scripts/testdata/cand-draft-fixture.toml" |
| 13 | live0="$repo/qualification/candidates/CAND-0.toml" |
| 14 | live4src="$repo/qualification/candidates/CAND-4.toml" |
| 15 | H64a=$(printf 'a%.0s' $(seq 64)); H64b=$(printf 'b%.0s' $(seq 64)); H64c=$(printf 'c%.0s' $(seq 64)); Z64=$(printf '0%.0s' $(seq 64)) |
| 16 | rm -rf "$out"; mkdir -p "$out/candidate" "$out/pins" |
| 17 | # The live manifests are frozen records naming the build host and its home directory. The corpus |
| 18 | # copies them with a synthetic home (/home/alice) and host name (spark); nothing the checkers judge |
| 19 | # reads those two values, and CAND-4's amendment is re-pointed at the copy's own sha256 below. |
| 20 | synth() { sed -e 's#/home/[a-z]*/#/home/alice/#g' -e 's/"spark-[0-9a-f]\{4\}, /"spark, /' "$1"; } |
| 21 | live="$out/live-cand0.toml"; synth "$live0" > "$live" |
| 22 | live4="$out/live-cand4.toml"; synth "$live4src" > "$live4" |
| 23 | C="$out/candidate" |
| 24 | mk() { mkdir -p "$C/$1"; echo "${2:-sha}" > "$C/$1/mode"; } |
| 25 | frozen() { sed -e 's/^status = .*/status = "frozen"/' -e "s/^omega-runtime = .*/omega-runtime = \"$H64a\"/" \ |
| 26 | -e "s/^aienos-boot-image = .*/aienos-boot-image = \"$H64b\"/" -e "s/^aien-proof = .*/aien-proof = \"$H64c\"/" "$good"; } |
| 27 | mk good; cp "$good" "$C/good/m.toml" |
| 28 | mk missing-omega; sed '/^omega = /d' "$good" > "$C/missing-omega/m.toml" |
| 29 | mk missing-id; sed 's/^id = .*//' "$good" > "$C/missing-id/m.toml" |
| 30 | mk short-sha; sed 's/^omega = .*/omega = "abc123"/' "$good" > "$C/short-sha/m.toml" |
| 31 | mk nonexistent-sha; sed 's/^aienos = .*/aienos = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"/' "$good" > "$C/nonexistent-sha/m.toml" |
| 32 | mk frozen-unbuilt; sed 's/^status = .*/status = "frozen"/' "$good" > "$C/frozen-unbuilt/m.toml" |
| 33 | mk no-executables; sed '/^omega-runtime/d;/^aienos-boot/d;/^aien-proof =/d' "$good" > "$C/no-executables/m.toml" |
| 34 | mk frozen-ok; frozen > "$C/frozen-ok/m.toml" |
| 35 | mk zero-digest-frozen; frozen | sed "s/^aien-proof = .*/aien-proof = \"$Z64\"/" > "$C/zero-digest-frozen/m.toml" |
| 36 | mk zero-digest-draft; sed "s/^aien-proof = .*/aien-proof = \"$Z64\"/" "$good" > "$C/zero-digest-draft/m.toml" |
| 37 | mk hash-in-digest; frozen | sed "s/^aien-proof = .*/aien-proof = \"${H64c}#frag\"/" > "$C/hash-in-digest/m.toml" |
| 38 | mk hash-in-note; sed 's/^note = .*/note = "issue #5 and #6" # trailing comment/' "$good" > "$C/hash-in-note/m.toml" |
| 39 | mk missing-crumb-spec; sed '/^crumb-spec = /d' "$good" > "$C/missing-crumb-spec/m.toml" |
| 40 | mk missing-spark-crumbs; sed '/^spark-crumbs = /d' "$good" > "$C/missing-spark-crumbs/m.toml" |
| 41 | mk nonexistent-spark-crumbs; sed 's/^spark-crumbs = .*/spark-crumbs = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"/' "$good" > "$C/nonexistent-spark-crumbs/m.toml" |
| 42 | mk short-crumb-spec; sed 's/^crumb-spec = .*/crumb-spec = "abc"/' "$good" > "$C/short-crumb-spec/m.toml" |
| 43 | mk gh-good gh; cp "$good" "$C/gh-good/m.toml" |
| 44 | mk gh-404 gh; cp "$C/nonexistent-sha/m.toml" "$C/gh-404/m.toml" |
| 45 | mk gh-404-contract gh; cp "$C/nonexistent-spark-crumbs/m.toml" "$C/gh-404-contract/m.toml" |
| 46 | mk live-cand0; cp "$live" "$C/live-cand0/m.toml" |
| 47 | mk gh-live-cand0 gh; cp "$live" "$C/gh-live-cand0/m.toml" |
| 48 | mk short-physics; sed 's/^physics = .*/physics = "abc123"/' "$live" > "$C/short-physics/m.toml" |
| 49 | mk nonexistent-interplane; sed 's/^interplane = .*/interplane = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"/' "$live" > "$C/nonexistent-interplane/m.toml" |
| 50 | mk frozen-live-unbuilt; sed 's/^omega-runtime = .*/omega-runtime = "UNBUILT"/' "$live" > "$C/frozen-live-unbuilt/m.toml" |
| 51 | # amendments |
| 52 | amend() { # amend <dir> <n> <manifest-sha> [extra line...] |
| 53 | local d="$1" n="$2" s="$3"; shift 3 |
| 54 | { printf 'schema = "CandidateAmendmentV1"\ncandidate = "CAND-0"\namendment = "%s"\ndate = "2026-10-06"\nreason = "test"\nmanifest-sha256 = "%s"\n\n[model]\n' "$n" "$s" |
| 55 | printf 'oracle-fixture-safetensors-sha256 = "%s"\n' "$H64a"; for l in "$@"; do printf '%s\n' "$l"; done; } > "$d/m.amendment-$n.toml" |
| 56 | } |
| 57 | cx() { frozen; printf '\n[model]\nmodel-id = "m"\n'; } |
| 58 | cx > /tmp/cx.$$; MSHA=$(sha256sum /tmp/cx.$$ | cut -d' ' -f1) |
| 59 | am() { mk "$1"; cp /tmp/cx.$$ "$C/$1/m.toml"; } |
| 60 | am amend-valid; amend "$C/amend-valid" 1 "$MSHA" |
| 61 | am amend-zero-digest; amend "$C/amend-zero-digest" 1 "$MSHA" "tokenizer-json-sha256 = \"$Z64\"" |
| 62 | am amend-edited; amend "$C/amend-edited" 1 "$MSHA"; echo '# edited after the freeze' >> "$C/amend-edited/m.toml" |
| 63 | am amend-executables; amend "$C/amend-executables" 1 "$MSHA" "[executables]" "omega-runtime = \"$H64b\"" |
| 64 | am amend-commits; amend "$C/amend-commits" 1 "$MSHA" "[commits]" "physics = \"0123456789012345678901234567890123456789\"" |
| 65 | am amend-override; amend "$C/amend-override" 1 "$MSHA" "model-id = \"other\"" |
| 66 | am amend-wrong-candidate; amend "$C/amend-wrong-candidate" 1 "$MSHA"; sed -i 's/^candidate = .*/candidate = "CAND-9"/' "$C/amend-wrong-candidate/m.amendment-1.toml" |
| 67 | am amend-wrong-number; amend "$C/amend-wrong-number" 1 "$MSHA"; sed -i 's/^amendment = .*/amendment = "2"/' "$C/amend-wrong-number/m.amendment-1.toml" |
| 68 | am amend-two; amend "$C/amend-two" 1 "$MSHA"; amend "$C/amend-two" 2 "$MSHA" "[model]" "extra-sha256 = \"$H64b\""; sed -i 's/^amendment = "2"/amendment = "2"/' "$C/amend-two/m.amendment-2.toml" |
| 69 | am amend-no-keys; amend "$C/amend-no-keys" 1 "$MSHA"; sed -i '/oracle-fixture/d' "$C/amend-no-keys/m.amendment-1.toml" |
| 70 | am amend-unknown-top; amend "$C/amend-unknown-top" 1 "$MSHA"; printf 'stray = "x"\nother = "y"\nthird = "z"\n' >> "$C/amend-unknown-top/m.amendment-1.toml" |
| 71 | am amend-bad-schema; amend "$C/amend-bad-schema" 1 "$MSHA"; sed -i 's/^schema = .*/schema = "Nope"/;/^date = /d' "$C/amend-bad-schema/m.amendment-1.toml" |
| 72 | am amend-dir-skipped; amend "$C/amend-dir-skipped" 1 "$MSHA"; mkdir -p "$C/amend-dir-skipped/m.amendment-7.toml"; : > "$C/amend-dir-skipped/m.amendment-7.toml/.keep" |
| 73 | am amend-many-bad; amend "$C/amend-many-bad" 1 "$MSHA" "[model]" $(for i in $(seq 1 24); do printf 'k%02d-sha256 = "zz"\n' $i; done | tr '\n' ' ') "[contracts]" 'x = "1"' "[consumed_pins]" 'y = "2"' 'model-id = "dup"' ; sed -i 's/ k\([0-9]*\)-sha256 = "zz"/\nk\1-sha256 = "zz"/g' "$C/amend-many-bad/m.amendment-1.toml" |
| 74 | am amend-sha-not-real; amend "$C/amend-sha-not-real" 1 "$MSHA" "a-sha256 = \"abc\"" "b-sha256 = \"$Z64\"" "c-sha256 = \"$H64c\"" |
| 75 | am amend-order; for n in 1 2 10; do amend "$C/amend-order" $n "$MSHA"; sed -i 's/^candidate = .*/candidate = "CAND-X"/' "$C/amend-order/m.amendment-$n.toml"; done; echo "bash globs <stem>.amendment-*.toml in the locale's collation (en_US: 10, 1, 2); the .om walks the names in byte order (1, 10, 2); only the order of FAIL lines of several amendments differs" > "$C/amend-order/limit" |
| 76 | mk live-cand4; cp "$live4" "$C/live-cand4/m.toml" |
| 77 | sed "s/^manifest-sha256 = \"[0-9a-f]*\" # CAND-4.toml at /manifest-sha256 = \"$(sha256sum "$live4" | cut -d' ' -f1)\" # synthetic-host copy of CAND-4.toml at /" \ |
| 78 | "$repo/qualification/candidates/CAND-4.amendment-1.toml" > "$C/live-cand4/m.amendment-1.toml" |
| 79 | rm -f "$live" "$live4" |
| 80 | # adversarial |
| 81 | mk dup-key; { cat "$good"; printf '\n[commits]\nomega = "abc"\nid = "later"\n'; } > "$C/dup-key/m.toml" |
| 82 | mk dup-key-section; sed 's/^id = .*/id = "first"\nid = "second"/' "$good" > "$C/dup-key-section/m.toml"; sed -i 's/^aien-proof = .*/aien-proof = "UNBUILT"\naien-proof = "zz"/' "$C/dup-key-section/m.toml" |
| 83 | mk wrong-type; sed 's/^status = .*/status = frozen/; s/^created = .*/created = 2026/; s/^omega-runtime = .*/omega-runtime = [1, 2]/' "$good" > "$C/wrong-type/m.toml" |
| 84 | mk wrong-type-amend; cp /tmp/cx.$$ "$C/wrong-type-amend/m.toml"; amend "$C/wrong-type-amend" 1 "$MSHA"; sed -i 's/^amendment = .*/amendment = 1/' "$C/wrong-type-amend/m.amendment-1.toml" |
| 85 | mk extra-section; { cat "$good"; printf '\n[extra]\nfoo = "bar"\n[[array]]\nx = "y"\n[executables.sub]\nz = "UNBUILT"\n'; } > "$C/extra-section/m.toml" |
| 86 | mk crlf; sed 's/$/\r/' "$good" > "$C/crlf/m.toml" |
| 87 | mk crlf-amend; sed 's/$/\r/' /tmp/cx.$$ > "$C/crlf-amend/m.toml"; amend "$C/crlf-amend" 1 "$(sha256sum "$C/crlf-amend/m.toml" | cut -d' ' -f1)"; sed -i 's/$/\r/' "$C/crlf-amend/m.amendment-1.toml" |
| 88 | mk trailing-space; sed 's/^\(\[[a-z]*\]\)$/\1 /; s/^\(schema = ".*"\)$/\1 \t /; s/^\(omega = ".*"\)$/ \1 /' "$good" > "$C/trailing-space/m.toml" |
| 89 | mk no-final-newline; printf '%s' "$(cat "$good")" > "$C/no-final-newline/m.toml" |
| 90 | mk no-final-newline-exe; { sed '/^aien-proof = /d' "$good"; printf 'aien-proof = "UNBUILT"'; } > "$C/no-final-newline-exe/m.toml" |
| 91 | mk nul-byte; { printf 'id = "CA\0ND-0"\n'; sed '/^id = /d' "$good"; } > "$C/nul-byte/m.toml" |
| 92 | mk non-ascii; { printf 'note = "caf\xc3\xa9"\nnote2 = "caf\xe9 raw"\n'; sed 's/^id = .*/id = "CAND-caf\xc3\xa9"/' "$good"; } > "$C/non-ascii/m.toml" |
| 93 | mk non-ascii-invalid; sed 's/^id = .*/id = "CAND-\xe9"/; s/^created = .*/created = "2026" # \xe9/' "$good" > "$C/non-ascii-invalid/m.toml"; echo "bash under a UTF-8 LANG refuses the regex on invalid UTF-8; the .om matches bytes" > "$C/non-ascii-invalid/limit" |
| 94 | mk non-ascii-space; sed 's/^status = .*/status = "draft, not frozen"\xe2\x80\x83/' "$good" > "$C/non-ascii-space/m.toml"; echo "bash under a UTF-8 LANG counts U+2003 (any iswspace character) as [[:space:]]; the .om knows the six ASCII spaces only" > "$C/non-ascii-space/limit" |
| 95 | mk non-ascii-nbsp; sed 's/^status = .*/status = "draft, not frozen"\xc2\xa0/' "$good" > "$C/non-ascii-nbsp/m.toml" |
| 96 | mk empty-value; sed 's/^id = .*/id = ""/; s/^status = .*/status = ""/' "$good" > "$C/empty-value/m.toml" |
| 97 | mk junk-lines; { printf ' # leading comment\n\t[commits] junk\nkey = "v" junk\n= "x"\n[]\n[bad key]\nkey = "unterminated\nkey == "v"\n'; cat "$good"; printf '[ spaced ]\n [tail] # c\nzzz = "1"\n'; } > "$C/junk-lines/m.toml" |
| 98 | mk compact; sed 's/ = /=/' "$good" > "$C/compact/m.toml" |
| 99 | mk many-exe-bad; { cat "$good"; printf '[executables]\n'; for i in $(seq 1 40); do printf 'bin-%02d = "nope%d"\n' $i $i; done; for i in $(seq 1 10); do printf 'img-%02d = "UNBUILT"\n' $i; done; } | sed 's/^status = .*/status = "frozen"/' > "$C/many-exe-bad/m.toml" |
| 100 | mk many-exe-ok; { cat "$good"; printf '[executables]\n'; for i in $(seq 1 200); do printf 'bin-%03d = "UNBUILT"\n' $i; done; } > "$C/many-exe-ok/m.toml" |
| 101 | mk empty-file; : > "$C/empty-file/m.toml" |
| 102 | mk only-comments; printf '# a\n\n # b\n' > "$C/only-comments/m.toml" |
| 103 | mk no-arg; cp "$good" "$C/no-arg/m.toml"; : > "$C/no-arg/args" |
| 104 | mk missing-file; printf 'nope.toml\n' > "$C/missing-file/args" |
| 105 | mk dir-arg; mkdir -p "$C/dir-arg/d.toml"; : > "$C/dir-arg/d.toml/.keep"; printf 'd.toml\n' > "$C/dir-arg/args" |
| 106 | mk subdir-path; mkdir -p "$C/subdir-path/sub"; cp /tmp/cx.$$ "$C/subdir-path/sub/m.toml"; (cd "$C/subdir-path/sub" && amend . 1 "$MSHA"); printf 'sub/m.toml\n' > "$C/subdir-path/args" |
| 107 | mk dotslash-path; cp /tmp/cx.$$ "$C/dotslash-path/m.toml"; amend "$C/dotslash-path" 1 "$MSHA"; printf './m.toml\n' > "$C/dotslash-path/args" |
| 108 | mk stem-no-toml; cp /tmp/cx.$$ "$C/stem-no-toml/m.txt"; amend "$C/stem-no-toml" 1 "$MSHA"; mv "$C/stem-no-toml/m.amendment-1.toml" "$C/stem-no-toml/m.txt.amendment-1.toml"; printf 'm.txt\n' > "$C/stem-no-toml/args" |
| 109 | mk sha-check-words; cp "$good" "$C/sha-check-words/m.toml"; echo "shawords" > "$C/sha-check-words/mode" |
| 110 | mk status-superseded; sed 's/^status = .*/status = "superseded"/' "$C/frozen-ok/m.toml" > "$C/status-superseded/m.toml" |
| 111 | mk status-bad; sed 's/^status = .*/status = "final"/' "$good" > "$C/status-bad/m.toml" |
| 112 | mk uppercase-sha; sed 's/^omega = .*/omega = "25B4A51141FA48BE01D1CDBAC8617D41065E523D"/' "$good" > "$C/uppercase-sha/m.toml" |
| 113 | mk sha-check-unset-empty; cp "$good" "$C/sha-check-unset-empty/m.toml"; echo "emptysha" > "$C/sha-check-unset-empty/mode" |
| 114 | rm -f /tmp/cx.$$ /tmp/nul.$$ |
| 115 | |
| 116 | # ---------------- pins ---------------- |
| 117 | P="$out/pins" |
| 118 | OM=1111111111111111111111111111111111111111; SC=2222222222222222222222222222222222222222 |
| 119 | AO=3333333333333333333333333333333333333333; PH=4444444444444444444444444444444444444444 |
| 120 | PR=5555555555555555555555555555555555555555; CS=6666666666666666666666666666666666666666 |
| 121 | SP=7777777777777777777777777777777777777777; AR=8888888888888888888888888888888888888888 |
| 122 | OTHER=9999999999999999999999999999999999999999 |
| 123 | serve() { mkdir -p "$(dirname "$cur/files/$1")"; cat > "$cur/files/$1"; } |
| 124 | tree() { |
| 125 | rm -rf "$cur/files" |
| 126 | echo "$OM" | serve "aien-sovereign-core/$SC/omega.lock" |
| 127 | serve "aien-sovereign-core/$SC/Cargo.lock" <<L |
| 128 | [[package]] |
| 129 | name = "aien-protocol-types" |
| 130 | source = "git+https://github.com/aien-dev/aien-protocols?rev=$PR#$PR" |
| 131 | |
| 132 | [[package]] |
| 133 | name = "aien-probe" |
| 134 | source = "git+https://github.com/aien-dev/aien-protocols?rev=$PR#$PR" |
| 135 | |
| 136 | [[package]] |
| 137 | name = "crumb-spec" |
| 138 | source = "git+https://github.com/aien-dev/crumb-spec?rev=$CS#$CS" |
| 139 | |
| 140 | [[package]] |
| 141 | name = "spark-crumbs" |
| 142 | source = "git+https://github.com/aien-dev/spark-crumbs?rev=$SP#$SP" |
| 143 | |
| 144 | [[package]] |
| 145 | name = "serde" |
| 146 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 147 | L |
| 148 | echo "$PH" | serve "omega/$OM/physics.lock" |
| 149 | echo "$AO" | serve "omega/$OM/aienos.lock" |
| 150 | printf '%s\n# argus pin, comment with no hex\n' "$AR" | serve "omega/$OM/argus.lock" |
| 151 | } |
| 152 | manifest() { |
| 153 | cat > "$1" <<M |
| 154 | schema = "CandidateManifestV1" |
| 155 | id = "CAND-T" |
| 156 | [commits] |
| 157 | omega = "$OM" |
| 158 | aienos = "$AO" |
| 159 | aien-sovereign-core = "$SC" |
| 160 | aien-protocols = "$PR" |
| 161 | physics = "$PH" |
| 162 | [contracts] |
| 163 | crumb-spec = "$CS" |
| 164 | spark-crumbs = "$SP" |
| 165 | [consumed_pins] |
| 166 | sovereign-core-omega-lock = "$OM" |
| 167 | sovereign-core-cargo-lock-aien-protocols = "$PR" |
| 168 | omega-physics-lock = "$PH" |
| 169 | omega-aienos-lock = "$AO" |
| 170 | omega-argus-lock = "$AR" |
| 171 | something-else = "not read" |
| 172 | M |
| 173 | } |
| 174 | pk() { cur="$P/$1"; mkdir -p "$cur"; echo files > "$cur/mode"; tree; manifest "$cur/m.toml"; } |
| 175 | pk agree |
| 176 | pk contract-other; sed -i "s/^crumb-spec = .*/crumb-spec = \"$OTHER\"/" "$cur/m.toml" |
| 177 | pk protocols-other; sed -i "s/^aien-protocols = .*/aien-protocols = \"$OTHER\"/" "$cur/m.toml" |
| 178 | pk aienos-other; sed -i "s/^aienos = .*/aienos = \"$OTHER\"/" "$cur/m.toml" |
| 179 | pk physics-other; sed -i "s/^physics = .*/physics = \"$OTHER\"/" "$cur/m.toml" |
| 180 | pk consumed-other; sed -i "s/^omega-argus-lock = .*/omega-argus-lock = \"$OTHER\"/" "$cur/m.toml" |
| 181 | pk physics-unpinned; sed -i '/^physics = /d;/^omega-physics-lock/d' "$cur/m.toml" |
| 182 | pk contract-missing; sed -i '/^spark-crumbs = /d' "$cur/m.toml" |
| 183 | pk omega-lock-elsewhere; echo "$OTHER" | serve "aien-sovereign-core/$SC/omega.lock" |
| 184 | pk cargo-unreadable; rm "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 185 | pk aienos-unreadable; rm "$cur/files/omega/$OM/aienos.lock" |
| 186 | pk two-revisions; printf '\n[[package]]\nname = "crumb-spec-extra"\nsource = "git+https://github.com/aien-dev/crumb-spec?rev=%s#%s"\n' "$OTHER" "$OTHER" >> "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 187 | pk fork-name; sed -i "s/crumb-spec?rev=$CS#$CS/crumb-spec-fork?rev=$CS#$CS/" "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 188 | pk error-body-ref; rm "$cur/files/omega/$OM/argus.lock"; sed -i "s/^omega-argus-lock = .*/omega-argus-lock = \"$OM\"/" "$cur/m.toml" |
| 189 | pk leading-comment; printf '# pinned after %s\n%s\n' "$OTHER" "$AO" | serve "omega/$OM/aienos.lock" |
| 190 | pk trailing-words; printf '%s %s\n' "$AO" "trailing words" | serve "omega/$OM/aienos.lock" |
| 191 | pk no-sovereign; sed -i '/^aien-sovereign-core = /d' "$cur/m.toml" |
| 192 | pk no-omega; sed -i '/^omega = /d' "$cur/m.toml" |
| 193 | # adversarial |
| 194 | pk three-revisions; printf '\n[[package]]\nname = "x"\nsource = "git+https://github.com/aien-dev/crumb-spec.git#%s"\n[[package]]\nname = "y"\nsource = "git+https://github.com/aien-dev/crumb-spec?branch=main#%s"\n' "$OTHER" "$OM" >> "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 195 | pk omega-lock-empty; : > "$cur/files/aien-sovereign-core/$SC/omega.lock" |
| 196 | pk omega-lock-comments-only; printf '# c\n\n # d\n' > "$cur/files/aien-sovereign-core/$SC/omega.lock" |
| 197 | pk lock-crlf; printf '%s\r\n' "$OM" > "$cur/files/aien-sovereign-core/$SC/omega.lock"; printf ' %s \n' "$AO" > "$cur/files/omega/$OM/aienos.lock" |
| 198 | pk lock-no-newline; printf '%s' "$PH" > "$cur/files/omega/$OM/physics.lock" |
| 199 | pk lock-uppercase; printf '%s\n' "$(echo $PH | tr a-f A-F)" > "$cur/files/omega/$OM/physics.lock"; sed -i "s/^physics = .*/physics = \"AAAA\"/" "$cur/m.toml" |
| 200 | pk cargo-empty; : > "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 201 | pk cargo-crlf; sed -i 's/$/\r/' "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 202 | pk cargo-two-on-line; printf '\n[[package]]\nname = "x"\nsource = "git+https://github.com/aien-dev/spark-crumbs?rev=%s#%s" # %s"\n' "$SP" "$SP" "$OTHER" >> "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 203 | pk manifest-crlf; sed -i 's/$/\r/' "$cur/m.toml" |
| 204 | pk dup-consumed; printf 'omega-argus-lock = "%s"\n' "$OTHER" >> "$cur/m.toml" |
| 205 | pk many-consumed; for i in $(seq 1 30); do printf 'extra-%02d = "x"\n' $i >> "$cur/m.toml"; done; printf 'sovereign-core-omega-lock = "%s"\n' "$OTHER" >> "$cur/m.toml" |
| 206 | pk all-unreadable; rm -rf "$cur/files" |
| 207 | pk wrong-type; sed -i 's/^aienos = .*/aienos = 3/' "$cur/m.toml" |
| 208 | pk extra-section; printf '[extra]\nfoo = "bar"\n[consumed_pins.sub]\nomega-argus-lock = "x"\n' >> "$cur/m.toml" |
| 209 | pk no-arg; : > "$cur/args" |
| 210 | pk missing-file; printf 'nope.toml\n' > "$cur/args" |
| 211 | pk physics-pinned-unreadable; rm "$cur/files/omega/$OM/physics.lock" |
| 212 | pk consumed-empty-value; sed -i 's/^omega-argus-lock = .*/omega-argus-lock = ""/' "$cur/m.toml" |
| 213 | pk lock-leading-blank; printf '\n\n %s \n' "$OM" > "$cur/files/aien-sovereign-core/$SC/omega.lock" |
| 214 | pk lock-ws-only; printf ' \n\t\n' > "$cur/files/aien-sovereign-core/$SC/omega.lock" |
| 215 | pk lock-nul; printf '%s\0\n' "$OM" > "$cur/files/aien-sovereign-core/$SC/omega.lock"; echo "bash prints 'warning: command substitution: ignored null byte in input' on stderr when a fetched file holds a NUL byte; the .om drops the byte silently" > "$cur/limit" |
| 216 | pk cargo-big; for i in $(seq 1 800); do printf '[[package]]\nname = "pad-%d"\nsource = "registry+https://github.com/rust-lang/crates.io-index"\n\n' $i; done >> "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 217 | pk cargo-dotgit-and-hash; sed -i "s|aien-protocols?rev=$PR#$PR|aien-protocols.git#$PR|" "$cur/files/aien-sovereign-core/$SC/Cargo.lock" |
| 218 | pk file-at-words; echo fileswords > "$cur/mode" |
| 219 | # ---------------- extension cases (after the bash: -mv sources, in-tree contracts; DRA-46) ---------------- |
| 220 | # The bash oracle never read aien-dev/<name>-mv sources or in-tree contracts, so these cases have no frozen |
| 221 | # output: their expected files are recorded with run.sh ... record-extensions and reviewed by hand (README |
| 222 | # "Extension cases"). The `extension` file says what each one pins. |
| 223 | px() { pk "$1"; printf '%s\n' "$2" > "$cur/extension"; } |
| 224 | lockf() { printf '%s' "$cur/files/aien-sovereign-core/$SC/Cargo.lock"; } |
| 225 | intree() { # the spark-crumbs package becomes a path package (no source line); the manifest states it |
| 226 | sed -i "/spark-crumbs?rev=$SP#$SP/d" "$(lockf)"; sed -i 's/^spark-crumbs = .*/&\nspark-crumbs-consumed = "in-tree"/' "$cur/m.toml"; } |
| 227 | px mv-agree "every Cargo.lock pin consumed under its -mv name (aien-protocols-mv, crumb-spec-mv, spark-crumbs-mv.git) agrees" |
| 228 | sed -i -e 's|aien-dev/aien-protocols?|aien-dev/aien-protocols-mv?|' -e 's|aien-dev/crumb-spec?|aien-dev/crumb-spec-mv?|' -e 's|aien-dev/spark-crumbs?|aien-dev/spark-crumbs-mv.git?|' "$(lockf)" |
| 229 | px mv-other "aien-protocols-mv at a revision the manifest does not pin is refused" |
| 230 | sed -i "s|aien-protocols?rev=$PR#$PR|aien-protocols-mv?rev=$OTHER#$OTHER|" "$(lockf)" |
| 231 | px mv-two-names "the old and the -mv name at two revisions are one pin with several revisions: refused" |
| 232 | printf '\n[[package]]\nname = "aien-provenance"\nsource = "git+https://github.com/aien-dev/aien-protocols-mv?rev=%s#%s"\n' "$OTHER" "$OTHER" >> "$(lockf)" |
| 233 | px mv-two-names-same "the old and the -mv name at the same revision are one revision: agrees" |
| 234 | printf '\n[[package]]\nname = "aien-provenance"\nsource = "git+https://github.com/aien-dev/aien-protocols-mv?rev=%s#%s"\n' "$PR" "$PR" >> "$(lockf)" |
| 235 | px mv-prefix "a repo named <name>-mvx is neither the repo nor its -mv name: no revision" |
| 236 | sed -i 's|aien-dev/crumb-spec?|aien-dev/crumb-spec-mvx?|' "$(lockf)" |
| 237 | px intree-agree "contracts.spark-crumbs-consumed = \"in-tree\" with a path package spark-crumbs and no git source agrees" |
| 238 | intree |
| 239 | px intree-eof "the in-tree path package is the last block of Cargo.lock (closed by the end of the file)" |
| 240 | intree; head -n -4 "$(lockf)" > "$cur/l.tmp"; mv "$cur/l.tmp" "$(lockf)" |
| 241 | px intree-crlf "the in-tree check on a CRLF Cargo.lock" |
| 242 | intree; sed -i 's/$/\r/' "$(lockf)" |
| 243 | px intree-crumb-spec "both contracts stated in-tree, each with its path package" |
| 244 | intree; sed -i "/crumb-spec?rev=$CS#$CS/d" "$(lockf)"; sed -i 's/^crumb-spec = .*/&\ncrumb-spec-consumed = "in-tree"/' "$cur/m.toml" |
| 245 | px intree-undeclared "a path package spark-crumbs the manifest does not state as in-tree: refused, naming the in-tree key" |
| 246 | sed -i "/spark-crumbs?rev=$SP#$SP/d" "$(lockf)" |
| 247 | px intree-git-source "in-tree stated, but Cargo.lock also has a git source for spark-crumbs: refused" |
| 248 | intree; printf '\n[[package]]\nname = "spark-crumbs"\nversion = "0.0.9"\nsource = "git+https://github.com/aien-dev/spark-crumbs?rev=%s#%s"\n' "$OTHER" "$OTHER" >> "$(lockf)" |
| 249 | px intree-mv-git-source "in-tree stated, but Cargo.lock has a git source under the -mv name: refused" |
| 250 | intree; printf '\n[[package]]\nname = "spark-crumbs-mv-copy"\nsource = "git+https://github.com/aien-dev/spark-crumbs-mv?rev=%s#%s"\n' "$SP" "$SP" >> "$(lockf)" |
| 251 | px intree-no-package "in-tree stated, but no package of that name (only spark-crumbs-extra): refused" |
| 252 | intree; sed -i 's/^name = "spark-crumbs"$/name = "spark-crumbs-extra"/' "$(lockf)" |
| 253 | px intree-registry "in-tree stated, but the package of that name has a (registry) source line: refused" |
| 254 | sed -i "s|^source = \"git+https://github.com/aien-dev/spark-crumbs?rev=$SP#$SP\"|source = \"registry+https://github.com/rust-lang/crates.io-index\"|" "$(lockf)"; sed -i 's/^spark-crumbs = .*/&\nspark-crumbs-consumed = "in-tree"/' "$cur/m.toml" |
| 255 | px intree-word "a -consumed value other than \"in-tree\" is refused" |
| 256 | intree; sed -i 's/^spark-crumbs-consumed = .*/spark-crumbs-consumed = "intree"/' "$cur/m.toml" |
| 257 | px intree-empty-value "an empty -consumed value is refused, not read as unset" |
| 258 | intree; sed -i 's/^spark-crumbs-consumed = .*/spark-crumbs-consumed = ""/' "$cur/m.toml" |
| 259 | px intree-protocols-key "there is no in-tree form for [commits] aien-protocols: a commits.aien-protocols-consumed key is ignored" |
| 260 | sed -i "/aien-protocols?rev=$PR#$PR/d" "$(lockf)"; sed -i 's/^aien-protocols = .*/&\naien-protocols-consumed = "in-tree"/' "$cur/m.toml" |
| 261 | # The live CAND-5 manifest with the lock files of its pinned commits (scripts/testdata/cand5-locks: sovereign-core |
| 262 | # dffdbd19 omega.lock and Cargo.lock, omega f9a9a40 aienos.lock, physics.lock, argus.lock, byte copies of those |
| 263 | # git blobs). It names exactly one difference, spark-crumbs; the -intree copy adds the key a later manifest states. |
| 264 | c5="$repo/qualification/candidates/CAND-5.toml" |
| 265 | c5files() { # one copy of the real lock files: the case's files/ is a relative symlink to scripts/testdata/cand5-locks |
| 266 | ln -s "$(realpath --relative-to="$cur" "$repo/scripts/testdata/cand5-locks")" "$cur/files"; } |
| 267 | px live-cand5 "the frozen CAND-5 manifest and its real lock files: only spark-crumbs differs (built in-tree; CAND-5 cannot state it)" |
| 268 | synth "$c5" > "$cur/m.toml"; rm -r "$cur/files"; c5files |
| 269 | px live-cand5-intree "CAND-5 plus contracts.spark-crumbs-consumed = \"in-tree\" (the form for later candidates) and its real lock files: agrees" |
| 270 | synth "$c5" | sed 's/^spark-crumbs = .*/&\nspark-crumbs-consumed = "in-tree"/' > "$cur/m.toml"; rm -r "$cur/files"; c5files |
| 271 | echo "cases: $(ls "$C" | wc -l) candidate, $(ls "$P" | wc -l) pins" |