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/run.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 / run.sh`
121 lines ยท 11348 bytes Raw Blame History
1 #!/bin/sh
2 # research/tests/run.sh: gates for the research builder and the research agent. Private temp dir,
3 # no port, no model call, nothing under ~/forge-data. Refuses any compiler but the pin (exit 2).
4 # sh research/tests/run.sh -> RESULT pass=N fail=0
5 # Negative controls: a builder with the "<" escape removed must print the planted markup; an agent
6 # given a queue line whose id is not hex must write nothing for it.
7 set -u
8 export LC_ALL=C
9 cd "$(dirname "$0")/../.."
10 OMC=$HOME/work/flux/omega-mv/seed/out/omc
11 PIN=`3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194`
12 [ "$(sha256sum "$OMC" | cut -d' ' -f1)" = "$PIN" ] || { echo "omc is not the pin"; exit 2; }
13 T=$(mktemp -d /tmp/research-gate.XXXXXX)
14 trap 'rm -rf "$T"' EXIT HUP INT TERM
15 pass=0; fail=0
16 ok() { pass=$((pass + 1)); echo "PASS $*"; }
17 bad() { fail=$((fail + 1)); echo "FAIL $*"; }
18 is() { if [ "$1" = "$2" ]; then ok "$3 ($1)"; else bad "$3: want $2, got $1"; fi; }
19 C=research/registry/catalog.tsv
20 "$OMC" < research/build.om > "$T/build" && chmod 700 "$T/build" && ok "builder compiles" || bad "builder does not compile"
21 "$OMC" < research/agent.om > "$T/agent" && chmod 700 "$T/agent" && ok "agent compiles" || bad "agent does not compile"
22 gen() { { printf 'M\t%s\t%s\n' "$1" "${2:-}"; cat "${3:-$C}"; } | "$T/build"; }
23
24 # ---- the registry as published
25 gen slugs > "$T/slugs"
26 is "$(wc -l < "$T/slugs" | tr -d ' ')" "$(grep -c '^W ' $C)" "one slug per work"
27 gen index > "$T/index.html"; gen json > "$T/index.json"
28 python3 -I - "$T/index.json" "$C" > "$T/totals" 2>&1 <<'PY'
29 import json, sys
30 d = json.load(open(sys.argv[1])); rows = [l.rstrip("\n").split("\t") for l in open(sys.argv[2])]
31 w = [r for r in rows if r[0] == "W"]
32 print(len(d["works"]) == len(w), sum(x["versions"] for x in d["works"]) == sum(1 for r in rows if r[0] == "V"),
33 len(d["relations"]) == sum(1 for r in rows if r[0] == "E"), sum(1 for x in d["works"] if x["on_orcid"]) == sum(1 for r in w if r[10] == "1"),
34 all(x["doi"] == r[6] and x["slug"] == r[1] for x, r in zip(d["works"], w)))
35 PY
36 is "$(cat "$T/totals")" "True True True True True" "index.json agrees with the registry: works, versions, relations, ORCID marks, DOIs"
37 n=0; badj=0; miss=0
38 while read -r s; do
39 gen work "$s" > "$T/w.html" || miss=$((miss + 1))
40 gen wjson "$s" > "$T/w.json" || miss=$((miss + 1))
41 gen wbib "$s" > "$T/w.bib" || miss=$((miss + 1))
42 python3 -I -c 'import json,sys; json.load(open(sys.argv[1]))' "$T/w.json" 2> /dev/null || badj=$((badj + 1))
43 grep -q "href='https://doi.org/" "$T/w.html" || miss=$((miss + 1))
44 [ -s research/registry/text/$s.txt ] || miss=$((miss + 1))
45 n=$((n + 1))
46 done < "$T/slugs"
47 is "$badj $miss" "0 0" "every work builds its page, JSON and BibTeX, links its DOI and has full text ($n works)"
48 is "$(cat "$T/index.html" "$T/w.html" | grep -c -i -E ' "q" \\ end\n'
60 printf 'S\tevil\tSummary & \nA\tevil\tAbstract