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/omega-mv/blob/main/tools/gen/retrieval/test_genret.sh # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / gen / retrieval / test_genret.sh` 455 lines ยท 35352 bytes Raw Blame History 1 #!/bin/sh 2 # tools/gen/retrieval/test_genret.sh : tests of the GEN-4 3 # file-backed retrieval provider (CONTRACT.md, genret-cli-v3) on the SYNTHETIC record set tools/gen/retrieval/fixtures/corpus/ 4 # (Agent D's record schema v1, written by fixtures/make_fixtures.sh) and the fixture queries fixtures/tasks/. 5 # CPU only, no network, no hidden data. Scores are re-derived by an independent sh + bc implementation 6 # (tokens with tr, counts with grep, integer BM25 and the fixed-point log2 in bc) and the suffix by an 7 # independent sh renderer. 8 set -eu 9 [ $# -eq 4 ] || { echo "usage: test_genret.sh " >&2; exit 2; } 10 # is the production build, bound to . is the test-only build without 11 # that binding; it is used only where a fake validator must run (GRC set). 12 G="$1" GA="$2" RC="$3" RSRC="$4" 13 case "$G" in /*) ;; *) G="$(pwd)/$G" ;; esac 14 case "$GA" in /*) ;; *) GA="$(pwd)/$GA" ;; esac 15 case "$RC" in /*) ;; *) RC="$(pwd)/$RC" ;; esac 16 HERE="$(cd "$(dirname "$0")" && pwd)" 17 FX="$HERE/fixtures" 18 W="$(mktemp -d "${TMPDIR:-/tmp}/genret-test.XXXXXXXX")" 19 trap 'rm -rf "$W"' EXIT 20 LC_ALL=C; export LC_ALL 21 pass=0 fail=0 22 ok() { pass=$((pass + 1)); } 23 bad() { echo "FAIL: $*" >&2; fail=$((fail + 1)); } 24 t() { tdesc="$1"; shift; if "$@"; then ok; else bad "$tdesc"; fi; } 25 sha() { sha256sum "$1" | cut -c1-64; } 26 RPIN="$(sha "$RC")" # the recheck pin (= build/gen_retrieval/recheck.sha256) 27 rsha() { if [ -f "$1" ]; then sha "$1"; else printf "%064d" 0; fi; } 28 REC="$FX/corpus/records" 29 MAN="$REC/MANIFEST" 30 TK="$FX/tasks" 31 32 # q [extra args...]: one query with the manifest's own digest pinned. 33 # K and CAP default to the preregistered settings (k 3, cap 4096; GEN protocol). 34 q() { 35 qm="$1" qk="$2" qt="$3" qo="$4"; shift 4 36 "$G" query --corpus "$qm" --manifest-sha256 "$(sha "$qm")" --recheck "$RC" --recheck-sha256 "$RPIN" --kind "$qk" --k "${K:-3}" \ 37 --cap-bytes "${CAP:-4096}" --requirement "$qt/requirement" --prompt "$qt/prompt" --out "$qo" "$@" 38 } 39 rv() { sed -n "s/^$2=//p" "$1/receipt.txt"; } # receipt value 40 col() { tail -n +2 "$1" | cut -f"$2"; } # column of a tsv without header 41 reason_of() { awk -F'\t' -v i="$2" '$1 == i { print $4 }' "$1/excluded.tsv"; } 42 # fatal_case : exit 2, the reason on stderr, nothing written 43 fatal_case() { 44 fn="$1" fr="$2" fo="$3"; shift 3 45 set +e; "$@" > "$W/fatal.out" 2> "$W/fatal.err"; st=$?; set -e 46 if [ "$st" -ne 2 ]; then bad "$fn: exit $st, expected 2"; return; fi 47 if ! grep -q "^genret: FATAL $fr " "$W/fatal.err"; then bad "$fn: stderr '$(cat "$W/fatal.err")' lacks FATAL $fr"; return; fi 48 if [ -e "$fo" ] && [ "$fr" != out_exists ]; then bad "$fn: $fo was created"; return; fi 49 ok 50 } 51 # copy_corpus : writable copy of the fixture record set (records/ layout); remanifest rewrites MANIFEST 52 copy_corpus() { rm -rf "$1"; mkdir -p "$1"; cp -R "$REC/." "$1/"; } 53 remanifest() { (cd "$1" && find raw abstraction -name '*.rec' | sort | xargs sha256sum > MANIFEST); } 54 # mkreceipt : writes a receipt for record , prints its sha256 (= file name) 55 mkreceipt() { 56 printf 'gen-receipt 1\nrecord %s\nnote test receipt\n' "$2" > "$1/receipts/tmp" 57 mr="$(sha "$1/receipts/tmp")"; mv "$1/receipts/tmp" "$1/receipts/$mr"; printf '%s' "$mr" 58 } 59 hdr() { awk '/^body$/ { exit } { print }' "$1" | sed -n "s/^$2 //p"; } # header value (empty for bare 'params') 60 body() { sed '1,/^body$/d' "$1"; } 61 recf() { case "$2" in raw-*) echo "$1/raw/$2.rec" ;; *) echo "$1/abstraction/$2.rec" ;; esac; } # recf 62 aid() { basename "$(grep -l "^entry $1\$" "$REC"/abstraction/*.rec)" .rec; } # abstraction id by entry 63 famtok() { printf 'gs1-%s' "$(printf 'gs1:fixture-%s' "$1" | sha256sum | cut -c1-16)"; } # fixture family token 64 A_SAT="$(aid sat_sub)" A_DIG="$(aid ndigits)" A_DOT="$(aid dot)" A_RNG="$(aid range_sum)" A_OLD="$(aid sat_sub_old)" 65 66 # ---- 1 version and the fixture pin -------------------------------------------------------------------- 67 t "version" [ "$("$G" version)" = genret-cli-v3 ] 68 t "fixture manifest matches its records" sh -c "cd '$REC' && sha256sum -c --quiet MANIFEST" 69 t "SET.sha256 is the manifest digest" [ "$(cat "$REC/SET.sha256")" = "$(sha "$MAN")" ] 70 t "recheck accepts every fixture record" sh -c "'$RC' --receipts '$REC/receipts' \$(sed 's|^[0-9a-f]* |$REC/|' '$MAN') > /dev/null" 71 t "fixtures regenerate byte-identically" sh -c "cp -R '$FX' '$W/fxcopy' && sh '$W/fxcopy/make_fixtures.sh' && diff -r '$FX/corpus' '$W/fxcopy/corpus' > /dev/null" 72 73 # ---- 2 synthetic queries retrieve the expected permitted records ------------------------------------ 74 for c in "devq_clamp raw raw-clamp_sub" "devq_clamp abstraction $A_SAT" "devq_digits raw raw-count_digits" \ 75 "devq_digits abstraction $A_DIG" "devq_dot raw raw-dot3" "devq_dot abstraction $A_DOT"; do 76 set -- $c 77 q "$MAN" "$2" "$TK/$1" "$W/s.$1.$2" 78 t "$1 $2 rank 1 is $3" [ "$(col "$W/s.$1.$2/selected.tsv" 2 | head -n 1)" = "$3" ] 79 t "$1 $2 selects 3" [ "$(rv "$W/s.$1.$2" selected)" = 3 ] 80 for id in $(col "$W/s.$1.$2/selected.tsv" 2); do 81 f="$(recf "$REC" "$id")" 82 t "$1 $2 selected $id is eligible" [ "$(hdr "$f" kind) $(hdr "$f" split) $(hdr "$f" validity)" = "$2 corpus verified" ] 83 t "$1 $2 selected $id digest = manifest" [ "$(awk -F'\t' -v i="$id" '$2 == i { print $3 }' "$W/s.$1.$2/selected.tsv")" = "$(sha "$f")" ] 84 done 85 done 86 for kd in raw abstraction; do 87 q "$MAN" $kd "$TK/devq_none" "$W/none.$kd" 88 t "devq_none $kd selects nothing" [ "$(rv "$W/none.$kd" selected)" = 0 ] 89 t "devq_none $kd empty suffix" [ ! -s "$W/none.$kd/suffix.txt" ] 90 t "devq_none $kd every indexed record no_match" [ "$(awk -F'\t' 'NR > 1 && $3 != "-" && $4 != "no_match"' "$W/none.$kd/excluded.tsv" | wc -l)" -eq 0 ] 91 done 92 93 # ---- 3 determinism: repeat runs and manifest order ---------------------------------------------------- 94 q "$MAN" raw "$TK/devq_clamp" "$W/d1"; q "$MAN" raw "$TK/devq_clamp" "$W/d2" 95 for f in selected.tsv excluded.tsv suffix.txt query.txt receipt.txt SHA256SUMS; do t "repeat run $f identical" cmp -s "$W/d1/$f" "$W/d2/$f"; done 96 copy_corpus "$W/rev"; awk '{ l[NR] = $0 } END { for (i = NR; i >= 1; i--) print l[i] }' "$MAN" > "$W/rev/MANIFEST" 97 t "reversed manifest differs" sh -c "! cmp -s '$MAN' '$W/rev/MANIFEST'" 98 q "$W/rev/MANIFEST" raw "$TK/devq_clamp" "$W/d3" 99 for f in selected.tsv excluded.tsv suffix.txt query.txt; do t "manifest order does not change $f" cmp -s "$W/d1/$f" "$W/d3/$f"; done 100 t "SHA256SUMS lists the five outputs" sh -c "cd '$W/d1' && sha256sum -c --quiet SHA256SUMS && [ \$(wc -l < SHA256SUMS) -eq 5 ]" 101 t "receipt names the contract" [ "$(rv "$W/d1" contract)" = genret-cli-v3 ] 102 103 # ---- 4 stable tie-break by record id byte order ------------------------------------------------------ 104 q "$MAN" raw "$TK/devq_twin" "$W/tie" 105 t "twins rank 1,2 by id" [ "$(col "$W/tie/selected.tsv" 2 | head -n 2 | tr '\n' ' ')" = "raw-tie_a raw-tie_b " ] 106 t "twins have equal scores" [ "$(col "$W/tie/selected.tsv" 4 | sed -n 1p)" = "$(col "$W/tie/selected.tsv" 4 | sed -n 2p)" ] 107 copy_corpus "$W/tie2"; r="$(mkreceipt "$W/tie2" raw-tie_c)" 108 sed -e 's/^id raw-tie_a$/id raw-tie_c/' -e 's/^ancestry tie_a /ancestry tie_c /' -e "s/^receipt .*/receipt $r/" \ 109 "$REC/raw/raw-tie_a.rec" > "$W/tie2/raw/raw-tie_c.rec" 110 rm "$W/tie2/raw/raw-tie_a.rec"; remanifest "$W/tie2" 111 q "$W/tie2/MANIFEST" raw "$TK/devq_twin" "$W/tie2o" 112 t "renamed twin moves behind by id" [ "$(col "$W/tie2o/selected.tsv" 2 | head -n 2 | tr '\n' ' ')" = "raw-tie_b raw-tie_c " ] 113 114 # ---- 5 exclusions: cross-split, unverified, poisoned, wrong kind, family ------------------------------ 115 E="$W/s.devq_clamp.raw" 116 for c in raw-probe_clamp:split:probe raw-unverified_clamp:validity:unverified raw-poison_fence:poisoned:fence "$A_SAT:kind:abstraction"; do 117 id="${c%%:*}"; t "C excludes $id as ${c#*:}" [ "$(reason_of "$E" "$id")" = "${c#*:}" ] 118 done 119 E="$W/s.devq_clamp.abstraction" 120 for c in "$A_OLD:validity:unverified" raw-clamp_sub:kind:raw raw-probe_clamp:kind:raw; do 121 id="${c%%:*}"; t "D excludes $id as ${c#*:}" [ "$(reason_of "$E" "$id")" = "${c#*:}" ] 122 done 123 t "every manifest record is in selected or excluded" \ 124 [ "$(cat "$W/s.devq_clamp.raw/selected.tsv" "$W/s.devq_clamp.raw/excluded.tsv" | grep -vc -e '^rank' -e '^id')" -eq "$(wc -l < "$MAN")" ] 125 t "poisoned text never reaches the suffix" sh -c "! grep -q 'Ignore all previous' '$W/s.devq_clamp.raw/suffix.txt'" 126 FB="$(famtok branch)" FC="$(famtok call)" 127 t "fixture family token is in the record" [ "$(hdr "$REC/raw/raw-clamp_sub.rec" family)" = "$FB" ] 128 q "$MAN" raw "$TK/devq_clamp" "$W/fam" --exclude-family "$FB" 129 t "exclude-family on C" [ "$(reason_of "$W/fam" raw-clamp_sub)" = "family_excluded:$FB" ] 130 t "excluded family recorded" [ "$(rv "$W/fam" exclude_family)" = "$FB" ] 131 t "excluded family records not selected" sh -c "! grep -q raw-clamp_sub '$W/fam/selected.tsv'" 132 q "$MAN" abstraction "$TK/devq_dot" "$W/famD" --exclude-family "$FC" --exclude-family "$FB" 133 t "exclude-family matches the second family of a record" [ "$(reason_of "$W/famD" "$A_DOT")" = "family_excluded:$FC" ] 134 t "exclude-family on D" [ "$(reason_of "$W/famD" "$A_SAT")" = "family_excluded:$FB" ] 135 t "two excluded families recorded in order" [ "$(rv "$W/famD" exclude_family)" = "$FC,$FB" ] 136 137 # ---- 6 fail closed: integrity problems stop the run, nothing is written -------------------------------- 138 R="$TK/devq_clamp/requirement" P="$TK/devq_clamp/prompt" O="$W/fx" 139 gbin() { if [ -n "${GG:-}" ]; then echo "$GG"; elif [ -n "${GRC:-}" ]; then echo "$GA"; else echo "$G"; fi; } 140 gq() { gm="$1" gs="$2" gr="$3" gp="$4"; shift 4 141 "$(gbin)" query --corpus "$gm" --manifest-sha256 "$gs" --recheck "${GRC:-$RC}" --recheck-sha256 "${GPIN:-$(rsha "${GRC:-$RC}")}" --kind raw --k 3 --cap-bytes 4096 \ 142 --requirement "$gr" --prompt "$gp" --out "$O" "$@"; } 143 cq() { gq "$1/MANIFEST" "$(sha "$1/MANIFEST")" "$R" "$P"; } # cq : query a mutated copy 144 M0="$(sha "$MAN")" 145 bads="$(printf '%s' "$M0" | sed 's/^./0/')"; [ "$bads" != "$M0" ] || bads="$(printf '%s' "$M0" | sed 's/^./1/')" 146 fatal_case "pinned manifest digest differs" manifest_digest_mismatch "$O" gq "$MAN" "$bads" "$R" "$P" 147 fatal_case "manifest missing" manifest_unreadable "$O" gq "$W/nope/MANIFEST" "$M0" "$R" "$P" 148 copy_corpus "$W/c1"; printf 'x\n' >> "$W/c1/raw/raw-clamp_sub.rec" 149 fatal_case "stale record digest" stale_digest "$O" cq "$W/c1" 150 copy_corpus "$W/c2"; rm "$W/c2/abstraction/$A_DOT.rec" 151 fatal_case "listed record missing" record_missing "$O" cq "$W/c2" 152 for m in "s/^desc /color red\ndesc /:unknown key" "/^receipt /d:missing receipt line" "s/^kind raw$/kind rawish/:bad kind" \ 153 "s/^gen-record 1$/gen-record 9/:bad magic" "s/^id raw-dot3$/id Raw-Dot3/:bad id" "s/^params .*/params u8/:params disagree with signature" \ 154 "s/^end$/end /:trailing space" "s/^s = long 0$/s = long 0\x01/:control byte in body" "s/^split corpus$/split heldout/:split outside the schema" \ 155 "s/^validity verified$/validity revoked/:validity outside the schema"; do 156 copy_corpus "$W/c3"; sed "${m%%:*}" "$REC/raw/raw-dot3.rec" > "$W/c3/raw/raw-dot3.rec"; remanifest "$W/c3" 157 t "mutant differs: ${m#*:}" sh -c "! cmp -s '$REC/raw/raw-dot3.rec' '$W/c3/raw/raw-dot3.rec'" 158 fatal_case "invalid record: ${m#*:}" invalid_record "$O" cq "$W/c3" 159 done 160 copy_corpus "$W/c4"; rm "$W/c4/receipts/$(hdr "$REC/raw/raw-dot3.rec" receipt)" 161 fatal_case "receipt file missing" invalid_record "$O" cq "$W/c4" 162 copy_corpus "$W/c4b"; printf 'edited\n' >> "$W/c4b/receipts/$(hdr "$REC/raw/raw-dot3.rec" receipt)" 163 fatal_case "receipt file edited" invalid_record "$O" cq "$W/c4b" 164 copy_corpus "$W/c5"; cp "$REC/raw/raw-tie_a.rec" "$W/c5/raw/raw-tie_a2.rec"; remanifest "$W/c5" 165 fatal_case "duplicate record id" duplicate_id "$O" cq "$W/c5" 166 copy_corpus "$W/c6"; sed '1s| | raw/../|' "$MAN" > "$W/c6/MANIFEST" 167 fatal_case "manifest path with .." manifest_malformed "$O" cq "$W/c6" 168 copy_corpus "$W/c7"; sed '1s/ / /' "$MAN" > "$W/c7/MANIFEST" 169 fatal_case "manifest one-space separator" manifest_malformed "$O" cq "$W/c7" 170 copy_corpus "$W/c8"; printf '%s' "$(cat "$MAN")" > "$W/c8/MANIFEST" 171 fatal_case "manifest without final newline" manifest_malformed "$O" cq "$W/c8" 172 copy_corpus "$W/c9"; sed -n 1p "$MAN" >> "$W/c9/MANIFEST" 173 fatal_case "manifest duplicate path" manifest_malformed "$O" cq "$W/c9" 174 # recheck itself must be real and must agree record by record 175 GRC="$W/nope/recheck" fatal_case "recheck binary missing" recheck_failed "$O" gq "$MAN" "$M0" "$R" "$P" 176 printf '#!/bin/sh\necho OK raw-somebody-else\n' > "$W/fake1"; chmod +x "$W/fake1" 177 GRC="$W/fake1" fatal_case "recheck names another id" recheck_failed "$O" gq "$MAN" "$M0" "$R" "$P" 178 printf '#!/bin/sh\nexit 0\n' > "$W/fake2"; chmod +x "$W/fake2" 179 GRC="$W/fake2" fatal_case "recheck prints nothing" recheck_failed "$O" gq "$MAN" "$M0" "$R" "$P" 180 printf '#!/bin/sh\nexit 1\n' > "$W/fake3"; chmod +x "$W/fake3" 181 GRC="$W/fake3" fatal_case "recheck refuses without a reason" recheck_failed "$O" gq "$MAN" "$M0" "$R" "$P" 182 printf '#!/bin/sh\nshift 2\nfor f; do sed -n "s/^id /OK /p" "$f"; done\necho OK extra\n' > "$W/fake4"; chmod +x "$W/fake4" 183 GRC="$W/fake4" fatal_case "recheck prints an extra line" recheck_failed "$O" gq "$MAN" "$M0" "$R" "$P" 184 copy_corpus "$W/c10" 185 printf '#!/bin/sh\nshift 2\nfor f; do sed -n "s/^id /OK /p" "$f"; done\nprintf "x\\n" >> "%s"\n' "$W/c10/raw/raw-dot3.rec" > "$W/fake5"; chmod +x "$W/fake5" 186 GRC="$W/fake5" fatal_case "record changed while recheck read it" stale_digest "$O" cq "$W/c10" 187 # the validator is pinned: genret refuses a recheck whose sha256 is not the pin, and the receipt names it 188 printf '#!/bin/sh\nshift 2\nfor f; do sed -n "s/^id /OK /p" "$f"; done\n' > "$W/approve"; chmod +x "$W/approve" 189 GRC="$W/approve" GPIN="$RPIN" fatal_case "always-approve recheck under the real pin" recheck_untrusted "$O" gq "$MAN" "$M0" "$R" "$P" 190 GPIN="$(printf '%s' "$RPIN" | tr 0-9a-f 1-9a-f0)" fatal_case "real recheck under a wrong pin" recheck_untrusted "$O" gq "$MAN" "$M0" "$R" "$P" 191 fatal_case "recheck pin not hex" usage "$O" "$G" query --corpus "$MAN" --manifest-sha256 "$M0" --recheck "$RC" --recheck-sha256 xyz --kind raw --k 1 --cap-bytes 9 --requirement "$R" --prompt "$P" --out "$O" 192 fatal_case "no --recheck-sha256" usage "$O" "$G" query --corpus "$MAN" --manifest-sha256 "$M0" --recheck "$RC" --kind raw --k 1 --cap-bytes 9 --requirement "$R" --prompt "$P" --out "$O" 193 copy_corpus "$W/c11"; rm -f "$W/c11/receipts/"* 194 fatal_case "real recheck refuses a corpus without receipts" invalid_record "$O" cq "$W/c11" 195 O="$W/stub"; GRC="$W/approve" gq "$W/c11/MANIFEST" "$(sha "$W/c11/MANIFEST")" "$R" "$P" 2> /dev/null || true 196 O="$W/stubreal"; gq "$MAN" "$M0" "$R" "$P"; O="$W/fx" 197 t "a stub validator under its own pin runs" [ -f "$W/stub/receipt.txt" ] 198 t "stub validator: receipt differs from the real run" sh -c "! cmp -s '$W/stub/receipt.txt' '$W/stubreal/receipt.txt'" 199 t "stub validator: receipt names the stub" [ "$(rv "$W/stub" recheck_sha256)" = "$(sha "$W/approve")" ] 200 t "stub validator: source claim is unverified" [ "$(rv "$W/stub" recheck_source_sha256)" = unverified ] 201 GG="$G" GRC="$W/approve" fatal_case "production genret refuses a stub under the stub's own pin" recheck_untrusted "$O" gq "$MAN" "$M0" "$R" "$P" 202 t "refusal names the built-in binary pin" grep -q "is not the recheck this genret was built with ($RPIN)" "$W/fatal.err" 203 cp "$RC" "$W/rc_copy"; printf 'x' >> "$W/rc_copy" 204 GG="$G" GRC="$W/rc_copy" fatal_case "production genret refuses a modified recheck under its own pin" recheck_untrusted "$O" gq "$MAN" "$M0" "$R" "$P" 205 O="$W/anyreal"; GG="$GA" gq "$MAN" "$M0" "$R" "$P"; O="$W/fx" 206 for f in selected.tsv excluded.tsv suffix.txt query.txt; do 207 t "test build with the real recheck: $f identical to production" cmp -s "$W/stubreal/$f" "$W/anyreal/$f" 208 done 209 t "test build receipt differs only in the source claim" [ "$(diff "$W/stubreal/receipt.txt" "$W/anyreal/receipt.txt" | grep -c '^[<>]')" -eq 2 ] 210 t "test build receipt says unverified" [ "$(rv "$W/anyreal" recheck_source_sha256)" = unverified ] 211 t "real run: receipt names the pinned recheck" [ "$(rv "$W/stubreal" recheck_sha256)" = "$RPIN" ] 212 t "receipt names the recheck source the build verified" [ "$(rv "$W/stubreal" recheck_source_sha256)" = "$(sha "$RSRC")" ] 213 t "recheck source is D's frozen schema v1 recheck.c" [ "$(sha "$RSRC")" = `9d7a3c74de404170d32eacbc0ab551e3b598a086d9b300a94825e70614533e6c` ] 214 # task files are opened once; the open file's own path is checked (symlinks into hidden/ are refused) 215 mkdir -p "$W/task/hidden"; cp "$R" "$W/task/hidden/requirement"; cp "$P" "$W/task/hidden/prompt" 216 ln -s "$W/task/hidden/requirement" "$W/task/req.link"; ln -s "$W/task/hidden" "$W/task/hid.link" 217 fatal_case "requirement symlink into hidden/" hidden_path "$O" gq "$MAN" "$M0" "$W/task/req.link" "$P" 218 fatal_case "prompt through a symlinked hidden dir" hidden_path "$O" gq "$MAN" "$M0" "$R" "$W/task/hid.link/prompt" 219 fatal_case "requirement is a directory" requirement_invalid "$O" gq "$MAN" "$M0" "$W/task" "$P" 220 mkfifo "$W/task/fifo" 221 fatal_case "prompt is a FIFO" prompt_invalid "$O" gq "$MAN" "$M0" "$R" "$W/task/fifo" 222 t "FIFO prompt refused as not a regular file" grep -q 'not a regular file' "$W/fatal.err" 223 fatal_case "prompt missing" prompt_invalid "$O" gq "$MAN" "$M0" "$R" "$W/task/nope" 224 # outputs appear atomically: no temporary directory is left after success or failure 225 t "no temporary output dir after success" [ -z "$(find "$W" -maxdepth 1 -name '*.tmp.*')" ] 226 mkdir -p "$W/ro"; chmod 555 "$W/ro" 227 if [ ! -w "$W/ro" ]; then 228 O="$W/ro/out"; fatal_case "read-only parent: write_failed" write_failed "$O" gq "$MAN" "$M0" "$R" "$P"; O="$W/fx" 229 t "read-only parent: nothing left behind" [ -z "$(ls -A "$W/ro")" ] 230 else bad "cannot make a read-only directory (running as root?)"; fi 231 chmod 755 "$W/ro" 232 mkdir -p "$W/task/hidden"; cp "$R" "$W/task/hidden/requirement"; cp "$P" "$W/task/hidden/prompt" 233 fatal_case "requirement under hidden/" hidden_path "$O" gq "$MAN" "$M0" "$W/task/hidden/requirement" "$P" 234 fatal_case "prompt under hidden/" hidden_path "$O" gq "$MAN" "$M0" "$R" "$W/task/hidden/prompt" 235 grep -v '^entry' "$R" > "$W/task/noentry"; { cat "$R"; echo "ret u8"; } > "$W/task/tworet" 236 fatal_case "requirement without entry" requirement_invalid "$O" gq "$MAN" "$M0" "$W/task/noentry" "$P" 237 fatal_case "requirement with two ret lines" requirement_invalid "$O" gq "$MAN" "$M0" "$W/task/tworet" "$P" 238 : > "$W/task/empty"; printf 'tab\there\n' > "$W/task/tab" 239 fatal_case "empty prompt" prompt_invalid "$O" gq "$MAN" "$M0" "$R" "$W/task/empty" 240 fatal_case "prompt with a tab" prompt_invalid "$O" gq "$MAN" "$M0" "$R" "$W/task/tab" 241 mkdir -p "$W/exists" 242 fatal_case "out exists" out_exists "$W/exists" "$G" query --corpus "$MAN" --manifest-sha256 "$M0" --recheck "$RC" --recheck-sha256 "$RPIN" --kind raw --k 3 --cap-bytes 9 --requirement "$R" --prompt "$P" --out "$W/exists" 243 t "existing out left empty" [ -z "$(ls -A "$W/exists")" ] 244 # --out created after the up-front check (here by the validator, which runs between that check and the rename): 245 # the rename must refuse to replace it (RENAME_NOREPLACE), even an empty directory, and leave it as it was 246 printf '#!/bin/sh\nmkdir "%s"\nshift 2\nfor f; do sed -n "s/^id /OK /p" "$f"; done\n' "$W/race" > "$W/racer"; chmod +x "$W/racer" 247 O="$W/race"; GRC="$W/racer" fatal_case "out created during the run is not replaced" out_exists "$O" gq "$MAN" "$M0" "$R" "$P"; O="$W/fx" 248 t "out created during the run left empty" sh -c "[ -d '$W/race' ] && [ -z \"\$(ls -A '$W/race')\" ]" 249 t "no temporary output dir after the refused rename" [ -z "$(find "$W" -maxdepth 1 -name 'race.tmp.*')" ] 250 fatal_case "k 0" usage "$O" "$G" query --corpus "$MAN" --manifest-sha256 "$M0" --recheck "$RC" --recheck-sha256 "$RPIN" --kind raw --k 0 --cap-bytes 9 --requirement "$R" --prompt "$P" --out "$O" 251 fatal_case "k 65" usage "$O" "$G" query --corpus "$MAN" --manifest-sha256 "$M0" --recheck "$RC" --recheck-sha256 "$RPIN" --kind raw --k 65 --cap-bytes 9 --requirement "$R" --prompt "$P" --out "$O" 252 fatal_case "kind other" usage "$O" "$G" query --corpus "$MAN" --manifest-sha256 "$M0" --recheck "$RC" --recheck-sha256 "$RPIN" --kind text --k 1 --cap-bytes 9 --requirement "$R" --prompt "$P" --out "$O" 253 fatal_case "no --recheck" usage "$O" "$G" query --corpus "$MAN" --manifest-sha256 "$M0" --kind raw --k 1 --cap-bytes 9 --requirement "$R" --prompt "$P" --out "$O" 254 fatal_case "unknown option" usage "$O" gq "$MAN" "$M0" "$R" "$P" --hidden "$W" 255 fatal_case "target without length-matched" usage "$O" gq "$MAN" "$M0" "$R" "$P" --target-bytes 100 256 fatal_case "target above cap" usage "$O" gq "$MAN" "$M0" "$R" "$P" --mode length-matched --target-bytes 5000 257 fatal_case "repeated k" usage "$O" gq "$MAN" "$M0" "$R" "$P" --k 2 258 fatal_case "unknown mode" usage "$O" gq "$MAN" "$M0" "$R" "$P" --mode lucky 259 260 # ---- 7 C and D under identical caps; whole records only; independent renderer -------------------------- 261 SETTINGS='^(contract|mode|k|cap_bytes|target_bytes|exclude_family|manifest_sha256|recheck_sha256|recheck_source_sha256|requirement_sha256|prompt_sha256|query_sha256)=' 262 for cap in 600 4096; do 263 CAP=$cap q "$MAN" raw "$TK/devq_clamp" "$W/C$cap"; CAP=$cap q "$MAN" abstraction "$TK/devq_clamp" "$W/D$cap" 264 for kd in C D; do 265 o="$W/$kd$cap" 266 t "$kd cap $cap respected" [ "$(rv "$o" suffix_bytes)" -le "$cap" ] 267 t "$kd cap $cap suffix_bytes = file size" [ "$(rv "$o" suffix_bytes)" -eq "$(wc -c < "$o/suffix.txt")" ] 268 done 269 t "C and D receipts share settings at cap $cap" [ "$(grep -E "$SETTINGS" "$W/C$cap/receipt.txt")" = "$(grep -E "$SETTINGS" "$W/D$cap/receipt.txt")" ] 270 done 271 t "cap 600 drops whole records (C)" [ "$(rv "$W/C600" selected)" -lt 3 ] 272 t "cap 600 logs cap_bytes (C)" [ "$(reason_of "$W/C600" raw-dot3)" = cap_bytes ] 273 t "after the cap stop, lower records are cap_bytes too" [ "$(reason_of "$W/C600" raw-sum_range)" = cap_bytes ] 274 CAP=60 q "$MAN" raw "$TK/devq_clamp" "$W/C60" 275 t "cap below the first record: empty" [ "$(rv "$W/C60" selected)" = 0 ] 276 t "cap below the first record: empty suffix" [ ! -s "$W/C60/suffix.txt" ] 277 t "cap below the first record: rank 1 logged cap_bytes" [ "$(reason_of "$W/C60" raw-clamp_sub)" = cap_bytes ] 278 K=2 q "$MAN" raw "$TK/devq_clamp" "$W/K2" 279 t "k 2 selects 2" [ "$(rv "$W/K2" selected)" = 2 ] 280 t "rank 3 logged beyond_k" [ "$(reason_of "$W/K2" raw-sum_range)" = beyond_k ] 281 # render : the suffix rebuilt in sh from selected.tsv and the record files (CONTRACT.md 6); one heading for both kinds 282 render() { 283 if [ "$(col "$1/selected.tsv" 2 | wc -l)" -eq 0 ]; then return; fi 284 printf '\nVerified reference code from earlier tasks, most relevant first.\n' 285 tail -n +2 "$1/selected.tsv" | while IFS="$(printf '\t')" read -r rk id dg sc by rl; do 286 f="$(recf "$REC" "$id")" 287 printf '\nRecord %s.\n\nentry %s\n' "$rk" "$(hdr "$f" entry)" 288 pv="$(hdr "$f" params)"; if [ -n "$pv" ]; then printf 'params %s\n' "$pv"; else printf 'params\n'; fi 289 printf 'ret %s\n\n%s\n\n```\n' "$(hdr "$f" ret)" "$(hdr "$f" desc)" 290 body "$f"; printf '```\n' 291 done 292 } 293 for o in "C600 raw" "D600 abstraction" "C4096 raw" "D4096 abstraction" "tie raw"; do 294 set -- $o; render "$W/$1" > "$W/$1.render" 295 t "independent renderer matches suffix $1" cmp -s "$W/$1.render" "$W/$1/suffix.txt" 296 t "bytes column sums to suffix minus heading $1" [ "$(col "$W/$1/selected.tsv" 5 | awk '{ s += $1 } END { print s + 0 }')" -eq \ 297 "$(($(wc -c < "$W/$1/suffix.txt") - $(head -n 2 "$W/$1/suffix.txt" | wc -c)))" ] 298 done 299 t "D suffix shows no abstraction-only fields" sh -c "! grep -q -e '^pre ' -e '^post ' -e '^example ' -e '^fingerprint ' -e '^receipt ' '$W/D4096/suffix.txt'" 300 # C and D are rendered identically apart from record content: blank out entry/params/ret values, desc and 301 # fenced bodies, and the two suffixes must be the same bytes 302 template() { 303 awk 'f { if ($0 == "```") { f = 0; print } ; next } 304 $0 == "```" { f = 1; print; print "BODY"; next } 305 s == 1 { print; s = 2; next } 306 s == 2 { print "DESC"; s = 0; next } 307 /^entry / { print "entry X"; next } 308 /^params( |$)/ { print "params X"; next } 309 /^ret / { print "ret X"; s = 1; next } 310 { print }' "$1" 311 } 312 for tk in devq_clamp devq_digits devq_dot; do 313 template "$W/s.$tk.raw/suffix.txt" > "$W/tpl.$tk.C"; template "$W/s.$tk.abstraction/suffix.txt" > "$W/tpl.$tk.D" 314 t "C and D suffixes differ in content ($tk)" sh -c "! cmp -s '$W/s.$tk.raw/suffix.txt' '$W/s.$tk.abstraction/suffix.txt'" 315 t "C and D suffix templates byte-identical ($tk)" cmp -s "$W/tpl.$tk.C" "$W/tpl.$tk.D" 316 t "template keeps 3 records ($tk)" [ "$(grep -c '^BODY$' "$W/tpl.$tk.C")" -eq 3 ] 317 done 318 t "template starts with the shared heading" [ "$(sed -n 2p "$W/tpl.devq_clamp.C")" = "Verified reference code from earlier tasks, most relevant first." ] 319 sed '2s/reference code/helper functions/' "$W/s.devq_clamp.abstraction/suffix.txt" > "$W/tplmut" 320 template "$W/tplmut" > "$W/tplmut.t" 321 t "template comparison detects a changed heading (mutant)" sh -c "! cmp -s '$W/tplmut.t' '$W/tpl.devq_clamp.C'" 322 323 # ---- 8 query = public requirement + prompt only: hidden canary never influences output ---------------- 324 mkdir -p "$W/nohid"; cp "$TK/devq_clamp/requirement" "$TK/devq_clamp/prompt" "$W/nohid/" 325 mkdir -p "$W/otherhid/hidden"; cp "$TK/devq_clamp/requirement" "$TK/devq_clamp/prompt" "$W/otherhid/" 326 printf 'twin twin twin sat sub clamp\n' > "$W/otherhid/hidden/expected"; printf 'zqxcanary\n' > "$W/otherhid/hidden/inputs" 327 q "$MAN" raw "$W/nohid" "$W/h1"; q "$MAN" raw "$W/otherhid" "$W/h2" 328 for f in selected.tsv excluded.tsv suffix.txt query.txt receipt.txt; do 329 t "no hidden dir: $f identical" cmp -s "$W/d1/$f" "$W/h1/$f" 330 t "different hidden files: $f identical" cmp -s "$W/d1/$f" "$W/h2/$f" 331 done 332 t "the fixture task really has a hidden canary" grep -q zqxcanary "$TK/devq_clamp/hidden/expected" 333 t "canary token absent from the query" sh -c "! grep -qx zqxcanary '$W/d1/query.txt'" 334 t "canary record not selected" sh -c "! grep -q raw-canary '$W/d1/selected.tsv'" 335 mkdir -p "$W/leak"; cp "$TK/devq_clamp/requirement" "$W/leak/"; { cat "$TK/devq_clamp/prompt"; echo "zqxcanary zqxcanary"; } > "$W/leak/prompt" 336 q "$MAN" raw "$W/leak" "$W/h3" 337 t "positive control: a leaked canary word gets the canary record selected" grep -q raw-canary "$W/h3/selected.tsv" 338 t "positive control: the leaked word is in the query" grep -qx zqxcanary "$W/h3/query.txt" 339 # the requirement contributes the entry/params/ret values only: comment lines do not count 340 { echo "# zqxcanary zqxcanary zqxcanary"; cat "$TK/devq_clamp/requirement"; } > "$W/nohid/requirement" 341 q "$MAN" raw "$W/nohid" "$W/h4" 342 t "requirement comment lines are not query text" cmp -s "$W/d1/query.txt" "$W/h4/query.txt" 343 t "requirement comment lines change no selection" cmp -s "$W/d1/selected.tsv" "$W/h4/selected.tsv" 344 345 # ---- 9 ablations: irrelevant and empty ---------------------------------------------------------------- 346 for kd in raw abstraction; do 347 K=2 q "$MAN" $kd "$TK/devq_clamp" "$W/irr.$kd" --mode irrelevant 348 o="$W/irr.$kd" 349 t "irrelevant $kd selects 2" [ "$(rv "$o" selected)" = 2 ] 350 t "irrelevant $kd scores ascend" [ "$(col "$o/selected.tsv" 4 | sort -n | tr '\n' ' ')" = "$(col "$o/selected.tsv" 4 | tr '\n' ' ')" ] 351 minall="$( { col "$o/selected.tsv" 4; awk -F'\t' 'NR > 1 && $3 != "-" { print $3 }' "$o/excluded.tsv"; } | sort -n | head -n 1)" 352 t "irrelevant $kd rank 1 has the lowest score" [ "$(col "$o/selected.tsv" 4 | head -n 1)" = "$minall" ] 353 top="$(col "$W/s.devq_clamp.$kd/selected.tsv" 2 | head -n 1)" 354 t "irrelevant $kd excludes the normal top record" sh -c "! cut -f2 '$o/selected.tsv' | grep -qx '$top'" 355 q "$MAN" $kd "$TK/devq_clamp" "$W/emp.$kd" --mode empty 356 o="$W/emp.$kd" 357 t "empty $kd selects 0" [ "$(rv "$o" selected)" = 0 ] 358 t "empty $kd suffix 0 bytes" [ ! -s "$o/suffix.txt" ] 359 t "empty $kd logs ablation_empty for every indexed record" \ 360 [ "$(awk -F'\t' 'NR > 1 && $3 != "-" && $4 == "ablation_empty"' "$o/excluded.tsv" | wc -l)" -eq "$(rv "$o" indexed)" ] 361 done 362 t "empty mode keeps exclusion reasons of unindexed records" [ "$(reason_of "$W/emp.raw" raw-poison_fence)" = poisoned:fence ] 363 364 # ---- 10 length-matched ablation: the target is the other arm's realised suffix_bytes --------------------- 365 # Fixture numbers (devq_clamp, raw): heading 66 bytes; blocks in rank order clamp_sub 180, dot3 492, 366 # sum_range 250, canary 207, tie_a 172, tie_b 172, count_digits 215. K=1 unpadded = 66 + 180 = 246. 367 lm() { # lm [extra args]: K=1 devq_clamp raw, length-matched 368 lo="$1" lt="$2"; shift 2; K=1 q "$MAN" raw "$TK/devq_clamp" "$W/$lo" --mode length-matched --target-bytes "$lt" "$@" 369 } 370 lmrc() { echo "$(rv "$W/$1" pad) $(rv "$W/$1" pad_reason) $(rv "$W/$1" unpadded_bytes) $(rv "$W/$1" suffix_bytes) $(rv "$W/$1" length_gap)"; } 371 K=1 q "$MAN" raw "$TK/devq_clamp" "$W/lm0" 372 t "normal mode: length fields unused" [ "$(lmrc lm0) $(rv "$W/lm0" target_bytes)" = "- - - 246 - -" ] 373 t "heading is 66 bytes" [ "$(head -n 2 "$W/lm0/suffix.txt" | wc -c)" -eq 66 ] 374 lm lmA 300 375 t "shorter C: one whole pad reaches the target" [ "$(lmrc lmA)" = "1 reached 246 738 438" ] 376 t "shorter C: pad is rank k+1 (raw-dot3)" [ "$(tail -n +2 "$W/lmA/selected.tsv" | cut -f1,2,5,6 | tr '\t\n' ' ')" = "1 raw-clamp_sub 180 top 2 raw-dot3 492 pad " ] 377 t "shorter C: length_gap = suffix - target" [ "$(rv "$W/lmA" length_gap)" -eq $(($(rv "$W/lmA" suffix_bytes) - 300)) ] 378 t "shorter C: suffix_bytes = file size" [ "$(rv "$W/lmA" suffix_bytes)" -eq "$(wc -c < "$W/lmA/suffix.txt")" ] 379 t "receipt keys in contract order" [ "$(cut -d= -f1 "$W/lmA/receipt.txt" | tr '\n' ' ')" = "contract mode kind k cap_bytes target_bytes exclude_family manifest_sha256 recheck_sha256 recheck_source_sha256 requirement_sha256 prompt_sha256 query_sha256 records indexed total_tokens selected pad pad_reason unpadded_bytes suffix_bytes length_gap suffix_sha256 selected_sha256 excluded_sha256 " ] 380 lm lmB 800 381 t "two pads, rank order, until reached" [ "$(lmrc lmB)" = "2 reached 246 988 188" ] 382 t "two pads are rank k+1 and k+2" [ "$(col "$W/lmB/selected.tsv" 2 | tr '\n' ' ')" = "raw-clamp_sub raw-dot3 raw-sum_range " ] 383 t "two pads have role pad" [ "$(col "$W/lmB/selected.tsv" 6 | tr '\n' ' ')" = "top pad pad " ] 384 t "records after the pads stay beyond_k" [ "$(reason_of "$W/lmB" raw-canary)" = beyond_k ] 385 render "$W/lmB" > "$W/lmB.render" 386 t "independent renderer matches the padded suffix" cmp -s "$W/lmB.render" "$W/lmB/suffix.txt" 387 CAP=600 lm lmC 400 388 t "a pad that would pass the cap is skipped" [ "$(lmrc lmC)" = "1 reached 246 496 96" ] 389 t "skipped pad candidate keeps its reason" [ "$(reason_of "$W/lmC" raw-dot3)" = beyond_k ] 390 t "the next candidate is the pad" [ "$(col "$W/lmC/selected.tsv" 2 | tr '\n' ' ')" = "raw-clamp_sub raw-sum_range " ] 391 CAP=738 lm lmH 300 392 t "a pad that lands exactly on the cap is taken" [ "$(lmrc lmH)" = "1 reached 246 738 438" ] 393 t "exact-cap pad is rank k+1 (raw-dot3)" [ "$(col "$W/lmH/selected.tsv" 2 | tr '\n' ' ')" = "raw-clamp_sub raw-dot3 " ] 394 t "exact-cap suffix equals the cap" [ "$(wc -c < "$W/lmH/suffix.txt")" -eq 738 ] 395 CAP=600 lm lmD 500 396 t "candidates run out under the cap: exhausted, short of target" [ "$(lmrc lmD)" = "1 exhausted 246 496 -4" ] 397 lm lmE 4096 398 t "every candidate used: exhausted" [ "$(lmrc lmE)" = "6 exhausted 246 1754 -2342" ] 399 t "exhausted suffix never passes the cap" [ "$(rv "$W/lmE" suffix_bytes)" -le 4096 ] 400 lm lmF 246 401 t "C exactly at target: c_not_shorter" [ "$(lmrc lmF)" = "none c_not_shorter 246 246 0" ] 402 t "c_not_shorter leaves the normal selection" cmp -s "$W/lm0/selected.tsv" "$W/lmF/selected.tsv" 403 CAP=200 lm lmG 200 404 t "nothing fits at all: exhausted with no pad" [ "$(lmrc lmG)" = "none exhausted 0 0 -200" ] 405 # the reviewer's case: D (devq_dot, k 1) is 295 bytes; C at k 3 is already 945 bytes 406 K=1 q "$MAN" abstraction "$TK/devq_dot" "$W/lmDd" 407 t "D devq_dot k 1 realised 295 bytes" [ "$(rv "$W/lmDd" suffix_bytes)" = 295 ] 408 q "$MAN" raw "$TK/devq_dot" "$W/lmCn" 409 q "$MAN" raw "$TK/devq_dot" "$W/lmCc" --mode length-matched --target-bytes "$(rv "$W/lmDd" suffix_bytes)" 410 t "longer C: pad=none c_not_shorter, both lengths in the receipt" [ "$(lmrc lmCc) $(rv "$W/lmCc" target_bytes)" = "none c_not_shorter 945 945 650 295" ] 411 t "longer C: selection is the normal one" cmp -s "$W/lmCn/selected.tsv" "$W/lmCc/selected.tsv" 412 t "longer C: suffix is the normal one" cmp -s "$W/lmCn/suffix.txt" "$W/lmCc/suffix.txt" 413 414 # ---- 11 independent score oracle (sh tokens + bc integer BM25) ------------------------------------------ 415 tokens() { tr 'A-Z' 'a-z' | tr -cs 'a-z0-9' '\n' | grep -v '^$' || true; } 416 oracle() { # oracle : prints "id score" for every indexed record 417 od="$1" okd="$2" ot="$3" oo="$W/oracle"; rm -rf "$oo"; mkdir -p "$oo" 418 { grep -E '^(entry|params|ret)( |$)' "$ot/requirement" | sed 's/^[a-z]*//'; cat "$ot/prompt"; } | tokens | sort -u > "$oo/q" 419 cmp -s "$oo/q" "$od/query.txt" || { echo "oracle: query terms differ" >&2; return 1; } 420 : > "$oo/ids" 421 for f in "$REC"/raw/*.rec "$REC"/abstraction/*.rec; do 422 [ "$(hdr "$f" kind)" = "$okd" ] && [ "$(hdr "$f" split)" = corpus ] && [ "$(hdr "$f" validity)" = verified ] || continue 423 if body "$f" | grep -q '```' || hdr "$f" desc | grep -q '```'; then continue; fi 424 id="$(hdr "$f" id)"; echo "$id" >> "$oo/ids" 425 { for k in entry params ret desc; do hdr "$f" $k; done; body "$f"; } | tokens > "$oo/$id.tok" 426 done 427 N="$(wc -l < "$oo/ids")"; T="$(cat "$oo"/*.tok | wc -l)" 428 { 429 echo 'define g(a, b) { auto k, y, r, i; k = 0; while (a >= 2 * b) { b = 2 * b; k = k + 1; }' 430 echo ' y = (a * 2^30) / b; r = k * 2^16; for (i = 15; i >= 0; i--) { y = (y * y) / 2^30; if (y >= 2^31) { y = y / 2; r = r + 2^i; } }' 431 echo ' return (r); }' 432 while read -r id; do 433 dl="$(wc -l < "$oo/$id.tok")"; printf 's = 0\n' 434 while read -r term; do 435 tf="$(grep -cx "$term" "$oo/$id.tok" || true)"; [ "$tf" -gt 0 ] || continue 436 df=0; while read -r j; do if grep -qx "$term" "$oo/$j.tok"; then df=$((df + 1)); fi; done < "$oo/ids" 437 printf 's = s + (g(%s, %s) * %s * 44 * %s) / (20 * %s * %s + 6 * %s + 18 * %s * %s)\n' $((2 * N + 2)) $((2 * df + 1)) "$tf" "$T" "$T" "$tf" "$T" "$dl" "$N" 438 done < "$oo/q" 439 printf 'print "%s ", s, "\\n"\n' "$id" 440 done < "$oo/ids" 441 } | bc | sort 442 } 443 for c in "s.devq_clamp.raw raw devq_clamp" "s.devq_digits.abstraction abstraction devq_digits" "s.devq_dot.raw raw devq_dot" "tie raw devq_twin"; do 444 set -- $c 445 { tail -n +2 "$W/$1/selected.tsv" | cut -f2,4; awk -F'\t' 'NR > 1 && $3 != "-" { print $1 "\t" $3 }' "$W/$1/excluded.tsv"; } | tr '\t' ' ' | sort > "$W/$1.scores" 446 if oracle "$W/$1" "$2" "$TK/$3" > "$W/$1.oracle"; then 447 t "oracle scores = genret scores ($1)" cmp -s "$W/$1.oracle" "$W/$1.scores" 448 else bad "oracle failed ($1)"; fi 449 done 450 t "oracle checked nonzero scores" [ "$(awk '$2 > 0' "$W/s.devq_clamp.raw.scores" | wc -l)" -gt 0 ] 451 sed '1s/ \([0-9]*\)$/ 1\1/' "$W/s.devq_clamp.raw.scores" > "$W/mut.scores" 452 t "oracle comparison detects a changed score (mutant)" sh -c "! cmp -s '$W/s.devq_clamp.raw.oracle' '$W/mut.scores'" 453 454 echo "test_genret: $pass passed, $fail failed" 455 [ "$fail" -eq 0 ]