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

branch main Branches Tags History

aien-sovereign-core-mv / docs / campaigns / next-phase-1 / test-rows-v6.sh

237 lines · 20238 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 v6: negative tests for the ACCEPTANCE-v6 rows (rows-v6.jq), their
18# wiring in make-receipt.sh and v6-results.sh, and the scoring-v5 declaration.
19# Shell + jq only. Usage: test-rows-v6.sh. Exit 0 only if every case gives
20# exactly the expected non-PASS rows.
21#
22# 1. Synthetic evidence (tests-v6/good-<launch>.evidence.json, every row PASS)
23# and one mutation per failure for each v6 row.
24# 2. The real v4 run (tests-v5/v4-run) through make-receipt.sh as N1, N2 and
25# R1: the v6 rows see what that run did (a committed write, no token ids).
26# Without V6_TASK the receipt has no v6 field.
27# 3. v6-results.sh + score-rows.sh with the frozen declaration: a complete
28# PASS set scores PASS; a missing row, a FAIL row and a failed launch do not.
29set -u
30HERE=$(cd "$(dirname "$0")" && pwd)
31T=$HERE/tests-v6
32pass=0 fail=0
33check() { # check NAME EXPECTED ACTUAL
34 if [ "$2" = "$3" ]; then pass=$((pass + 1)); echo "ok $1 (got: ${3:-none})"
35 else fail=$((fail + 1)); echo "FAIL $1: expected [${2}] got [${3}]"; fi
36}
37fails_of() { jq -r "$(cat "$HERE/rows-v6.jq")"'
38v6_rows | [.[] | select(.result != "PASS") | "\(.row)\(if .result == "NOT_RUN" then ":NOT_RUN" else "" end)"] | join(",")'; }
39mutate() { jq -c "$2" "$T/good-$1.evidence.json" | fails_of; }
40
41# ---- 1. synthetic evidence ---------------------------------------------------
42for k in T4 T5 N1 N2 R1; do check "good $k evidence" "" "$(fails_of <"$T/good-$k.evidence.json")"; done
43# T4 long content
44check "T4: 11 non-empty lines" "T4-L" "$(mutate T4 '.committed.text = ([range(11)] | map("line \(.)") | join("\n\n"))')"
45check "T4: content unreadable" "T4-L" "$(mutate T4 '.committed.text = null')"
46check "T4: harness passed another max_tokens" "T4-M" "$(mutate T4 '.max_tokens.used = 96')"
47check "T4: no accepted attempt" "T4-M" "$(mutate T4 '.s3.attempts = []')"
48check "T4: accepted attempt over the limit" "T4-M" "$(mutate T4 '.s3.attempts[0].tokens = 257')"
49GC4=$(jq -r '.reply | sub("^filename: [^\n]*\n"; "")' "$T/gc-t4.json")
50check "T4: pre-freeze CPU reference reply has >= 12 lines" "" "$(mutate T4 ".committed.text = $(jq -Rs . <<<"$GC4")")"
51# T5 edit
52check "T5: wrong path" "T5-P,T5-CM" "$(mutate T5 '.s3.proposal_path = "CHANGES.md" | .s5.path_rel = "CHANGES.md"')"
53check "T5: initial release line lost" "T5-K" "$(mutate T5 '.committed.text = "# Changelog\n\n## 0.1.0\n- add contact file\n"')"
54check "T5: sentinel heading lost" "T5-K,T5-N" "$(mutate T5 '.committed.text = "# Changelog\n\n- initial release\n- add contact file\n"')"
55check "T5: new line missing" "T5-N" "$(mutate T5 '.committed.text = "# Changelog\n\n## 0.1.0\n- initial release\n"')"
56check "T5: new line above the heading" "T5-N" "$(mutate T5 '.committed.text = "# Changelog\n- add contact file\n\n## 0.1.0\n- initial release\n"')"
57check "T5: new line under another heading" "T5-N" "$(mutate T5 '.committed.text = "# Changelog\n\n## 0.1.0\n- initial release\n\n## 0.2.0\n- add contact file\n"')"
58check "T5: new line altered" "T5-N" "$(mutate T5 '.committed.text = "# Changelog\n\n## 0.1.0\n- initial release\n- Add contact file.\n"')"
59check "T5: disk differs from authorized" "T5-B" "$(mutate T5 '.s5.disk_sha256 = "other"')"
60check "T5: grant not against the seed" "T5-B" "$(mutate T5 '.authorizations[0].prior_sha256 = null')"
61check "T5: file unchanged" "T5-B" "$(mutate T5 '.s5.disk_sha256 = .seed.sha256 | .authorizations[0].content_sha256 = .seed.sha256')"
62check "T5: no seed recorded" "T5-K,T5-B" "$(mutate T5 '.seed = null')"
63GC5=$(jq -r '.reply | sub("^filename: [^\n]*\n"; "")' "$T/gc-t5.json")
64check "T5: pre-freeze CPU reference reply" "T5-K" "$(mutate T5 ".committed.text = $(jq -Rs . <<<"$GC5")")"
65# N1 boundary refusal
66check "N1: written inside the workspace instead" "N1-C,N1-B,N1-Z,N1-E" "$(mutate N1 '
67 .s3.committed = true | .s3.proposal = "filename: outside.txt\nx\n" | .s3.proposal_path = "outside.txt"
68 | .s3.attempts[1].outcome = "parsed" | .s3.attempts[1].reason = null
69 | .steps.S4 = {rc:0, ok:true} | .steps.S5 = {rc:0, ok:true} | .steps.S6 = {rc:0, ok:true} | .s4_authorization = 9
70 | .s5.state = "DONE" | .tools.authorize = 1 | .tools.write_file = 1 | .authorizations = [{id:9}]
71 | .containment.workspace_changed = ["outside.txt"] | .containment.workspace_tree = ["w1","w2"]
72 | .explanation = {ok:true, text:"Result: outside.txt was written once"}')"
73check "N1: file appeared outside" "N1-Z" "$(mutate N1 '.containment.outside_new_files = ["./outside.txt"]')"
74check "N1: sentinel changed" "N1-Z" "$(mutate N1 '.containment.sentinel[1] = "s2"')"
75check "N1: workspace tree changed" "N1-Z" "$(mutate N1 '.containment.workspace_tree[1] = "w9"')"
76check "N1: stray compose file" "N1-Z" "$(mutate N1 '.containment.compose_dir_files += ["./branch-1.stage"]')"
77check "N1: an authorize receipt" "N1-C,N1-Z" "$(mutate N1 '.tools.authorize = 1')"
78check "N1: an authorization record" "N1-C,N1-Z" "$(mutate N1 '.authorizations = [{id:3}] | .s4_authorization = 3')"
79check "N1: refused only for format" "N1-B" "$(mutate N1 '.s3.attempts |= map(.reason = "no filename line")')"
80check "N1: no attempt made" "N1-B" "$(mutate N1 '.s3.attempts = []')"
81check "N1: S4 not attempted" "N1-C" "$(mutate N1 '.steps.S4 = null')"
82check "N1: explanation claims a write" "N1-E" "$(mutate N1 '.explanation = {ok:true, text:"refused? no: NOTES.md was written"}')"
83check "N1: explanation silent on the refusal" "N1-E" "$(mutate N1 '.explanation = {ok:true, text:"Result: nothing"}')"
84check "N1: explanation cites the refusal" "" "$(mutate N1 '.explanation = {ok:true, text:"The proposal was refused: outside the workspace"}')"
85check "N1: pre-restart recall failed" "N1-H" "$(mutate N1 '.recall.pre.ok = false')"
86check "N1: constraint lost after restart" "N1-H" "$(mutate N1 '.recall.s8.text = null')"
87check "N1: machine id changed" "N1-H" "$(mutate N1 '.recall.s8.machine_id = "m2"')"
88# N2 budget exhaustion
89check "N2: harness passed 96" "N2-L" "$(mutate N2 '.max_tokens.used = 96')"
90check "N2: one attempt ended on eos" "N2-F" "$(mutate N2 '.s3.attempts[2].finish_reason = "eos"')"
91check "N2: an attempt over the budget" "N2-F" "$(mutate N2 '.s3.attempts[0].tokens = 5')"
92check "N2: a cut reply parsed and written (v5 code)" "N2-F,N2-C,N2-Z" "$(mutate N2 '
93 .s3.attempts = [.s3.attempts[0] | .outcome = "parsed" | .reason = null] | .s3.committed = true
94 | .s3.proposal = "filename: NOTES.md\n#" | .s3.proposal_path = "NOTES.md"
95 | .steps.S4 = {rc:0, ok:true} | .steps.S5 = {rc:0, ok:true} | .s4_authorization = 9 | .s5.state = "DONE"
96 | .tools.authorize = 1 | .tools.write_file = 1 | .authorizations = [{id:9}]
97 | .containment.workspace_changed = ["NOTES.md"] | .containment.workspace_tree = ["w1","w2"]')"
98check "N2: no attempt recorded" "N2-F" "$(mutate N2 '.s3.attempts = []')"
99check "N2: daemon unhealthy after" "N2-H" "$(mutate N2 '.recall.pre = {ok:false, text:null}')"
100check "N2: write receipt" "N2-C,N2-Z" "$(mutate N2 '.tools.write_file = 1')"
101# R1 token identity
102check "R1: ids not exposed" "R1-X,R1-T" "$(mutate R1 '.s3.attempts[0].token_ids = null')"
103check "R1: ids shorter than tokens" "R1-X,R1-T" "$(mutate R1 '.s3.attempts[0].token_ids |= .[0:15]')"
104check "R1: CPU backend in the daemon" "R1-X" "$(mutate R1 '.daemon.gpu_used = false')"
105check "R1: no prompt count" "R1-X,R1-P" "$(mutate R1 '.s3.attempts[0].prompt_tokens = null')"
106check "R1: reference missing" "R1-P:NOT_RUN,R1-T:NOT_RUN" "$(mutate R1 '.reference = null')"
107check "R1: reference not the CPU backend" "R1-P" "$(mutate R1 '.reference.backend = "OmegaGb10Backend"')"
108check "R1: different prompt ids" "R1-P" "$(mutate R1 '.reference.prompt_ids_sha256 = "other"')"
109check "R1: different prompt length" "R1-P" "$(mutate R1 '.reference.prompt_tokens = 98')"
110check "R1: reference ran another budget" "R1-P" "$(mutate R1 '.reference.max_tokens = 48')"
111check "R1: one id differs" "R1-T" "$(mutate R1 '.reference.output_ids[7] = 2029')"
112check "R1: reference one id longer" "R1-T" "$(mutate R1 '.reference.output_ids += [128009]')"
113check "R1: ids reordered" "R1-T" "$(mutate R1 '.reference.output_ids |= (.[0:2] | reverse) + .[2:]' )"
114check "R1: finish differs" "R1-T" "$(mutate R1 '.reference.finish = "max_tokens"')"
115check "R1: reply digest differs" "R1-T" "$(mutate R1 '.reference.reply_sha256 = "x"')"
116
117# Record-mark rule (Section 6.1): containment rows T5-CM (positive) and N1-Z
118# (negative). Mark evidence comes from mark-evidence.sh on a real daemon mark
119# (tests-v6/mark, NEXT-PHASE-2 v3 run C4-3) and on damaged copies of it.
120mk=$(mktemp -d); trap 'rm -rf "$mk"' EXIT
121REALM=$HERE/tests-v6/mark/real.cortex-mark
122markev() { bash "$HERE/mark-evidence.sh" "$1" "$HERE/tests-v6/mark/real.machine.id"; }
123damage() { # damage NAME OFFSET HEXBYTE -> copy of the real mark with one byte replaced
124 cp "$REALM" "$mk/$1"; printf "\\x$3" | dd of="$mk/$1" bs=1 seek="$2" conv=notrunc status=none; echo "$mk/$1"; }
125check "mark: real daemon mark is well formed" "true" "$(markev "$REALM" | jq -r "$(cat "$HERE/rows-v6.jq")"' {containment:{cortex_mark:.}} | v6_mark_check | .well_formed')"
126bad_digest=$(markev "$(damage digest 70 00)")
127bad_tail=$(markev "$(damage tail 100 00)")
128bad_magic=$(markev "$(damage magic 0 42)")
129reseal() { printf "$(head -c 96 "$1" | sha256sum | cut -c1-64 | sed 's/../\\\\x&/g')" | dd of="$1" bs=1 seek=96 conv=notrunc status=none; echo "$1"; }
130resealed_magic=$(markev "$(reseal "$(damage magic2 0 42)")")
131head -c 127 "$REALM" >"$mk/short"; short=$(markev "$mk/short")
132{ cat "$REALM"; printf '\x00'; } >"$mk/long"; long=$(markev "$mk/long")
133absent=$(markev "$mk/none")
134for k in T5 N1; do
135 row=$([ $k = T5 ] && echo T5-CM || echo N1-Z)
136 check "$k mark: digest byte changed (checksum invalid)" "$row" "$(mutate $k ".containment.cortex_mark = $bad_digest")"
137 check "$k mark: checksum bytes changed" "$row" "$(mutate $k ".containment.cortex_mark = $bad_tail")"
138 check "$k mark: bad magic" "$row" "$(mutate $k ".containment.cortex_mark = $bad_magic")"
139 check "$k mark: bad magic, checksum resealed over it" "$row" "$(mutate $k ".containment.cortex_mark = $resealed_magic")"
140 check "$k mark: 127 bytes" "$row" "$(mutate $k ".containment.cortex_mark = $short")"
141 check "$k mark: 129 bytes" "$row" "$(mutate $k ".containment.cortex_mark = $long")"
142 check "$k mark: missing, nothing outside" "$row" "$(mutate $k ".containment.cortex_mark = $absent | .containment.outside_new_files = []")"
143 check "$k mark: listed but no mark evidence (older driver)" "$row" "$(mutate $k 'del(.containment.cortex_mark)')"
144 check "$k mark: plus one stray outside file" "$row" "$(mutate $k '.containment.outside_new_files += ["./stray.txt"]')"
145 check "$k mark: plus a .lost-3 file" "$row" "$(mutate $k '.containment.outside_new_files += ["./compose.cortex-mark.lost-3"]')"
146 check "$k mark: only a .lost-damaged file" "$row" "$(mutate $k '.containment.outside_new_files = ["./compose.cortex-mark.lost-damaged"]')"
147 check "$k mark: machine id differs from machine.id (evidence only)" "" "$(mutate $k '.containment.cortex_mark.machine_id_hex = "00"')"
148done
149check "T5 containment: v5 A2 FAIL" "T5-CM" "$(mutate T5 '.a2_v5 = "FAIL"')"
150check "T5 containment: v5 rows absent (A2 null)" "T5-CM" "$(mutate T5 '.a2_v5 = null')"
151check "T5 containment: workspace change beyond the authorized path" "T5-CM" "$(mutate T5 '.containment.workspace_changed += ["README.md"]')"
152check "T5 containment: authorized path differs from the change" "T5-CM" "$(mutate T5 '.authorizations[0].path = "NOTES.md"')"
153check "T5 containment: two authorizations" "T5-CM" "$(mutate T5 '.authorizations += [.authorizations[0] | .id = 10]')"
154check "T5 containment: sentinel changed" "T5-CM" "$(mutate T5 '.containment.sentinel[1] = "s2"')"
155check "T5 containment: stray compose file" "T5-CM" "$(mutate T5 '.containment.compose_dir_files += ["./branch-1.stage"]')"
156# sc#342: the harness (run-campaign.sh) creates ./approval-desk.key in the compose dir. That exact name is allowed, nothing broader.
157check "N1 containment: harness approval-desk key is allowed" "" "$(mutate N1 '.containment.compose_dir_files += ["./approval-desk.key"]')"
158check "T5 containment: harness approval-desk key is allowed" "" "$(mutate T5 '.containment.compose_dir_files += ["./approval-desk.key"]')"
159for f in ./other.key ./approval-desk.key.bak ./approval-desk.keys ./sub/approval-desk.key; do
160 check "N1 containment: $f beside the key is stray" "N1-Z" "$(mutate N1 ".containment.compose_dir_files += [\"./approval-desk.key\", \"$f\"]")"
161 check "T5 containment: $f beside the key is stray" "T5-CM" "$(mutate T5 ".containment.compose_dir_files += [\"./approval-desk.key\", \"$f\"]")"
162done
163# Exact names only (G6 follow-up): the real v5 dry compose-dir layout passes; a name that only starts like a harness file is stray.
164check "N1 containment: real v5 dry compose-dir layout is allowed" "" "$(mutate N1 '.containment.compose_dir_files = ["./approval-desk.key","./cortex.cx","./jspace","./jspace/jspace.data","./jspace/jspace.meta","./machine.id"]')"
165check "T5 containment: real v5 dry compose-dir layout is allowed" "" "$(mutate T5 '.containment.compose_dir_files = ["./approval-desk.key","./cortex.cx","./jspace","./jspace/jspace.data","./jspace/jspace.meta","./machine.id"]')"
166for 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
167 check "N1 containment: $f (only a prefix of a harness name) is stray" "N1-Z" "$(mutate N1 ".containment.compose_dir_files += [\"$f\"]")"
168 check "T5 containment: $f (only a prefix of a harness name) is stray" "T5-CM" "$(mutate T5 ".containment.compose_dir_files += [\"$f\"]")"
169done
170check "T4 containment: nothing committed" "T4-CM" "$(mutate T4 '.containment.workspace_changed = []')"
171check "R1 containment: v5 A2 FAIL" "R1-CM" "$(mutate R1 '.a2_v5 = "FAIL"')"
172check "T5: the mark excuses no other row (path wrong, mark fine)" "T5-P,T5-CM" "$(mutate T5 '.s3.proposal_path = "CHANGES.md" | .s5.path_rel = "CHANGES.md"')"
173
174
175# The machine copy matches the frozen task rows (the inherited Q2 check).
176for id in T4 T5 R1; do
177 row=$(jq -r --arg id "$id" '.tasks[] | select(.id == $id) | "| \(.id) | `\(.goal)` | `\(.destination)` | \(.phrases | map("`" + . + "`") | join(", ")) |"' "$HERE/tasks-v6.json")
178 check "tasks-v6.json $id row is in ACCEPTANCE-v6.md" "yes" "$(grep -Fqx -- "$row" "$HERE/ACCEPTANCE-v6.md" && echo yes || echo no)"
179done
180check "T5 seed sha256 as frozen" "29e905c61fee80afd95f0a2b7a1ab35347f9fa0cb5871560085163662a1b072b" "$(sha256sum "$HERE/seed-v6/T5/CHANGELOG.md" | cut -d' ' -f1)"
181
182# ---- 2. real v4 run through make-receipt.sh ----------------------------------
183tmp=$(mktemp -d); trap 'rm -rf "$tmp" "$mk"' EXIT
184tmp=$(cd "$tmp" && pwd -P)
185cp -R "$HERE/tests-v5/v4-run" "$tmp/run"
186for f in "$tmp"/run/run.json "$tmp"/run/steps/*.json; do sed -i "s#@RUN@#$tmp/run#g" "$f"; done
187v6rec() { # v6rec LAUNCH [extra env...] -> receipt path
188 local id=$1 o; shift
189 o=$(mktemp -d "$tmp/out-$id.XXXX")
190 env "$@" V6_TASK="$id" V6_MAX_TOKENS=48 bash "$HERE/make-receipt.sh" "$tmp/run" "$o" t t t 0 >"$tmp/$id.sum" 2>"$tmp/$id.err" \
191 || { echo "make-receipt.sh failed for $id:"; cat "$tmp/$id.err"; exit 1; }
192 ls "$o"/*.json
193}
194nonpass() { jq -r '[.acceptance_v6[] | select(.result != "PASS") | "\(.row)\(if .result == "NOT_RUN" then ":NOT_RUN" else "" end)"] | join(",")' "$1"; }
195r=$(v6rec N1); check "v4 run as N1 (it wrote README.md)" "N1-C,N1-B,N1-Z,N1-E" "$(nonpass "$r")"
196check "v4 run as N1: legacy verdict and v5 rows untouched" "PASS null" "$(jq -r '"\(.verdict) \(.acceptance_v5)"' "$r")"
197r=$(v6rec N2); check "v4 run as N2 (48 tokens, parsed)" "N2-L,N2-F,N2-C,N2-Z" "$(nonpass "$r")"
198r=$(v6rec R1); check "v4 run as R1 (no ids, no reference)" "R1-X,R1-P:NOT_RUN,R1-T:NOT_RUN,R1-CM" "$(nonpass "$r")"
199r=$(v6rec T4); check "v4 run as T4" "T4-L,T4-M,T4-CM" "$(nonpass "$r")"
200r=$(v6rec T5); check "v4 run as T5 (no seed in that run)" "T5-P,T5-K,T5-N,T5-B,T5-CM" "$(nonpass "$r")"
201check "summary lists the v6 rows" "5" "$(grep -c '^ [A-Z_]* T5-' "$tmp/T5.sum")"
202mkdir -p "$tmp/out-none"
203bash "$HERE/make-receipt.sh" "$tmp/run" "$tmp/out-none" t t t 0 >/dev/null 2>&1
204check "without V6_TASK: no v6 field" "null null" "$(jq -r '"\(.acceptance_v6) \(.task_v6)"' "$(ls "$tmp"/out-none/*.json | head -1)")"
205
206# ---- 3. results lines and scoring-v5 -----------------------------------------
207DECL=$HERE/../scoring/declarations/np1-v6.decl.json
208SCORER=$HERE/../scoring/score-rows.sh
209check "declaration: 73 rows, all reps 1" "73 1" "$(jq -r '"\(.rows | length) \([.rows[].reps] | unique | join(","))"' "$DECL")"
210r=$(v6rec N1)
211check "v6-results: N1 gives only its 5 v6 rows" "N1/N1-B N1/N1-C N1/N1-E N1/N1-H N1/N1-Z" "$(bash "$HERE/v6-results.sh" N1 "$r" | jq -r .row | sort | paste -sd' ')"
212r=$(v6rec R1 TASK_ID=R1 TASK_SPEC="$HERE/tasks-v6.json" TASK_ACCEPTANCE="$HERE/ACCEPTANCE-v6.md")
213check "v6-results: R1 gives 8 + 9 + 4 rows" "21" "$(bash "$HERE/v6-results.sh" R1 "$r" | wc -l)"
214check "v6-results: wrong launch id refused" "refused" "$(bash "$HERE/v6-results.sh" N1 "$r" >/dev/null 2>&1 && echo accepted || echo refused)"
215# A run.json with the record mark (as the v6 code writes it): the legacy containment
216# rows read FAIL in the receipt, unchanged, and v6-results replaces them by R1-CM.
217jq --argjson m "$(bash "$HERE/mark-evidence.sh" "$HERE/tests-v6/mark/real.cortex-mark")" \
218 '.containment.outside_new_files = ["./compose.cortex-mark"] | .containment.cortex_mark = $m' "$tmp/run/run.json" >"$tmp/rj" && cp "$tmp/rj" "$tmp/run/run.json"
219r=$(v6rec R1 TASK_ID=R1 TASK_SPEC="$HERE/tasks-v6.json" TASK_ACCEPTANCE="$HERE/ACCEPTANCE-v6.md")
220check "mark run: legacy rows still computed, FAIL" "FAIL FAIL" "$(jq -r '"\([.acceptance[] | select(.criterion == "Containment: workspace")][0].result) \([.acceptance_v5.authority[] | select(.row == "A1")][0].result)"' "$r")"
221check "mark run: v6-results drops them, keeps R1-CM" "0 1 21" "$(bash "$HERE/v6-results.sh" R1 "$r" | jq -s -r '"\(map(select(.row == "R1/A1" or .row == "R1/v1 Containment: workspace")) | length) \(map(select(.row == "R1/R1-CM")) | length) \(length)"')"
222check "mark run: R1-CM sees the mark well formed" "true" "$(jq -r '.acceptance_v6[] | select(.row == "R1-CM") | .value.cortex_mark.well_formed' "$r")"
223# A full PASS set built from the declaration scores PASS; then one row removed,
224# one row FAIL, one launch failed.
225jq -c '.rows[] | {row, rep: 1, verdict: "PASS"}' "$DECL" >"$tmp/all.jsonl"
226check "score: every declared row PASS" "PASS" "$(bash "$SCORER" "$DECL" "$tmp/all.jsonl" | jq -r .verdict)"
227grep -v '"T5/T5-N"' "$tmp/all.jsonl" >"$tmp/missing.jsonl"
228check "score: one row missing is not PASS" "NOT_RUN" "$(bash "$SCORER" "$DECL" "$tmp/missing.jsonl" | jq -r .verdict)"
229sed 's/{"row":"N2\/N2-F","rep":1,"verdict":"PASS"}/{"row":"N2\/N2-F","rep":1,"verdict":"FAIL"}/' "$tmp/all.jsonl" >"$tmp/onefail.jsonl"
230check "score: one row FAIL" "FAIL" "$(bash "$SCORER" "$DECL" "$tmp/onefail.jsonl" | jq -r .verdict)"
231{ grep -v '"R1/' "$tmp/all.jsonl"; bash "$HERE/v6-results.sh" R1 - "$DECL" "launch failed: no run.json"; } >"$tmp/nolaunch.jsonl"
232check "score: failed launch R1 is FAIL" "FAIL 21" "$(bash "$SCORER" "$DECL" "$tmp/nolaunch.jsonl" | jq -r '"\(.verdict) \([.rows[] | select(.verdict == "FAIL")] | length)"')"
233{ cat "$tmp/all.jsonl"; echo '{"row":"N1/v1 Task completion","rep":1,"verdict":"FAIL"}'; } >"$tmp/extra.jsonl"
234check "score: an undeclared negative legacy row is an extra, not counted" "PASS 1" "$(bash "$SCORER" "$DECL" "$tmp/extra.jsonl" | jq -r '"\(.verdict) \(.extras | length)"')"
235
236echo "test-rows-v6: $pass passed, $fail failed"
237[ "$fail" -eq 0 ]