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/interplane-forge/blob/main/research/tests/passages.sh # interplane-forge INTERPLANE Forge 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 `interplane-forge / research / tests / passages.sh` 126 lines · 5659 bytes Raw Blame History 1 #!/bin/sh 2 # Offline oracle: real sync/text -> build quote -> actual agent --gate --split. 3 # --split exposes the same builder spans, including unselected passages (max three selected/work). 4 # Python checks bytes/JSON; it neither implements splitting nor substitutes a passage builder. 5 set -eu 6 export LC_ALL=C 7 cd "$(dirname "$0")/../.." 8 OMC=$HOME/work/flux/omega-mv/seed/out/omc 9 PIN=`3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194` 10 [ "$(sha256sum "$OMC" | cut -d' ' -f1)" = "$PIN" ] || { echo 'passages: compiler is not the pin'; exit 2; } 11 T=$(mktemp -d /tmp/research-passages.XXXXXX) 12 trap 'rm -rf "$T"' EXIT HUP INT TERM 13 sh research/build-tools.sh "$T/bin" 14 "$OMC" < research/build.om > "$T/build" 15 "$OMC" < research/agent.om > "$T/agent" 16 chmod 700 "$T/build" "$T/agent" 17 python3 -I - "$T" <<'PY' 18 from pathlib import Path 19 import sys 20 p=Path(sys.argv[1]) 21 # Each fixture produces at most three actual builder spans. ASCII and spaced fixtures score all 22 # spans; exact requested UTF-8 fixture scores quantum only, so --split checks its unselected span too. 23 for name,text,question in [ 24 ('utf8','é'*800+' quantum '+'é'*1000,'quantum'), 25 ('ascii','a'*3609,'aaa'), 26 ('three','€'*1200+' quantum','quantum'), 27 ('four','😀'*900+' quantum','quantum'), 28 ('spaced','quantum '*450,'quantum'), 29 ]: 30 d=p/name; d.mkdir() 31 (d/'raw').write_bytes((text+'\n').encode('utf-8')) 32 (d/'question').write_text(question) 33 PY 34 for f in utf8 ascii three four spaced; do 35 "$T/bin/research-sync" text < "$T/$f/raw" > "$T/$f/text" 36 "$T/build" quote < "$T/$f/text" > "$T/$f/quoted" 37 { printf '@@\tpassage-fixture\tPassage fixture\n'; cat "$T/$f/quoted"; } > "$T/$f/corpus" 38 done 39 # Shared unchanged by the correct agent and both compiled source mutants. 40 cat > "$T/check.py" <<'PY' 41 import json,re,sys 42 from pathlib import Path 43 p=Path(sys.argv[1]); d=Path(sys.argv[2]); name=sys.argv[3] 44 def fail(reason): 45 raise SystemExit(reason) 46 def utf(data): 47 try: return data.decode('utf-8','strict') 48 except UnicodeDecodeError: fail('INVALID_UTF8') 49 def load(data): 50 try: return json.loads(utf(data)) 51 except json.JSONDecodeError: fail('INVALID_JSON') 52 def nosep(data): return data.translate(None,b' \t\r\n') 53 raw=(p/'raw').read_bytes(); admitted=(p/'text').read_bytes(); quoted=(p/'quoted').read_bytes() 54 utf(admitted) 55 if nosep(admitted)!=nosep(raw): fail('SYNC_LOST_BYTES') 56 if quoted!=b''.join(b'> '+line for line in admitted.splitlines(keepends=True)): fail('QUOTE_LOST_BYTES') 57 records=[load(line) for line in (d/'split.jsonl').read_bytes().splitlines()] 58 if not 1 "$d/ask/queue" 91 "$bin" "$d/ask/" "$T/$f/corpus" "$d/state/off" --gate --split > "$d/request.json" 2> "$d/split.jsonl" 92 python3 -I "$T/check.py" "$T/$f" "$d" "$f" 93 } 94 for f in utf8 ascii three four spaced; do run_case "$T/agent" good "$f"; done 95 # Each mutant must compile/run. Only the byte oracle can kill it, not a compile error/missing output. 96 python3 -I - research/agent.om "$T" <<'PY' 97 from pathlib import Path 98 import sys 99 s=Path(sys.argv[1]).read_text(); p=Path(sys.argv[2]) 100 a='s = p\nif sep\ns = add p 1\nend' 101 assert s.count(a)==1 102 (p/'skip.om').write_text(s.replace(a,'s = add p 1')) 103 a='while eq and get gc p 192 128 bound 4\np = sub p 1\nend' 104 assert s.count(a)==1 105 (p/'mid.om').write_text(s.replace(a,'p = add p 1')) 106 PY 107 for mutant in skip mid; do 108 "$OMC" < "$T/$mutant.om" > "$T/$mutant" 109 chmod 700 "$T/$mutant" 110 done 111 if run_case "$T/skip" skip ascii > "$T/skip.log" 2>&1; then 112 echo 'FAIL mutant skip survived'; exit 1 113 fi 114 grep -qx LOST_BYTES "$T/skip.log" || { cat "$T/skip.log"; echo 'FAIL skip wrong reason'; exit 1; } 115 if run_case "$T/mid" mid utf8 > "$T/mid.log" 2>&1; then 116 echo 'FAIL mutant mid survived'; exit 1 117 fi 118 grep -qx INVALID_UTF8 "$T/mid.log" || { cat "$T/mid.log"; echo 'FAIL mid wrong reason'; exit 1; } 119 echo 'PASSAGE_MUTANT skip=LOST_BYTES mid=INVALID_UTF8 compile=PASS' 120 echo 'PASSAGES_RESULT cases=5 mutants=2 fail=0 model=NOT_RUN' 121 # Entire sibling prompt module with the same compiled agent; no second build. 122 pass=0; fail=0 123 ok(){ pass=$((pass+1)); echo "PASS $*"; } 124 bad(){ fail=$((fail+1)); echo "FAIL $*"; } 125 . research/tests/prompt.sh 126 [ "$fail" = 0 ]