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/collab/tests/check.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 / collab / tests / check.sh` 100 lines · 7011 bytes Raw Blame History 1 #!/bin/bash 2 # collab/tests/check.sh [base-url]: HOST gates for the patches and issues pages of forged. 3 # Every positive gate has a negative control. Default target: a test forged on 127.0.0.1:18486. 4 # ISSUES=1 also runs the issue gates against heartwood (only on a test build whose allow-list 5 # includes heartwood; the production allow-list does not). 6 U=${1:-http://127.0.0.1:18486} 7 O=/drakestapleton/omega-mv 8 S=$HOME/.radicle/storage/z6do9WDBhuSnvopDkgFdFr1yWA62 9 T=$(mktemp -d) 10 trap 'rm -rf "$T"' EXIT 11 pass=0 12 fail=0 13 ok() { pass=$((pass+1)); echo "PASS $*"; } 14 no() { fail=$((fail+1)); echo "FAIL $*"; } 15 # get BASE PATH [METHOD] -> $T/b body, $T/h headers, $code. forged adds translation hints while it sends an 16 # HTML page (server/tr.om); the checks read HTML bodies without them (server/tests/translate.sh gates them) 17 get() { 18 code=$(curl -s -o "$T/b" -D "$T/h" -w '%{http_code}' -X "${3:-GET}" -H "X-Forge-Base: $1" "$U$2") 19 grep -qi '^content-type: text/html' "$T/h" && sed -i 's/\([^<]*\)<\/span>/\1/g; s/ translate="no"//g' "$T/b" 20 return 0 21 } 22 has() { grep -qF -- "$1" "$T/b"; } 23 # Expected patch counts come from the Radicle CLI reading the same storage (oracle, not forged code): 24 # rows of `rad patch list --merged` / `--open` (7-hex id column). The lists change as patches land, so 25 # they are read right before the pages; a list page shows at most 200 COBs. 26 radn() { rad patch list --repo rad:z6do9WDBhuSnvopDkgFdFr1yWA62 "--$1" 2> /dev/null | grep -cE '^│ [^ ]+ [0-9a-f]{7} '; } 27 M=$(radn merged); OP=$(radn open) 28 echo "oracle: rad patch list omega-mv: merged $M, open $OP" 29 [ "$M" -ge 4 ] && [ "$M" -le 200 ] && [ "$OP" -le 200 ] || { no "oracle: rad patch list gave merged '$M' open '$OP'"; } 30 for B in / /forge/; do 31 P=${B%/} 32 get $B "$O/patches/`4dd099df`" 33 [ "$code" = 200 ] && has 'Merged' && has 'VERDICT MERGE head=`215ea39afdc0cf1914cfadf43bbb6d23ce68c920`' \ 34 && has 'Linked verdicts' && has "href=\"$P$O/patches/`4dd099df31792d5ddb0d9fac5ca6d568513f4539`.diff" \ 35 && ok "[$B] `4dd099df` merged with verdict `215ea39a`" || no "[$B] `4dd099df` ($code)" 36 get $B "$O/patches/`88050ef7d710cb43d65214ff50bb1a0882770bb9`" 37 [ "$code" = 200 ] && has 'Merged' && has 'VERDICT MERGE head=`3743d642cf034299009936eb8d458ba96a0a8589`' \ 38 && ok "[$B] `88050ef7` merged with verdict `3743d642`" || no "[$B] `88050ef7` ($code)" 39 # negative control: a merged patch without a verdict file shows no verdict box 40 get $B "$O/patches/`35e5e0f7`" 41 [ "$code" = 200 ] && has 'Merged' && has 'No review verdict names a head' && ! has 'VERDICT' && ! has '<head sha8>.verdict.txt' && ! has 'review folder' && ok "[$B] `35e5e0f7` merged, no verdict (control)" || no "[$B] `35e5e0f7` control ($code)" 42 for bad in deadbeef 4dd 4DD099DF zz "`4dd099df`/x" "4dd099dfz"; do 43 get $B "$O/patches/$bad" 44 [ "$code" = 404 ] && ok "[$B] patches/$bad -> 404" || no "[$B] patches/$bad -> $code" 45 done 46 get $B "$O/patches" 47 [ "$code" = 200 ] && has "Merged ($M)" && has "Open ($OP)" && ok "[$B] list counts equal rad (Merged $M, Open $OP)" || no "[$B] list ($code; want Merged ($M) Open ($OP))" 48 get $B "$O/patches?state=merged" 49 n=$(grep -c '
  • 302 $loc" || no "[$B] /pulls/ ($code $loc)" 60 get $B "$O/pull/`88050ef7`" 61 loc=$(grep -i '^location:' "$T/h" | tr -d '\r' | cut -d' ' -f2) 62 [ "$code" = 302 ] && [ "$loc" = "$P$O/patches/`88050ef7`" ] && ok "[$B] /pull/ 302" || no "[$B] /pull/ ($code $loc)" 63 get $B "$O/patches/`4dd099df`" POST 64 [ "$code" = 405 ] && ok "[$B] POST -> 405" || no "[$B] POST -> $code" 65 get $B "$O/issues" 66 [ "$code" = 200 ] && has 'Open (0)' && ok "[$B] issues list (no issues in omega-mv)" || no "[$B] issues ($code)" 67 get $B "$O/issues/deadbeef" 68 [ "$code" = 404 ] && ok "[$B] issues/deadbeef -> 404" || no "[$B] issues/deadbeef -> $code" 69 # allow-list gates: only meaningful on the production allow-list (skipped on the ISSUES test build) 70 if [ "${ISSUES:-0}" != 1 ]; then 71 get $B "/drakestapleton/heartwood/patches" 72 [ "$code" = 404 ] && ok "[$B] non-allow-listed heartwood -> 404" || no "[$B] heartwood -> $code" 73 get $B "/drakestapleton/aien-sovereign-core-mv/patches/`f75aeaa5`" 74 [ "$code" = 200 ] && has 'Merged' && ok "[$B] core `f75aeaa5` renders" || no "[$B] core `f75aeaa5` ($code)" 75 fi 76 done 77 # raw diff: byte-identical to git diff --full-index (`88050ef7`: about 21 MB). Abbreviation length is not stable. 78 code=$(curl -s -o "$T/d" -w '%{http_code} %{content_type}' -H 'X-Forge-Base: /' "$U$O/patches/`88050ef7`.diff") 79 git --git-dir="$S" diff --full-index --no-color --no-ext-diff -M `943d9555d0a1a2c6e5bcac9e1b6a54b4b4b26cfa` `3743d642cf034299009936eb8d458ba96a0a8589` -- > "$T/g" 2>/dev/null \ 80 || git --git-dir="$S" diff --full-index --no-color --no-ext-diff -M "$(git --git-dir="$S" rev-parse `943d9555`)" `3743d642cf034299009936eb8d458ba96a0a8589` -- > "$T/g" 81 [ "${code%% *}" = 200 ] && cmp -s "$T/d" "$T/g" && ok "raw diff `88050ef7` identical to git diff ($(wc -c < "$T/d") bytes, $code)" \ 82 || no "raw diff `88050ef7` ($code, $(wc -c < "$T/d") vs $(wc -c < "$T/g"))" 83 code=$(curl -s -o "$T/d" -w '%{http_code}' -H 'X-Forge-Base: /' "$U$O/patches/deadbeef.diff") 84 [ "$code" = 404 ] && ok "raw diff of unknown id -> 404" || no "raw diff deadbeef -> $code" 85 if [ "${ISSUES:-0}" = 1 ]; then 86 H=/drakestapleton/heartwood 87 get / "$H/issues?state=all" 88 n=$(grep -c '