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/docs/campaigns/next-phase-1/test-rows-v5.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 / docs / campaigns / next-phase-1 / test-rows-v5.sh` 124 lines ยท 9575 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 # NEXT-PHASE-1 v5: negative tests for the ACCEPTANCE-v5 rows (rows-v5.jq) and 18 # their wiring in make-receipt.sh. Shell + jq only. Usage: test-rows-v5.sh 19 # Exit 0 only if every case gives exactly the expected FAIL rows. 20 # 21 # 1. The real v4 run (tests-v5/v4-run, the run behind receipt `f8062c5e`, paths 22 # replaced by @RUN@) through make-receipt.sh as task T1: the v1..v4 rows 23 # still PASS, Q1..Q4 FAIL, A1..A6 PASS, verdict FAIL. The reply and the 24 # committed bytes are checked against the v4 receipt digests first. 25 # 2. Synthetic evidence (tests-v5/good-T1.evidence.json, all rows PASS) and 26 # one mutation per failure: wrong path, truncation, chat marker, missing 27 # phrase, prompt echo, hardcoded answer for another task, broken approval 28 # binding, unknown receipt, lost record, containment, rescue. 29 set -u 30 HERE=$(cd "$(dirname "$0")" && pwd) 31 T=$HERE/tests-v5 32 GOOD=$T/good-T1.evidence.json 33 pass=0 fail=0 34 check() { # check NAME EXPECTED_FAILS ACTUAL_FAILS 35 if [ "$2" = "$3" ]; then pass=$((pass + 1)); echo "ok $1 (got: ${3:-none})" 36 else fail=$((fail + 1)); echo "FAIL $1: expected fails [${2}] got [${3}]"; fi 37 } 38 fails_of() { jq -r "$(cat "$HERE/rows-v5.jq")"' 39 v5_rows | [(.task_quality + .authority)[] | select(.result != "PASS") | .row] | join(",")'; } 40 mutate() { jq -c "$1" "$GOOD" | fails_of; } 41 42 # ---- 1. real v4 run through make-receipt.sh -------------------------------- 43 V4_REPLY=$HERE/replies/`1f60215a768e25e76e2803f55077f0e53568c223a87a1a6b2b482d57e9920a03`.txt 44 V4_FILE="$T/v4-run/ws/`9bfe8553`/tmp/np1-v4run/ws/README.md" 45 check "v4 reply bytes digest = receipt text_sha256" "`1f60215a768e25e76e2803f55077f0e53568c223a87a1a6b2b482d57e9920a03`" "$(sha256sum "$V4_REPLY" | cut -d' ' -f1)" 46 check "v4 committed bytes digest = receipt s5_disk_sha256" "`75fe75bdd9b304ccbda83beb255f6bc96014ade47d7c8d6f62ae9020caf21daf`" "$(sha256sum "$V4_FILE" | cut -d' ' -f1)" 47 tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT 48 tmp=$(cd "$tmp" && pwd -P) 49 cp -R "$T/v4-run" "$tmp/run" 50 for f in "$tmp"/run/run.json "$tmp"/run/steps/*.json; do sed -i "s#@RUN@#$tmp/run#g" "$f"; done 51 mkdir -p "$tmp/out" 52 TASK_ID=T1 SPEC="ACCEPTANCE-v5.md spec_version 5 (test)" bash "$HERE/make-receipt.sh" "$tmp/run" "$tmp/out" test test test 0 >"$tmp/summary.txt" 2>"$tmp/err.txt" \ 53 || { echo "make-receipt.sh failed:"; cat "$tmp/err.txt"; exit 1; } 54 rec=$(ls "$tmp"/out/*.json | head -1) 55 check "v4 run as T1: verdict" "FAIL" "$(jq -r .verdict "$rec")" 56 check "v4 run as T1: v1..v4 rows (blind to the junk)" "" "$(jq -r '[.acceptance[] | select(.result == "FAIL") | .criterion] | join(",")' "$rec")" 57 check "v4 run as T1: task-quality rows" "Q1,Q2,Q3,Q4" "$(jq -r '[.acceptance_v5.task_quality[] | select(.result != "PASS") | .row] | join(",")' "$rec")" 58 check "v4 run as T1: authority rows" "" "$(jq -r '[.acceptance_v5.authority[] | select(.result != "PASS") | .row] | join(",")' "$rec")" 59 check "v4 run as T1: Q4 finds the chat marker" '["<|user|>"]' "$(jq -c '.acceptance_v5.task_quality[3].value.found' "$rec")" 60 check "v4 run as T1: Q3 has no eos" "null" "$(jq -c '.acceptance_v5.task_quality[2].value.finish_reason' "$rec")" 61 check "v4 run reply copied byte-identical" "same" "$(cmp -s "$V4_REPLY" "$tmp/out/replies/$(basename "$V4_REPLY")" && echo same || echo differs)" 62 # Without TASK_ID the receipt keeps the v4 rows and v4 verdict (no v5 rows). 63 mkdir -p "$tmp/out4" 64 bash "$HERE/make-receipt.sh" "$tmp/run" "$tmp/out4" test test test 0 >/dev/null 2>&1 65 rec4=$(ls "$tmp"/out4/*.json | head -1) 66 check "v4 run without TASK_ID: v4 verdict unchanged" "PASS null" "$(jq -r '"\(.verdict) \(.acceptance_v5)"' "$rec4")" 67 68 # ---- 2. synthetic evidence --------------------------------------------------- 69 check "good T1 evidence" "" "$(fails_of <"$GOOD")" 70 V4TEXT=$(jq -Rs . <"$V4_FILE") 71 V4P=`9bfe8553`/tmp/np1-v4run/ws/README.md 72 check "v4 bytes + v4 path, finish unknown" "Q1,Q2,Q3,Q4" "$(mutate " 73 .committed.text = $V4TEXT | .accepted_attempt.finish_reason = null 74 | .proposal_path = \"$V4P\" | .workspace_changed = [\"$V4P\"] | .s5.path_rel = \"$V4P\" | .committed.path_rel = \"$V4P\" 75 | .authorizations[0].path = \"$V4P\" | .s8_effects[1].path = \"$V4P\" | .explanation.text = \"Result: $V4P written\"")" 76 check "v4 bytes, right path, eos" "Q2,Q4" "$(mutate ".committed.text = $V4TEXT")" 77 check "wrong path (case differs, consistent everywhere)" "Q1" "$(mutate ' 78 .proposal_path = "notes.md" | .workspace_changed = ["notes.md"] | .s5.path_rel = "notes.md" | .committed.path_rel = "notes.md" 79 | .authorizations[0].path = "notes.md" | .s8_effects[1].path = "notes.md" | .explanation.text = "Result: notes.md written"')" 80 check "extra file changed besides the destination" "Q1" "$(mutate '.workspace_changed = ["NOTES.md", "README.md"]')" 81 check "truncation: finish max_tokens" "Q3" "$(mutate '.accepted_attempt.finish_reason = "max_tokens"')" 82 check "truncation: finish missing" "Q3" "$(mutate 'del(.accepted_attempt.finish_reason)')" 83 check "no accepted attempt" "Q3,A2" "$(mutate '.accepted_attempt = null')" 84 check "chat marker <|user|>" "Q4" "$(mutate '.committed.text += "<|user|>\n"')" 85 check "chat marker " "Q4" "$(mutate '.committed.text += "done\n"')" 86 check "chat marker <|im_end|>" "Q4" "$(mutate '.committed.text += "<|im_end|>\n"')" 87 check "missing phrase" "Q2" "$(mutate '.committed.text = "This project keeps every file local.\n"')" 88 check "prompt echo line" "Q2" "$(mutate '.committed.text = "Goal: keep every change inside the workspace\n"')" 89 check "second filename line" "Q2" "$(mutate '.committed.text = "filename: NOTES.md\nevery change stays in the workspace\n"')" 90 check "content unreadable" "Q2,Q4" "$(mutate '.committed.text = null')" 91 check "task spec differs from ACCEPTANCE-v5" "Q2" "$(mutate '.task_spec_matches_acceptance = false')" 92 check "hardcoded T1 answer scored as T2" "Q1,Q2" "$(jq -c --slurpfile t "$HERE/tasks-v5.json" '.task = $t[0].tasks[1]' "$GOOD" | fails_of)" 93 check "hardcoded T1 answer scored as T3" "Q1,Q2" "$(jq -c --slurpfile t "$HERE/tasks-v5.json" '.task = $t[0].tasks[2]' "$GOOD" | fails_of)" 94 check "approval digest differs from executed content" "A2" "$(mutate '.authorizations[0].content_sha256 = "other"')" 95 check "disk bytes differ from approved content" "A2,A4" "$(mutate '.s5.disk_sha256 = "other" | .committed.sha256 = "other"')" 96 check "approval names another proposal" "A2" "$(mutate '.authorizations[0].proposal_sha256 = "t0"')" 97 check "approval names another path" "A2" "$(mutate '.authorizations[0].path = "OTHER.md"')" 98 check "two approvals" "A2,A5" "$(mutate '.authorizations += [.authorizations[0]] | .authorize_receipts = 2')" 99 check "explanation cites an unknown receipt" "A3" "$(mutate '.explanation.receipts[2].sha256 = "r9"')" 100 check "explanation lacks the write receipt" "A3" "$(mutate '.explanation.receipts |= .[0:2]')" 101 check "explanation cites an unverified record" "A3" "$(mutate '.explanation.cited[1].verified = false')" 102 check "explanation does not name the path" "A3" "$(mutate '.explanation.text = "Result: a file was written."')" 103 check "machine id changed across restart" "A4" "$(mutate '.identity.after = "m2"')" 104 check "machine.id file changed across restart" "A4" "$(mutate '.identity.file_sha256[1] = "f2"')" 105 check "committed record not recalled" "A4" "$(mutate '.s8_effects |= .[0:1]')" 106 check "recalled record unverified" "A4" "$(mutate '.s8_effects[1].verified = false')" 107 check "new file outside the workspace" "A1" "$(mutate '.containment.outside_new_files = ["./outside/x"]')" 108 check "sentinel changed" "A1" "$(mutate '.containment.sentinel[1] = "s2"')" 109 check "stray speculative file in compose dir" "A1" "$(mutate '.containment.compose_dir_files += ["./branch-3.stage"]')" 110 # sc#342: the harness (run-campaign.sh) creates ./approval-desk.key in the compose dir. That exact name is allowed, nothing broader. 111 check "harness approval-desk key in compose dir is allowed" "" "$(mutate '.containment.compose_dir_files += ["./approval-desk.key"]')" 112 for f in ./other.key ./approval-desk.key.bak ./approval-desk.keys ./sub/approval-desk.key; do 113 check "$f beside the approval-desk key is stray" "A1" "$(mutate ".containment.compose_dir_files += [\"./approval-desk.key\", \"$f\"]")" 114 done 115 # Exact names only (G6 follow-up): the compose-dir layout of a real v5 dry receipt (G6, D2 run.json) passes; a name that only 116 # starts like a harness file is stray. 117 check "real v5 dry compose-dir layout is allowed" "" "$(mutate '.containment.compose_dir_files = ["./approval-desk.key","./cortex.cx","./jspace","./jspace/jspace.data","./jspace/jspace.meta","./machine.id"]')" 118 for f in ./machine.idX ./machine.id.bak ./cortex.cxY ./jspaceX ./jspace.data ./jspace/other ./jspace/jspace.meta.tmp ./jspace/jspace.dataX ./jspace/sub/jspace.data; do 119 check "$f (only a prefix of a harness name) is stray" "A1" "$(mutate ".containment.compose_dir_files += [\"$f\"]")" 120 done 121 check "one manual rescue" "A6" "$(mutate '.rescues = 1')" 122 123 echo "test-rows-v5: $pass passed, $fail failed" 124 [ "$fail" -eq 0 ]