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.io/blob/main/scripts/tests/check-site.sh # interplane.io Source of interplane.io: a Rust generator that renders the page from the protocol repository's public record, deployed hourly from the Spark. 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.io / scripts / tests / check-site.sh` 884 lines ยท 82011 bytes Raw Blame History 1 #!/bin/sh 2 # Controls for the site builder. Shell glue only: every rule under test lives in native/site.om. 3 # Each control copies the tree, changes one thing, runs the builder and compares the exit status 4 # and the refusal text. The oracles are sha256sum and, when given, the forge's own chain tool. 5 # Usage: OMC=/path/to/omc sh scripts/tests/check-site.sh [CHAIN_BIN] 6 # Needs sha256sum, awk, jq, and curl (the verifier controls fetch through file://, never the network). 7 # bibtex, when installed, also reads papers.bib; without it that one check says NOT_RUN. 8 set -eu 9 ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd) 10 CHAIN=${1:-} 11 T=$(mktemp -d) 12 trap 'rm -rf "$T"' 0 13 trap 'exit 1' 1 2 15 14 sh "$ROOT/scripts/build-native.sh" "$T/site" 15 BIN=$T/site 16 printf 'builder sha256 %s\n' "$(sha256sum "$BIN" | cut -d' ' -f1)" 17 N=0 18 ok() { N=$((N + 1)); printf 'PASS control %02d: %s\n' "$N" "$1"; } 19 fail() { printf 'FAIL control: %s\n' "$1" >&2; exit 1; } 20 # Pin alarm: native/omc.sha256 must name the compiler at omega-mv main. Run scripts/pin-omc.sh to move it. 21 # pinwant REPO: the compiler sha256 at REPO main. pinstale REPO: true when native/omc.sha256 differs from it. 22 pinwant() { git -C "$1" show main:seed/out/omc.sha256 | cut -d' ' -f1; } 23 pinstale() { [ "$(pinwant "$1")" != "$(head -1 "$ROOT/native/omc.sha256" | cut -d' ' -f1)" ]; } 24 OMEGA_GIT=${OMEGA_GIT:-$HOME/git/omega-mv.git} 25 if [ -d "$OMEGA_GIT" ]; then 26 HAVE=$(head -1 "$ROOT/native/omc.sha256" | cut -d' ' -f1) 27 ! pinstale "$OMEGA_GIT" || fail "compiler pin is stale: native/omc.sha256 has $HAVE, $OMEGA_GIT main:seed/out/omc.sha256 has $(pinwant "$OMEGA_GIT"); run sh scripts/pin-omc.sh" 28 ok "compiler pin matches omega-mv main ($HAVE)" 29 else 30 printf 'NOT_RUN pin alarm: no omega-mv repository at %s\n' "$OMEGA_GIT" 31 fi 32 # Negative control for the alarm: an omega-mv whose main names another compiler is caught. 33 git init -q -b main "$T/stale-omega" 34 mkdir -p "$T/stale-omega/seed/out" 35 printf '%064d seed/out/omc\n' 0 > "$T/stale-omega/seed/out/omc.sha256" 36 git -C "$T/stale-omega" add seed/out/omc.sha256 37 git -C "$T/stale-omega" -c user.name=check -c user.email=check@localhost commit -qm stale 38 pinstale "$T/stale-omega" || fail 'pin alarm accepted an omega-mv main that names another compiler' 39 ok 'pin alarm: an omega-mv main naming another compiler is reported stale' 40 # realtree NAME: a copy of the committed tree as it is, with whatever release data it carries. 41 realtree() { rm -rf "$T/$1" "$T/$1.out" "$T/$1.hop"; mkdir "$T/$1"; cp -R "$ROOT/content" "$ROOT/public" "$T/$1/"; } 42 # tree NAME: the same copy without the optional release data (Hop release, installer, receipts), so 43 # every control starts from the same tree whether or not the commit carries a real release. 44 tree() { 45 realtree "$1"; rm -rf "$T/$1/content/receipts" "$T/$1/content/hop.release.txt" "$T/$1/content/hop.install.sh" 46 } 47 # fixtures NAME: the made-up release data, replacing any that is there. 48 fixtures() { 49 rm -rf "$T/$1/content/receipts" 50 cp "$ROOT/tests/fixtures/hop.release.txt" "$T/$1/content/hop.release.txt" 51 cp "$ROOT/tests/fixtures/hop.install.sh" "$T/$1/content/hop.install.sh" 52 cp -R "$ROOT/tests/fixtures/receipts" "$T/$1/content/receipts" 53 } 54 # MODE is empty for a release build and --test-data for the only mode that accepts the fixtures. 55 MODE= 56 sub() { f=$1; shift; sed "$@" "$f" > "$f.new"; mv "$f.new" "$f"; } 57 build() { RC=0; (cd "$T/$1" && "$BIN" build $MODE "$T/$1.out" "$T/$1.hop" > "$T/$1.log" 2> "$T/$1.err") || RC=$?; } 58 # vrun TREE OUT HOP: site verify, run from the source tree TREE, of the output directories given 59 vrun() { VRC=0; (cd "$T/$1" && "$BIN" verify $MODE "$T/$2" "$T/$3" > "$T/v.log" 2> "$T/v.err") || VRC=$?; } 60 vrefused() { 61 vrun "$2" "$3" "$4" 62 [ "$VRC" -eq 1 ] || { cat "$T/v.log" >&2; fail "$1: verify gave $VRC, expected 1"; } 63 grep -q -- "$5" "$T/v.err" || { cat "$T/v.err" >&2; fail "$1: verify refusal lacks: $5"; } 64 ok "verify refuses $1, exit 1" 65 } 66 sha() { sha256sum | cut -d' ' -f1; } 67 passes() { 68 build "$2" 69 [ "$RC" -eq 0 ] || { cat "$T/$2.err" >&2; fail "$1: expected exit 0, got $RC"; } 70 } 71 # refused NAME TREE TEXT [late]: exit 1, the refusal names the rule, and (unless the rule can only 72 # be checked on written output) no output directory exists. 73 refused() { 74 build "$2" 75 [ "$RC" -eq 1 ] || fail "$1: expected exit 1, got $RC" 76 grep -q -- "$3" "$T/$2.err" || { cat "$T/$2.err" >&2; fail "$1: refusal text lacks: $3"; } 77 if [ "${4:-}" != late ]; then 78 [ ! -e "$T/$2.out" ] || fail "$1: a refused build left an output directory" 79 fi 80 ok "$1 refused, exit $RC" 81 } 82 add() { printf '%s\n' "$2" >> "$T/$1/content/mission/index.html"; } 83 84 # ---- accepted builds 85 tree base 86 passes baseline base 87 grep -q 'hop: content/hop.release.txt is absent' "$T/base.log" || fail 'baseline does not say Hop is omitted' 88 grep -q 'receipts: content/receipts/ledger.tsv is absent' "$T/base.log" || fail 'baseline does not say receipts are omitted' 89 [ ! -e "$T/base.hop" ] && [ ! -e "$T/base.out/hop" ] && [ ! -e "$T/base.out/receipts" ] || fail 'optional output exists without its data' 90 if grep -q -e 'href="/receipts/' -e 'href="/hop/' "$T/base.out/index.html"; then fail 'home links to an omitted page'; fi 91 (cd "$T/base.out" && sha256sum -c --quiet manifest.sha256) || fail 'sha256sum disagrees with the manifest' 92 PAGES=$(find "$T/base.out" -name index.html | wc -l | tr -d ' ') 93 LOCS=$(grep -c '' "$T/base.out/sitemap.xml") 94 LISTED=$(grep -c '^- \[' "$T/base.out/llms.txt") 95 # The sitemap also lists the two data files of the papers page (llms.txt names them under Data) and 96 # each forge route of content/routes.txt, a page the forge serves, for which nothing is built. 97 FORGES=$(grep -c '^forge main ' "$T/base/content/routes.txt") 98 [ "$FORGES" -ge 2 ] || fail "routes.txt declares $FORGES forge routes; /explore and /drakestapleton/omega-mv are expected" 99 [ "$LOCS" -eq $((PAGES + 2 + FORGES)) ] && [ "$PAGES" -eq "$LISTED" ] || fail "page counts differ: files $PAGES, sitemap $LOCS (pages plus 2 data files plus $FORGES forge routes), llms.txt $LISTED" 100 grep -q "pages $PAGES files" "$T/base.log" || fail 'builder page count differs from the files written' 101 [ ! -e "$T/base.out/TEST-DATA" ] || fail 'a release build wrote a TEST-DATA file' 102 if grep -rq -e 'data-test-data' -e 'TEST DATA' "$T/base.out"; then fail 'a release build carries the test-data banner'; fi 103 ok "baseline release build without optional data: $PAGES pages (files, sitemap and llms.txt agree), Hop and receipts omitted and said so, no test-data mark, sha256sum -c passes" 104 BASEMAN=$(sha256sum "$T/base.out/manifest.sha256" | cut -d' ' -f1) 105 tree base2 106 passes repeat base2 107 cmp "$T/base.out/manifest.sha256" "$T/base2.out/manifest.sha256" || fail 'two builds differ' 108 ok "two builds from separate copies are identical: manifest sha256 $BASEMAN" 109 110 # ---- task prompts share their source in the catalog, the contextual page and the raw route 111 PROMPTS=/agents/prompts 112 grep -Fq "https://interplane.io$PROMPTS.txt" "$T/base.out/llms.txt" || fail 'agent guide omits prompt discovery' 113 cmp "$ROOT/content$PROMPTS.txt" "$T/base.out$PROMPTS.txt" || fail 'prompt index differs from source' 114 for entry in find-project:yard clone-project:forge verify-evidence:evidence prepare-contribution:contribute try-omega:omega write-omega:omega/write understand-interplane:omega; do 115 slug=${entry%:*} 116 route=$PROMPTS/$slug.txt 117 cmp "$ROOT/content$route" "$T/base.out$route" || fail "$slug plain text differs from source" 118 for page in agents "${entry#*:}"; do 119 card=$(sed -n "/id=\"prompt-$slug\"/,/<\/details>/p" "$T/base.out/$page/index.html") 120 printf '%s\n' "$card" | grep -Fxq "
$(cat "$T/base.out$route")
" || fail "$slug on /$page/ differs from plain text" 121 printf '%s\n' "$card" | grep -Fq "href=\"$route\"" || fail "$slug on /$page/ links to the wrong prompt" 122 done 123 grep -Fq "https://interplane.io$route" "$T/base.out$PROMPTS.txt" || fail "$slug missing from prompt index" 124 done 125 ok 'agent prompt index and raw text agree with the catalog and contextual pages' 126 tree c; printf '%s\n' 'Try {{title}}.' > "$T/c/content$PROMPTS/find-project.txt" 127 refused 'agent prompt with a template directive' c 'agent prompt must be one nonempty line of plain text' 128 tree c; printf '%s\n' 'Try this.' > "$T/c/content$PROMPTS/find-project.txt" 129 refused 'agent prompt with markup' c 'agent prompt must be one nonempty line of plain text' 130 tree c; printf '%s' 'Find a project.' > "$T/c/content$PROMPTS/find-project.txt" 131 refused 'agent prompt without a final line feed' c 'agent prompt must be one nonempty line of plain text' 132 tree c; printf '%s\n' 'Find a project.' 'Return its address.' > "$T/c/content$PROMPTS/find-project.txt" 133 refused 'agent prompt with a second line' c 'agent prompt must be one nonempty line of plain text' 134 135 # The lesson's displayed source must agree with the locally downloadable example. 136 O=$T/base.out/omega 137 cmp "$ROOT/content/omega/tools.txt" "$O/tools.txt" || fail 'Omega tool index differs from source' 138 grep -Fq 'https://interplane.io/omega/tools.txt' "$T/base.out/llms.txt" || fail 'agent guide omits the Omega tool index' 139 sed -n '/id="sum-source"/,/<\/code>/p' "$O/write/index.html" | 140 sed -e '1s/^.*id="sum-source">//' -e '$s/<\/code><\/pre>.*$//' > "$T/omega-displayed.om" 141 cmp "$T/omega-displayed.om" "$O/examples/sum.om" || fail 'Omega lesson and download differ' 142 ok 'Omega tool discovery and lesson source agree with the built downloads' 143 144 # ---- the papers page, from content/papers.snapshot only 145 P=$T/base.out/papers 146 SN=$ROOT/content/papers.snapshot 147 NREC=$(grep -c '^record ' "$SN") 148 [ "$(sed -n 's/^records //p' "$SN")" -eq "$NREC" ] || fail 'the committed snapshot does not hold as many records as it says' 149 grep -q "papers: records $NREC sources " "$T/base.log" || fail 'the build does not report the papers it read' 150 [ "$(grep -c '
  • ' "$P/index.html")" -eq "$NREC" ] || fail 'the papers page does not show one entry per record' 151 [ "$(grep -o '>Version history, 10\.5281/zenodo\.[0-9]*' "$P/index.html" | sort -u | wc -l | tr -d ' ')" -eq "$NREC" ] || fail 'the version history link is not on every entry once, each with its own concept DOI as its name' 152 grep -o 'href="https://doi.org/10.5281/zenodo.[0-9]*">DOI' "$P/index.html" | sed 's|.*zenodo\.\([0-9]*\)".*|\1|' > "$T/doi.page" 153 sed -n 's|^record 10.5281/zenodo.||p' "$SN" > "$T/doi.snap" 154 cmp "$T/doi.page" "$T/doi.snap" || fail 'the DOIs on the page are not the snapshot records in snapshot order' 155 sed -n 's/^date //p' "$SN" > "$T/dates"; sort -r "$T/dates" | cmp - "$T/dates" || fail 'the snapshot is not newest first' 156 grep -q 'href="https://orcid.org/0009-0002-6890-7111"' "$P/index.html" && grep -q 'Source on Interplane for 10\.5281/zenodo\.[0-9]*' "$P/index.html" | sort -u | wc -l | tr -d ' ')" -eq "$SRCN" ] || fail 'Source on Interplane links differ from content/papers.sources, or two share a name' 162 jq -e --argjson n "$NREC" '.count == $n and (.papers | length) == $n and ([.papers[].doi | test("^10\\.5281/zenodo\\.[0-9]+$")] | all)' "$P/papers.json" > /dev/null || fail 'papers.json is not valid JSON with one DOI-shaped entry per record' 163 OMEGA=$(jq -r '.papers[] | select(.title | startswith("The \u03a9-Framework")) | .doi' "$P/papers.json") 164 [ -n "$OMEGA" ] || fail 'papers.json does not decode the escaped Omega' 165 [ "$(grep -c '^@misc{zenodo[0-9]*,$' "$P/papers.bib")" -eq "$NREC" ] || fail 'papers.bib does not hold one entry per record' 166 if command -v bibtex > /dev/null 2>&1; then 167 mkdir "$T/bib"; cp "$P/papers.bib" "$T/bib/" 168 printf '\\citation{*}\n\\bibdata{papers}\n\\bibstyle{plain}\n' > "$T/bib/t.aux" 169 (cd "$T/bib" && bibtex t > bt.log 2>&1) || { cat "$T/bib/bt.log" >&2; fail 'bibtex rejects papers.bib'; } 170 if grep -q -e 'Warning' -e 'error' "$T/bib/bt.log"; then cat "$T/bib/bt.log" >&2; fail 'bibtex warns on papers.bib'; fi 171 [ "$(grep -c '^\\bibitem' "$T/bib/t.bbl")" -eq "$NREC" ] || fail 'bibtex does not read every entry of papers.bib' 172 BIBNOTE="bibtex reads $NREC entries without a warning" 173 else 174 BIBNOTE='bibtex NOT_RUN (not installed)' 175 fi 176 for u in papers/ papers/papers.json papers/papers.bib; do 177 grep -q "https://interplane.io/$u" "$T/base.out/sitemap.xml" || fail "sitemap.xml lacks $u" 178 done 179 grep -q '^- .*: https://interplane.io/papers/papers.json$' "$T/base.out/llms.txt" && grep -q '^- .*: https://interplane.io/papers/papers.bib$' "$T/base.out/llms.txt" || fail 'llms.txt does not list the papers data files' 180 for f in $(find "$T/base.out" -name index.html); do 181 grep -q 'MissionPapers' "$f" || fail "footer lacks the Papers link: $f" 182 done 183 grep -q 'papers page' "$T/base.out/mission/index.html" || fail 'the mission page does not link the papers page' 184 for f in lmroman10-regular.otf lmroman10-italic.otf lmroman10-bold.otf GUST-FONT-LICENSE.txt; do 185 cmp "$ROOT/public/fonts/$f" "$T/base.out/public/fonts/$f" || fail "font file not copied unchanged: $f" 186 done 187 ok "papers page: $NREC entries newest first in snapshot order, one all-versions link each, $SRCN source links, ORCID link and mark, dated; papers.json valid ($NREC entries); $BIBNOTE; sitemap, llms.txt, footer and mission link; fonts copied unchanged" 188 FX=$ROOT/tests/fixtures/zenodo 189 [ "$(sha256sum < "$FX/response-1.json" | cut -d' ' -f1)" = "$(sed -n 's/^response 1 sha256://p' "$SN")" ] || fail 'the saved Zenodo response is not the one the snapshot names' 190 FETCHED=$(sed -n 's/^fetched //p' "$SN") sh "$ROOT/scripts/fetch-papers.sh" --replay "$FX" "$T/replay.snapshot" > /dev/null 2> "$T/replay.err" || { cat "$T/replay.err" >&2; fail 'fetch-papers.sh replay failed'; } 191 cmp "$SN" "$T/replay.snapshot" || fail 'replaying the saved response does not give the committed snapshot' 192 mkdir "$T/fx"; awk '{sub(/"Preprint"/,"\"Prepr1nt\"")}{print}' "$FX/response-1.json" > "$T/fx/response-1.json" 193 FETCHED=$(sed -n 's/^fetched //p' "$SN") sh "$ROOT/scripts/fetch-papers.sh" --replay "$T/fx" "$T/replay2.snapshot" > /dev/null 2>&1 || fail 'fetch-papers.sh replay of the altered response failed' 194 if cmp -s "$SN" "$T/replay2.snapshot"; then fail 'an altered response gave the same snapshot'; fi 195 grep -q '^response 1 sha256:' "$T/replay2.snapshot" || fail 'the altered replay has no response fingerprint' 196 if grep -q "$(sed -n 's/^response 1 //p' "$SN")" "$T/replay2.snapshot"; then fail 'an altered response kept the old response fingerprint'; fi 197 ok 'fetch-papers.sh replays tests/fixtures/zenodo (sha256 as the snapshot names it) to the committed snapshot byte for byte; one altered word gives a different snapshot and fingerprint' 198 199 tree rel; fixtures rel 200 refused 'the committed fixtures in a release build (no flag)' rel 'release mode refuses made-up data' 201 MODE=--test-data 202 tree full; fixtures full 203 passes fixtures full 204 [ -f "$T/full.out/TEST-DATA" ] && [ -f "$T/full.hop/TEST-DATA" ] || fail 'test-data build lacks the TEST-DATA file in an output root' 205 grep -q ' TEST-DATA$' "$T/full.out/manifest.sha256" && grep -q ' TEST-DATA$' "$T/full.hop/manifest.sha256" || fail 'TEST-DATA is not in the manifest' 206 for f in $(find "$T/full.out" "$T/full.hop" -name index.html); do 207 grep -q 'class="test-banner data-test-data">TEST DATA' "$f" || fail "test-data page without the banner: $f" 208 done 209 grep -q 'hop copy: not compared with the release commit in TEST DATA mode' "$T/full.log" || fail 'the test-data build does not say that the Hop copy pin was not compared' 210 vrun full full.out full.hop; [ "$VRC" -eq 0 ] || { cat "$T/v.err" >&2; fail 'verify --test-data of an untouched fixture build failed'; } 211 MODE=; vrun full full.out full.hop; MODE=--test-data 212 [ "$VRC" -eq 1 ] || fail 'a release-mode verify accepted test-data output' 213 ok 'test-data build: TEST DATA banner on every page, TEST-DATA file in both roots and manifests; release-mode verify refuses that output' 214 (cd "$T/full.out" && sha256sum -c --quiet manifest.sha256) || fail 'sha256sum disagrees with the manifest (fixtures)' 215 (cd "$T/full.hop" && sha256sum -c --quiet manifest.sha256) || fail 'sha256sum disagrees with the hopbot manifest' 216 FP=$(find "$T/full.out" -name index.html | wc -l | tr -d ' ') 217 HP=$(find "$T/full.hop" -name index.html | wc -l | tr -d ' ') 218 [ "$FP" -eq $((PAGES + 2)) ] && [ "$HP" -eq 2 ] || fail "fixture page counts: $FP and $HP" 219 for f in "$T/full.out/hop/index.html" "$T/full.hop/index.html"; do 220 grep -q 'Hop as your checker' "$f" || fail "Hop page lacks badge, limits box or the being-built label: $f" 221 grep -q 'Factory is hidden until you give it an address' "$f" && grep -q 'no other machine is set by default' "$f" && grep -q 'called Cortex, is off by default and has no address until you give it one' "$f" && grep -q "macOS downloads Apple's speech model from Apple" "$f" || fail "Hop page lacks the sentences about its defaults: $f" 222 grep -q 'at commit `0000000000000000000000000000000000000000`, which is version 0.0.0-fixture' "$f" || fail "Hop page does not build its version sentence from the release data: $f" 223 if grep -q -i -e 'entirely on your Mac' -e 'to nobody else' "$f"; then fail "Hop page repeats the retracted privacy claim: $f"; fi 224 if grep -q 'gave the same file' "$f"; then fail 'Hop page claims a byte-for-byte reproduction the data does not state'; fi 225 done 226 grep -q "Verify this page's claims yourself" "$T/full.out/index.html" && grep -q "Verify this page's claims yourself" "$T/full.out/receipts/index.html" || fail 'the verify hook is missing from home or receipts' 227 if grep -rq -i -e '30 seconds' -e 'under a minute' -e 'three commands' "$T/full.out" "$T/full.hop"; then fail 'a page still promises a time nobody measured, or the three-command check'; fi 228 grep -q 'href="/receipts/#r1"' "$T/full.out/hop/index.html" && grep -q 'href="https://interplane.io/receipts/#r2"' "$T/full.hop/index.html" || fail 'receipt links missing on the Hop pages' 229 cmp "$ROOT/tests/fixtures/receipts/ledger.tsv" "$T/full.out/receipts/ledger.tsv" || fail 'ledger was not copied unchanged' 230 HEAD=$(printf %s "$(tail -n 1 "$T/full.out/receipts/ledger.tsv")" | sha256sum | cut -d' ' -f1) 231 grep -q "id=\"head\">$HEAD<" "$T/full.out/receipts/index.html" || fail 'head on the receipts page differs from sha256sum of the last line' 232 for p in "$T/full.out/receipts/payload/"*.txt; do 233 [ "$(sha256sum < "$p" | cut -d' ' -f1).txt" = "$(basename "$p")" ] || fail "payload name differs from its sha256: $p" 234 done 235 if [ -n "$CHAIN" ]; then 236 [ "$("$CHAIN" verify "$ROOT/tests/fixtures/receipts/ledger.tsv")" = "$(printf 'OK\t3\t%s' "$HEAD")" ] || fail 'forge chain tool disagrees on the valid ledger' 237 CHAINNOTE='forge chain tool prints the same OK 3 and head' 238 else 239 CHAINNOTE='forge chain tool NOT_RUN (no binary given)' 240 fi 241 ok "fixtures: $FP pages plus hopbot.org $HP page; 3-record ledger accepted, head $HEAD equals sha256sum; $CHAINNOTE" 242 243 tree hv; fixtures hv 244 sub "$T/hv/content/hop.release.txt" -e 's/^hop_verify no$/hop_verify yes/' -e 's/^reproducible no$/reproducible yes/' 245 passes hop-flags hv 246 grep -q 'In this version' "$T/hv.out/hop/index.html" && ! grep -q 'Being builtHop as your checker' "$T/hv.out/hop/index.html" && grep -q 'gave the same file' "$T/hv.out/hop/index.html" || fail 'hop_verify or reproducible yes not reflected' 247 ok 'hop_verify yes and reproducible yes change the wording; no leaves "Being built" and no reproduction claim' 248 249 # ---- release mode: made-up data is refused, and the badge needs receipts that hold the same values 250 MODE= 251 CM=$(printf 'control commit' | sha | cut -c1-40) 252 ZS=$(printf 'control zip' | sha) 253 ES=$(printf 'control program' | sha) 254 realhop() { 255 cat > "$T/$1/content/hop.release.txt" < "$T/$1/content/hop.copy.txt" 271 } 272 # realledger TREE V1 V2 V3: a chained three-record ledger whose evidence files hold the three values 273 realledger() { 274 d=$T/$1/content/receipts; rm -rf "$d"; mkdir -p "$d/payload"; prev=GENESIS; k=0; : > "$d/ledger.tsv" 275 for v in "$2" "$3" "$4"; do 276 k=$((k + 1)) 277 case $k in 1) kind=SOURCE ;; 2) kind=DOWNLOAD ;; *) kind=BUILD ;; esac 278 printf 'control evidence %s\nvalue: %s\nexit: 0\n' "$k" "$v" > "$d/p" 279 h=$(sha < "$d/p"); mv "$d/p" "$d/payload/$h.txt" 280 line=$(printf '%s\t2026-11-01T00:00:0%sZ\t%s\tcontrol-desk\tcontrol record %s\t%s\t%s' "$k" "$k" "$kind" "$k" "$h" "$prev") 281 printf '%s\n' "$line" >> "$d/ledger.tsv" 282 prev=$(printf '%s' "$line" | sha) 283 done 284 printf '%s\n' "$prev" > "$d/head.txt" 285 printf 'receipt_seqs 1 2 3\n' >> "$T/$1/content/hop.release.txt" 286 } 287 count() { grep -o -- "$1" "$2" | wc -l | tr -d ' '; } 288 289 tree rl; realhop rl 290 passes 'release data without receipts' rl 291 f=$T/rl.out/hop/index.html 292 grep -q '

    Not verified yet

    ' "$f" && [ "$(count 'No receipt.' "$f")" -eq 3 ] || fail 'release data without receipts is not shown as unverified' 293 if grep -q -e '' "$f"; then fail 'the badge is shown without receipts'; fi 294 grep -q 'badge: rows backed by a receipt that holds the same value: 0 of 3' "$T/rl.log" || fail 'the build does not report 0 of 3 rows' 295 [ ! -e "$T/rl.out/TEST-DATA" ] && [ ! -e "$T/rl.hop/install.sh" ] || fail 'a release build wrote TEST-DATA or an installer it was not given' 296 if grep -q -F -e 'id="install"' -e 'install.sh' "$f" "$T/rl.hop/index.html"; then fail 'the terminal install section is shown without the installer input'; fi 297 ok 'release data without receipts: values shown as stated, three rows say No receipt, no badge, no installer section or file' 298 299 tree rl; realhop rl; realledger rl "$CM" "$ZS" "$ES" 300 passes 'release data with receipts that hold the values' rl 301 f=$T/rl.out/hop/index.html 302 grep -q 'Verified by Interplane' "$f" && grep -q '' "$f" && [ "$(count 'No receipt.' "$f")" -eq 0 ] || fail 'the badge is not shown although three receipts hold the values' 303 grep -q 'badge: rows backed by a receipt that holds the same value: 3 of 3' "$T/rl.log" || fail 'the build does not report 3 of 3 rows' 304 vrun rl rl.out rl.hop; [ "$VRC" -eq 0 ] || { cat "$T/v.err" >&2; fail 'verify of the release build with receipts failed'; } 305 ok 'release data with three receipts whose evidence holds the commit and both fingerprints: badge shown, verify passes' 306 307 tree rl; realhop rl; realledger rl "$CM" "$(printf 'another zip' | sha)" "$ES" 308 passes 'a receipt that lacks the value' rl 309 f=$T/rl.out/hop/index.html 310 grep -q 'value: 2 of 3' "$T/rl.log" && [ "$(count 'No receipt.' "$f")" -eq 1 ] && grep -q '

    Not verified yet

    ' "$f" || fail 'a row whose receipt lacks the value was counted as verified' 311 if grep -q '$CM, which is version 9.9.9" "$T/rl.out/hop/index.html" && grep -q 'hop copy: the page wording is pinned to the release commit' "$T/rl.log" || fail 'the version sentence is not built from the release data, or the pin was not compared' 317 if grep -q -e '0\.3\.0' -e '0\.2\.0' "$ROOT/content/hop/index.html"; then fail 'the Hop page source hard-codes a version'; fi 318 PIN=$(sed -n 's/^describes //p' "$ROOT/content/hop.copy.txt") 319 [ "${#PIN}" -eq 40 ] && [ "$(grep -c -v '^#' "$ROOT/content/hop.copy.txt")" -eq 1 ] || fail 'the committed content/hop.copy.txt is not one describes line' 320 grep -q "$PIN" "$ROOT/docs/CLAIMS.md" || fail 'docs/CLAIMS.md does not name the Hop commit that content/hop.copy.txt pins' 321 ok "Hop page: version and commit come from the release data; the committed pin $PIN is one line and docs/CLAIMS.md names it" 322 tree rl; realhop rl; cp "$ROOT/content/hop.copy.txt" "$T/rl/content/hop.copy.txt"; refused 'a Hop release whose commit is not the one the page wording describes' rl 'hop.copy.txt must hold' 323 tree rl; realhop rl; rm "$T/rl/content/hop.copy.txt"; refused 'a Hop release without content/hop.copy.txt' rl 'hop.copy.txt must hold' 324 tree rl; realhop rl; printf 'describes %s\ndescribes %s\n' "$CM" "$CM" > "$T/rl/content/hop.copy.txt"; refused 'content/hop.copy.txt with two lines' rl 'hop.copy.txt must hold' 325 tree rl; realhop rl; printf 'describes %s\n' "$(printf %s "$CM" | cut -c1-12)" > "$T/rl/content/hop.copy.txt"; refused 'content/hop.copy.txt with a short commit' rl 'hop.copy.txt must hold' 326 327 tree rl; realhop rl; sub "$T/rl/content/hop.release.txt" 's/^commit .*/commit `0000000000000000000000000000000000000000`/'; refused 'zero commit in a release build' rl 'release mode refuses made-up data' 328 tree rl; realhop rl; sub "$T/rl/content/hop.release.txt" 's/^zip_sha256 .*/zip_sha256 `1111111111111111111111111111111111111111111111111111111111111111`/'; refused 'repeated-digit fingerprint in a release build' rl 'release mode refuses made-up data' 329 tree rl; realhop rl; sub "$T/rl/content/hop.release.txt" 's/^rid .*/rid rad:zFIXTUREnotArealProjectId000/'; refused 'fixture project ID in a release build' rl 'release mode refuses made-up data' 330 tree rl; realhop rl; sub "$T/rl/content/hop.release.txt" 's|^download_url .*|download_url https://example.org/Hop-9.9.9.zip|'; refused 'download address on an unknown host' rl 'release mode refuses made-up data' 331 tree rl; realhop rl; sub "$T/rl/content/hop.release.txt" 's|^download_url https|download_url http|'; refused 'download address that is not https' rl 'hop.release.txt' 332 tree rl; realhop rl; cp -R "$ROOT/tests/fixtures/receipts" "$T/rl/content/receipts"; refused 'the fixture ledger in a release build' rl 'release mode refuses made-up data' 333 334 # ---- the terminal installer: content/hop.install.sh, install_sha256 and install_base, all three or none 335 # The control installer holds the text that the content scan refuses everywhere else (a file:// address, 336 # a temporary-folder path), as the released one does. It prints its arguments instead of installing. 337 mkinst() { printf '#!/bin/sh\n# control installer: reads file:// addresses and works in ${TMPDIR:-/tmp}/hop-install\necho "control installer ran: $HOP_DOWNLOAD_BASE $*"\n' > "$1"; } 338 IBASE=https://interplane.io/drakestapleton/hop/releases/download/v9.9.9 339 tree in; realhop in; mkinst "$T/in/content/hop.install.sh" 340 IS=$(sha < "$T/in/content/hop.install.sh"); printf 'install_sha256 %s\ninstall_base %s\n' "$IS" "$IBASE" >> "$T/in/content/hop.release.txt" 341 cp "$T/in/content/hop.release.txt" "$T/in.release"; cp "$T/in/content/hop.install.sh" "$T/in.installer" 342 inst() { tree in; realhop in; cp "$T/in.release" "$T/in/content/hop.release.txt"; cp "$T/in.installer" "$T/in/content/hop.install.sh"; } 343 passes 'installer with a matching fingerprint' in 344 cmp "$T/in/content/hop.install.sh" "$T/in.hop/install.sh" || fail 'the installer was not copied unchanged to the hopbot.org output' 345 [ ! -e "$T/in.out/install.sh" ] || fail 'the installer was written to interplane.io' 346 grep -q 'the one file the content scan skips' "$T/in.log" || fail 'the build does not say that the installer was copied without the content scan' 347 CMD="curl -fsSL https://hopbot.org/install.sh -o install.sh && echo \"$IS install.sh\" | shasum -a 256 -c - && HOP_DOWNLOAD_BASE=$IBASE sh install.sh 9.9.9 $ZS" 348 for f in "$T/in.hop/index.html" "$T/in.out/hop/index.html"; do 349 grep -q "id=\"install-sha\">$IS<" "$f" && grep -q -F "
    $CMD
    " "$f" || fail "installer fingerprint or command missing: $f" 350 done 351 vrun in in.out in.hop; [ "$VRC" -eq 0 ] || { cat "$T/v.err" >&2; fail 'verify of the build with the installer failed'; } 352 ok "installer given with a matching install_sha256 and install_base: it holds text the scan refuses elsewhere, is copied byte for byte to hopbot.org as /install.sh, its fingerprint $IS and the one-line command are printed, verify passes" 353 354 # The line printed on the page is run as it is, with the hopbot.org address pointed at the built file. 355 command -v shasum > /dev/null 2>&1 || fail 'shasum is needed to run the printed install line' 356 LINE=$(sed -n 's/.*
    \(curl -fsSL https:\/\/hopbot\.org\/install\.sh .*\)<\/code><\/pre>.*/\1/p' "$T/in.hop/index.html" | sed 's/&/\&/g')
    
    357 [ -n "$LINE" ] || fail 'the install line could not be read from the page'
    
    358 rm -rf "$T/run"; mkdir "$T/run"
    
    359 LRC=0; LOUT=$(cd "$T/run" && sh -c "$(printf '%s' "$LINE" | sed "s|https://hopbot.org/install.sh|file://$T/in.hop/install.sh|")" 2>&1) || LRC=$?
    
    360 [ "$LRC" -eq 0 ] && printf '%s\n' "$LOUT" | grep -q '^install.sh: OK$' && printf '%s\n' "$LOUT" | grep -q "^control installer ran: $IBASE 9.9.9 $ZS\$" || fail "the printed install line gave $LRC: $LOUT"
    
    361 rm -rf "$T/run" "$T/served"; mkdir "$T/run" "$T/served"; { cat "$T/in.hop/install.sh"; echo 'echo tampered'; } > "$T/served/install.sh"
    
    362 LRC=0; LOUT=$(cd "$T/run" && sh -c "$(printf '%s' "$LINE" | sed "s|https://hopbot.org/install.sh|file://$T/served/install.sh|")" 2>&1) || LRC=$?
    
    363 [ "$LRC" -ne 0 ] || fail 'the printed install line ran an installer whose fingerprint differs'
    
    364 if printf '%s\n' "$LOUT" | grep -q -e 'control installer ran' -e tampered; then fail 'the printed install line ran a changed installer'; fi
    
    365 ok 'the install line printed on the page, run as printed against the built file: the fingerprint check passes and the installer gets the base, version and zip fingerprint; a changed installer is not run'
    
    366
    
    367 inst; sub "$T/in/content/hop.release.txt" -e '/^install_sha256 /d' -e '/^install_base /d'; refused 'installer file without its two keys' in 'install_base go together'
    
    368 inst; sub "$T/in/content/hop.release.txt" '/^install_base /d'; refused 'installer and install_sha256 without install_base' in 'install_base go together'
    
    369 inst; sub "$T/in/content/hop.release.txt" '/^install_sha256 /d'; refused 'installer and install_base without install_sha256' in 'install_base go together'
    
    370 inst; rm "$T/in/content/hop.install.sh"; refused 'install_sha256 and install_base without the installer file' in 'install_base go together'
    
    371 inst; echo 'echo changed' >> "$T/in/content/hop.install.sh"; refused 'installer whose fingerprint differs from install_sha256' in 'install_base go together'
    
    372 inst; sub "$T/in/content/hop.release.txt" -e 's/^zip_name .*/zip_name hop-9.9.9.zip/' -e 's|^download_url .*|download_url https://interplane.io/drakestapleton/hop/releases/download/v9.9.9/hop-9.9.9.zip|'; refused 'installer with a zip the installer would not fetch (zip_name is not Hop-VERSION.zip)' in 'Hop-VERSION.zip'
    
    373 inst; sub "$T/in/content/hop.release.txt" 's|^install_base .*|install_base https://example.org/releases|'; refused 'install_base on an unknown host in a release build' in 'release mode refuses made-up data'
    
    374
    
    375 # The scan is skipped for that one file on that one route, and for nothing else.
    
    376 inst; cp "$T/in.installer" "$T/in/content/other.sh"; printf 'raw hopbot /other.sh content/other.sh\n' >> "$T/in/content/routes.txt"
    
    377 refused 'a second file with the same text as the installer, on its own route' in 'private host name or path'
    
    378 inst; printf 'raw hopbot /copy.sh content/hop.install.sh install\n' >> "$T/in/content/routes.txt"
    
    379 refused 'the pinned installer itself on a second hopbot.org route' in 'private host name or path'
    
    380 inst; printf 'raw main /public/install.sh content/hop.install.sh install\n' >> "$T/in/content/routes.txt"
    
    381 refused 'the pinned installer itself on an interplane.io route' in 'private host name or path'
    
    382 inst; cp "$T/in.installer" "$T/in/content/other.sh"; sub "$T/in/content/routes.txt" 's|^raw hopbot /install.sh content/hop.install.sh install$|raw hopbot /install.sh content/other.sh install|'
    
    383 refused 'the installer route fed from another source file with the same bytes' in 'private host name or path'
    
    384 inst; passes 'installer again' in
    
    385 printf 'echo added\n' >> "$T/in.hop/install.sh"; NEW=$(sha < "$T/in.hop/install.sh"); awk -v h="$NEW" '{ if (substr($0, 67) == "install.sh") print h " install.sh"; else print }' "$T/in.hop/manifest.sha256" > "$T/in.hop/m" && mv "$T/in.hop/m" "$T/in.hop/manifest.sha256"
    
    386 vrefused 'an output installer changed with its manifest digest recomputed (it is scanned again, and refused)' in in.out in.hop 'private host name or path'
    
    387
    
    388 # ---- the published verifier walks the whole list (run against the test-data output through file://)
    
    389 command -v curl > /dev/null 2>&1 || fail 'curl is needed for the verifier controls'
    
    390 cmp "$ROOT/content/receipts-page/verify.sh" "$T/full.out/receipts/verify.sh" || fail 'the served verifier differs from its source'
    
    391 grep -q 'walk the whole Interplane receipts list' "$T/full.out/receipts/index.html" || fail 'the verifier is not printed on the receipts page'
    
    392 [ "$(cat "$ROOT/tests/fixtures/receipts/head.txt")" = "$HEAD" ] || fail 'the recorded head differs from the head of the list'
    
    393 VOUT=$(sh "$T/full.out/receipts/verify.sh" "file://$T/full.out/receipts") || fail 'the verifier failed on an untouched list'
    
    394 [ "$VOUT" = "$(printf 'records 3\nhead %s' "$HEAD")" ] || fail "the verifier printed: $VOUT"
    
    395 ok "published verifier on the untouched list: 3 records, head $HEAD, equal to the page and to head.txt"
    
    396 rm -rf "$T/tam"; cp -R "$T/full.out/receipts" "$T/tam"
    
    397 awk 'NR==1{sub(/source is public/,"source is Public")}{print}' "$T/tam/ledger.tsv" > "$T/tam/l" && mv "$T/tam/l" "$T/tam/ledger.tsv"
    
    398 cmp -s "$T/tam/ledger.tsv" "$T/full.out/receipts/ledger.tsv" && fail 'control is wrong: the first row did not change'
    
    399 [ "$(printf %s "$(tail -n 1 "$T/tam/ledger.tsv")" | sha)" = "$HEAD" ] || fail 'control is wrong: the last row changed'
    
    400 VRC=0; VOUT=$(sh "$T/full.out/receipts/verify.sh" "file://$T/tam") || VRC=$?
    
    401 [ "$VRC" -eq 1 ] && [ "$VOUT" = 'FAIL record 2: it does not carry the fingerprint of the record before it' ] || fail "first row changed: verifier gave $VRC: $VOUT"
    
    402 ok 'first row changed and last row kept: the last-row fingerprint still equals the head, and the verifier fails at record 2'
    
    403 rm -rf "$T/tam"; cp -R "$T/full.out/receipts" "$T/tam"; printf 'x' >> "$(ls "$T/tam/payload/"*.txt | head -n 1)"
    
    404 VRC=0; VOUT=$(sh "$T/full.out/receipts/verify.sh" "file://$T/tam") || VRC=$?
    
    405 [ "$VRC" -eq 1 ] && printf '%s' "$VOUT" | grep -q 'its evidence file does not match its fingerprint' || fail "evidence byte changed: verifier gave $VRC: $VOUT"
    
    406 ok 'one byte added to an evidence file: the verifier fails at that record'
    
    407 # A last line with no line feed must not be skipped (the reviewer's case: last record altered, final line feed removed).
    
    408 rm -rf "$T/tam"; cp -R "$T/full.out/receipts" "$T/tam"
    
    409 awk 'NR==3{sub(/built from commit/,"built from Commit")}{print}' "$T/tam/ledger.tsv" > "$T/tam/l" && printf %s "$(cat "$T/tam/l")" > "$T/tam/ledger.tsv"; rm "$T/tam/l"
    
    410 [ -n "$(tail -c 1 "$T/tam/ledger.tsv")" ] || fail 'control is wrong: the list still ends with a line feed'
    
    411 VRC=0; VOUT=$(sh "$T/full.out/receipts/verify.sh" "file://$T/tam") || VRC=$?
    
    412 [ "$VRC" -eq 1 ] && [ "$VOUT" = 'FAIL: the list does not end with a line feed' ] || fail "no final line feed: verifier gave $VRC: $VOUT"
    
    413 rm -rf "$T/tam"; cp -R "$T/full.out/receipts" "$T/tam"; printf %s "$(cat "$T/full.out/receipts/ledger.tsv")" > "$T/tam/ledger.tsv"
    
    414 VRC=0; VOUT=$(sh "$T/full.out/receipts/verify.sh" "file://$T/tam") || VRC=$?
    
    415 [ "$VRC" -eq 1 ] && [ "$VOUT" = 'FAIL: the list does not end with a line feed' ] || fail "untouched records, no final line feed: verifier gave $VRC: $VOUT"
    
    416 ok 'a list whose last line has no line feed (last record altered, or untouched): the verifier fails and reports no head'
    
    417
    
    418 # ---- verify accepts only the exact file set this source builds
    
    419 MODE=--test-data
    
    420 pcopy() { rm -rf "$T/p.out" "$T/p.hop"; cp -R "$T/full.out" "$T/p.out"; cp -R "$T/full.hop" "$T/p.hop"; }
    
    421 redigest() { NEW=$(sha < "$1/$2"); awk -v h="$NEW" -v p="$2" '{ if (substr($0, 67) == p) print h " " p; else print }' "$1/manifest.sha256" > "$1/m" && mv "$1/m" "$1/manifest.sha256"; }
    
    422 pcopy; mkdir "$T/p.out/extra"; printf 'x\n' > "$T/p.out/extra/index.html"
    
    423 vrefused 'an extra script-bearing page that the manifest does not list' full p.out p.hop 'output differs'
    
    424 pcopy; printf 'x\n' > "$T/p.hop/extra.txt"
    
    425 vrefused 'an extra file in the hopbot.org output' full p.out p.hop 'output differs'
    
    426 pcopy; rm "$T/p.out/robots.txt"; grep -v ' robots\.txt$' "$T/p.out/manifest.sha256" > "$T/p.out/m" && mv "$T/p.out/m" "$T/p.out/manifest.sha256"
    
    427 vrefused 'a file removed together with its manifest row' full p.out p.hop 'output differs'
    
    428 pcopy; awk 'NR==1{sub(/source is public/,"source is Public")}{print}' "$T/p.out/receipts/ledger.tsv" > "$T/p.out/l" && mv "$T/p.out/l" "$T/p.out/receipts/ledger.tsv"; redigest "$T/p.out" receipts/ledger.tsv
    
    429 (cd "$T/p.out" && sha256sum -c --quiet manifest.sha256) || fail 'control is wrong: the recomputed manifest does not check'
    
    430 vrefused 'an earlier ledger row altered with its manifest digest recomputed' full p.out p.hop 'ledger does not verify'
    
    431 pcopy; printf %s "$(cat "$T/p.out/receipts/ledger.tsv")" > "$T/p.out/l" && mv "$T/p.out/l" "$T/p.out/receipts/ledger.tsv"; redigest "$T/p.out" receipts/ledger.tsv
    
    432 vrefused 'an output ledger without its final line feed, manifest digest recomputed' full p.out p.hop 'ledger does not verify'
    
    433 pcopy; printf ' ' >> "$T/p.out/mission/index.html"; redigest "$T/p.out" mission/index.html
    
    434 vrefused 'a page changed with its manifest digest recomputed' full p.out p.hop 'output differs'
    
    435 pcopy; printf 'not a png\n' > "$T/p.hop/public/hop-screen.png"; redigest "$T/p.hop" public/hop-screen.png
    
    436 vrefused 'a png output that is not a PNG, manifest digest recomputed' full p.out p.hop 'a png route must hold a PNG file'
    
    437 pcopy; ln -s /dev/null "$T/p.out/link"
    
    438 vrefused 'a symbolic link in the output' full p.out p.hop 'output differs'
    
    439 MODE=
    
    440 rm -rf "$T/q.hop"; mkdir "$T/q.hop"
    
    441 vrefused 'a second-site directory when the source has no Hop data' base base.out q.hop 'output differs'
    
    442
    
    443 # ---- the map switch (content/live.txt): the forge serves the map, so its links are built only on map yes
    
    444 nomap() { if grep -rq -i -e 'galaxy' -e 'the map' -e 'a map' "$1"; then grep -rl -i -e 'galaxy' -e 'the map' -e 'a map' "$1" >&2; fail "$2: a built file still names the map"; fi; }
    
    445 grep -q '^map yes$' "$ROOT/content/live.txt" || fail 'this control expects the committed content/live.txt to say map yes (https://interplane.io/galaxy/ answers since 2026-11-10)'
    
    446 grep -q 'map: content/live.txt says map yes' "$T/base.log" || fail 'map yes (as committed): the build does not say so'
    
    447 mapno() { printf 'map no\n' > "$T/$1/content/live.txt"; }
    
    448 tree mno; mapno mno
    
    449 passes map-no mno
    
    450 MODE=--test-data; tree fno; fixtures fno; mapno fno; passes map-no-fixtures fno; MODE=
    
    451 grep -q 'map: content/live.txt does not say map yes' "$T/mno.log" || fail 'map no: the build does not say the map links are left out'
    
    452 nomap "$T/mno.out" 'map no'; nomap "$T/fno.out" 'map no (fixtures)'; nomap "$T/fno.hop" 'map no (hopbot)'
    
    453 grep -q '

    Two facts

    ' "$T/mno.out/forge/index.html" || fail 'map no: the forge page does not count two facts' 454 ok 'map no: no page, llms.txt or sitemap.xml names the map; the forge page counts two facts; the build says so' 455 tree mn; rm "$T/mn/content/live.txt" 456 passes map-absent mn 457 grep -q 'map: content/live.txt does not say map yes' "$T/mn.log" || fail 'missing live.txt: the build does not say the map links are left out' 458 cmp "$T/mno.out/manifest.sha256" "$T/mn.out/manifest.sha256" || fail 'missing live.txt does not build the same site as map no' 459 ok 'content/live.txt absent builds byte for byte the same site as map no' 460 tree my; printf 'map yes\n' > "$T/my/content/live.txt" 461 passes map-yes my 462 cmp "$T/base.out/manifest.sha256" "$T/my.out/manifest.sha256" || fail 'the committed tree does not build the same site as map yes' 463 grep -q 'map: content/live.txt says map yes' "$T/my.log" || fail 'map yes: the build does not say so' 464 grep -q 'href="https://interplane.io/galaxy/">Open the map

  • ' "$T/my.out/index.html" || fail 'map yes: home lacks the map fact' 465 [ "$(grep -o 'href="https://interplane.io/galaxy/">Open the map' "$T/my.out/forge/index.html" | wc -l | tr -d ' ')" -eq 2 ] || fail 'map yes: the forge page lacks its two map links' 466 grep -q '

    Three facts

    ' "$T/my.out/forge/index.html" || fail 'map yes: the forge page does not count three facts' 467 for f in $(find "$T/my.out" -name index.html); do 468 [ "$(grep -o 'href="https://interplane.io/galaxy/">The map' "$f" | wc -l | tr -d ' ')" -eq 1 ] || fail "map yes: footer map link missing or repeated in $f" 469 done 470 cmp "$T/mno.out/llms.txt" "$T/my.out/llms.txt" && cmp "$T/mno.out/sitemap.xml" "$T/my.out/sitemap.xml" || fail 'map yes changed llms.txt or sitemap.xml' 471 (cd "$T/my.out" && sha256sum -c --quiet manifest.sha256) || fail 'sha256sum disagrees with the manifest (map yes)' 472 ok 'map yes (as committed): home fact, two forge-page links, three facts and one footer link on every page; llms.txt and sitemap.xml unchanged' 473 tree ml; printf 'map maybe\n' > "$T/ml/content/live.txt"; refused 'live.txt with a value other than yes or no' ml 'content/live.txt takes exactly one line' 474 tree ml; printf 'map yes\nmap no\n' > "$T/ml/content/live.txt"; refused 'live.txt with two answers' ml 'content/live.txt takes exactly one line' 475 tree ml; printf 'galaxy yes\n' > "$T/ml/content/live.txt"; refused 'live.txt with an unknown key' ml 'content/live.txt takes exactly one line' 476 477 # ---- site policy refusals 478 tree c; add c '

    Write to someone@example.org today.

    '; refused 'email address' c 'email address' 479 tree c; add c '

    post

    '; refused 'mailto link' c 'email address' 480 tree c; add c ''; refused 'script element' c 'forbidden markup' 481 tree c; add c ''; refused 'style block' c 'forbidden markup' 482 tree c; add c '

    x

    '; refused 'inline style attribute' c 'forbidden or malformed attribute' 483 tree c; add c '

    x

    '; refused 'event handler attribute' c 'forbidden or malformed attribute' 484 tree c; add c ''; refused 'outside image' c 'forbidden URL' 485 tree c; add c ''; refused 'outside font or tracker link element' c 'forbidden URL' 486 tree c; add c '

    plain http

    '; refused 'plain http link' c 'forbidden URL' 487 tree c; printf '%s\n' '@import "https://fonts.example.org/a.css";' >> "$T/c/public/style.css"; refused 'outside font by CSS import' c 'forbidden CSS' 488 tree c; printf '%s\n' '.x{background:url(/public/a.png)}' >> "$T/c/public/style.css"; refused 'CSS url()' c 'forbidden CSS' 489 tree c; printf '%s\n' '.x{color:#ff0000}' >> "$T/c/public/style.css"; refused 'colour outside the root tokens' c 'forbidden CSS' 490 tree c; add c '

    See /home/builder/notes for more.

    '; refused 'private path' c 'private host name or path' 491 tree c; add c '

    Reach it at box.example.ts.net.

    '; refused 'private host name' c 'private host name or path' 492 tree c; add c '

    One — two.

    '; refused 'em dash entity' c 'em dash' 493 tree c; printf '

    One \342\200\224 two.

    \n' >> "$T/c/content/mission/index.html"; refused 'raw em dash bytes' c 'non-ASCII' 494 tree c; add c '

    Sovereign Intelligence® again.

    '; refused 'registered mark' c 'registered-mark' 495 tree c; add c '

    Sovereign Intelligence(R) again.

    '; refused 'registered mark in brackets' c 'trade mark sign' 496 tree c; sub "$T/c/content/sovereign-intelligence/index.html" 's/

    Sovereign Intelligence™<\/h1>/

    Sovereign Intelligence<\/h1>/'; refused 'first use without the trade mark sign' c 'trade mark sign' 497 tree c; add c '

    This is superintelligence.

    '; refused 'superintelligence outside the one sentence' c 'allowed only in the one sentence' 498 tree c; sub "$T/c/content/contribute/index.html" 's/Publishing is permanent/Publishing lasts/g'; refused 'contribute page without the permanence notice' c 'Publishing is permanent' 499 tree c; add c '

    {{no.such.value}}

    '; refused 'unknown placeholder' c 'unknown placeholder' 500 tree c; add c '

    left open

    '; refused 'an em element closed by the wrong end tag' c 'not properly nested' 501 tree c; add c '

    its div stays open

    '; refused 'an element that is not closed' c 'not properly nested' 502 tree c; add c ''; refused 'an end tag with nothing of its kind open' c 'not properly nested' 503 tree c; add c '

    More about Sovereign Intelligence here.

    '; refused 'a later Sovereign Intelligence without the trade mark sign' c 'trade mark sign' 504 tree c; sub "$T/c/content/mission/index.html" 's/^title: .*/title: Interplane: Sovereign Intelligence/'; refused 'a page title that names Sovereign Intelligence without the sign' c 'trade mark sign' 505 tree c; sub "$T/c/content/mission/index.html" 's/^description: .*/description: Part of Sovereign Intelligence./'; refused 'a page description that names Sovereign Intelligence without the sign' c 'trade mark sign' 506 tree c; printf '%s\n' 'Part of Sovereign Intelligence.' >> "$T/c/content/llms.txt"; refused 'llms.txt naming Sovereign Intelligence without (TM)' c 'trade mark sign' 507 tree c; sub "$T/c/public/style.css" 's/--btn-orange-bg:#2563eb/--btn-orange-bg:#63b3ed/'; refused 'primary button below 4.5 to 1' c 'contrast is below 4.5' 508 grep -q 'ratio = (lighter + 0.05) / (darker + 0.05) = 2.28 (rounded down), needed 4.50: FAIL' "$T/c.log" || fail 'the low-contrast arithmetic is not shown' 509 tree c; sub "$T/c/public/style.css" 's/--btn-orange-press:#1e40af/--btn-orange-press:#63b3ed/'; refused 'primary button pressed colour below 4.5 to 1' c 'contrast is below 4.5' 510 tree c; sub "$T/c/public/style.css" 's/--btn-lime-ink:#ffffff//'; refused 'button token without its text colour' c 'token pair is missing' 511 tree c; printf 'Disallow: /private\n' >> "$T/c/content/robots.txt"; refused 'changed crawl rules' c 'pinned crawl rules' 512 tree c; printf '%s\n' 'See https://interplane.io/galaxy/ too.' >> "$T/c/content/llms.txt"; refused 'llms.txt names a path that is not built and not verified' c 'llms.txt names' 513 tree c; sub "$T/c/content/llms.txt" 's/^{{pages}}$/- [Home](https:\/\/interplane.io\/): only one page listed/'; refused 'llms.txt out of step with the page list' c 'does not list every page' 514 tree c; mkdir "$T/c/content/extra"; printf 'title: Interplane: Extra\ndescription: A new page.\n---\n

    New.

    \n' > "$T/c/content/extra/index.html" 515 cp "$T/base.out/llms.txt" "$T/c/content/llms.txt"; printf 'page main /extra/ content/extra/index.html\n' >> "$T/c/content/routes.txt" 516 refused 'page added without appearing in llms.txt' c 'does not list every page' 517 tree c; rm "$T/c/content/mission/index.html"; ln -s /dev/null "$T/c/content/mission/index.html"; refused 'symbolic link as a source file' c 'unreadable file' 518 tree c; mkdir "$T/c.out"; build c; [ "$RC" -eq 1 ] && grep -q 'must be new' "$T/c.err" || fail 'existing output directory accepted'; rmdir "$T/c.out"; ok 'existing output directory refused, exit 1' 519 RC=0; (cd "$T/base" && "$BIN" build only-one > /dev/null 2>&1) || RC=$?; [ "$RC" -eq 2 ] || fail "usage error gave $RC"; ok 'wrong arguments give usage, exit 2' 520 521 # ---- Omega downloads 522 OMEGA_ARCHIVE=omega-compiler-`3086ed3ca106`-linux-aarch64.tar.gz 523 OMEGA_INSTALL=install-omega-`3086ed3ca106`.sh 524 OMEGA_SUMS=omega-`3086ed3ca106`.sha256 525 for f in "$OMEGA_ARCHIVE" "$OMEGA_INSTALL" "$OMEGA_SUMS"; do 526 cmp "$ROOT/public/omega-downloads/$f" "$T/base.out/omega/downloads/$f" || 527 fail "Omega download was changed by the builder: $f" 528 grep -Fq "href=\"/omega/downloads/$f\" download" "$T/base.out/omega/index.html" || 529 fail "the Omega downloads section does not offer $f" 530 done 531 (cd "$T/base.out/omega/downloads" && sha256sum -c --quiet "$OMEGA_SUMS") || 532 fail 'the public Omega download checksums do not match the package and installer' 533 gzip -t "$T/base.out/omega/downloads/$OMEGA_ARCHIVE" || fail 'the Omega archive is not valid gzip' 534 OMEGA_COMMIT=$(tar -xOzf "$T/base.out/omega/downloads/$OMEGA_ARCHIVE" README.txt | sed -n 's/^Source commit: //p') 535 [ "${#OMEGA_COMMIT}" -eq 40 ] || fail 'Omega archive does not name its exact source revision' 536 grep -Fq ">$OMEGA_COMMIT
    " "$T/base.out/omega/index.html" || 537 fail 'Omega page and archive name different source revisions' 538 if [ -d "$OMEGA_GIT" ]; then 539 git -C "$OMEGA_GIT" show "$OMEGA_COMMIT:seed/out/omc" > "$T/omega-upstream" || 540 fail 'could not read the compiler from the named Omega revision' 541 tar -xOzf "$T/base.out/omega/downloads/$OMEGA_ARCHIVE" omc > "$T/omega-packed" 542 cmp "$T/omega-upstream" "$T/omega-packed" || fail 'the archive compiler differs from the named Omega revision' 543 ok "Omega archive executable and page source revision match upstream ($OMEGA_COMMIT)" 544 else 545 printf 'NOT_RUN Omega upstream archive comparison: no repository at %s\n' "$OMEGA_GIT" 546 fi 547 grep -Fq 'compiler preview and installer for 64-bit Arm Linux: https://interplane.io/omega/' "$T/base.out/llms.txt" || 548 fail 'the Interplane text guide does not list the Omega downloads' 549 DOWNLOADS="$T/base.out/omega/downloads" 550 OMEGA_HOME="$T/install omega" 551 mkdir "$OMEGA_HOME" 552 if HOME="$OMEGA_HOME" sh "$DOWNLOADS/$OMEGA_INSTALL" "$T/base.out/llms.txt" > "$T/omega-bad.log" 2>&1; then 553 fail 'the Omega installer accepted an archive with a wrong hash' 554 fi 555 grep -Fq 'archive SHA-256 mismatch' "$T/omega-bad.log" && 556 [ ! -e "$OMEGA_HOME/.local/bin/omc" ] || fail 'the Omega installer wrote a compiler before checking' 557 HOME="$OMEGA_HOME" sh "$DOWNLOADS/$OMEGA_INSTALL" "$DOWNLOADS/$OMEGA_ARCHIVE" || 558 fail 'the Omega installer refused the archive offered by the site' 559 printf 'fn main to int\nret 7\nend\n' > "$T/omega-seven.om" 560 "$OMEGA_HOME/.local/bin/omc" < "$T/omega-seven.om" > "$T/omega-seven" || fail 'installed Omega did not compile' 561 chmod +x "$T/omega-seven" 562 OMEGA_RC=0 563 "$T/omega-seven" || OMEGA_RC=$? 564 [ "$OMEGA_RC" -eq 7 ] || fail "installed Omega example exited $OMEGA_RC" 565 printf 'previous omc\n' > "$OMEGA_HOME/.local/bin/omc" 566 if HOME="$OMEGA_HOME" sh "$DOWNLOADS/$OMEGA_INSTALL" "$DOWNLOADS/$OMEGA_ARCHIVE" > "$T/omega-existing.log" 2>&1; then 567 fail 'the Omega installer accepted an occupied destination' 568 fi 569 [ "$(cat "$OMEGA_HOME/.local/bin/omc")" = 'previous omc' ] || fail 'the Omega installer replaced existing omc' 570 ok 'Omega download links verify; the installer compiles the example and rejects a bad archive and an occupied destination' 571 tar -xOzf "$DOWNLOADS/$OMEGA_ARCHIVE" omc > "$T/lesson-omc" 572 chmod +x "$T/lesson-omc" 573 "$T/lesson-omc" < "$O/examples/sum.om" > "$T/lesson-sum" || fail 'Omega lesson did not compile' 574 chmod +x "$T/lesson-sum" 575 LESSON_RC=0 576 "$T/lesson-sum" || LESSON_RC=$? 577 [ "$LESSON_RC" -eq 6 ] || fail "Omega lesson exited $LESSON_RC" 578 sed 's/ret total/ret true/' "$O/examples/sum.om" > "$T/lesson-bad.om" 579 LESSON_RC=0 580 "$T/lesson-omc" < "$T/lesson-bad.om" > "$T/lesson-bad" 2> "$T/lesson-bad.log" || LESSON_RC=$? 581 [ "$LESSON_RC" -eq 7 ] && [ ! -s "$T/lesson-bad" ] && grep -Fxq 'omc: line 6: error 7' "$T/lesson-bad.log" || fail 'Omega lesson did not refuse the wrong return type' 582 ok 'Omega lesson exits 6 and its wrong return type is refused at line 6, error 7' 583 for byte in 0 1; do 584 tree c 585 printf '\000' | dd of="$T/c/public/omega-downloads/$OMEGA_ARCHIVE" bs=1 seek="$byte" conv=notrunc status=none 586 refused "gzip route with only magic byte $byte changed" c 'a gzip route must start with a gzip header' 587 done 588 tree c 589 printf '\000' | dd of="$T/c/public/omega-downloads/$OMEGA_ARCHIVE" bs=1 seek=2 conv=notrunc status=none 590 refused 'gzip route with gzip magic bytes and a non-deflate method' c 'a gzip route must start with a gzip header' 591 rm -rf "$T/omega-tamper.out" 592 cp -R "$T/base.out" "$T/omega-tamper.out" 593 head -c 3 "$ROOT/public/omega-downloads/$OMEGA_ARCHIVE" > "$T/omega-tamper.out/omega/downloads/$OMEGA_ARCHIVE" 594 redigest "$T/omega-tamper.out" "omega/downloads/$OMEGA_ARCHIVE" 595 vrefused 'an output archive with a short header and a recomputed manifest digest' base omega-tamper.out base.hop 'a gzip route must start with a gzip header' 596 tree c 597 head -c 3 "$ROOT/public/omega-downloads/$OMEGA_ARCHIVE" > "$T/c/public/omega-downloads/$OMEGA_ARCHIVE" 598 refused 'gzip route shorter than the minimum stream size' c 'a gzip route must start with a gzip header' 599 tree c 600 head -c 100 "$ROOT/public/omega-downloads/$OMEGA_ARCHIVE" > "$T/c/public/omega-downloads/$OMEGA_ARCHIVE" 601 refused 'truncated archive with its gzip header intact' c 'Omega downloads must match' 602 tree c 603 printf '# added line\n' >> "$T/c/public/omega-downloads/$OMEGA_INSTALL" 604 refused 'installer whose bytes differ from the checksum' c 'Omega downloads must match' 605 tree c 606 sub "$T/c/public/omega-downloads/$OMEGA_SUMS" '1s/^./0/' 607 refused 'checksum file whose bytes differ from the release pin' c 'Omega downloads must match' 608 vrefused 'a source tree with a changed Omega checksum file' c base.out base.hop 'Omega downloads must match' 609 610 gzsub() { tree c; sub "$T/c/content/routes.txt" "$1"; } 611 gzsub 's|^gzip main /omega/downloads/|gzip main /public/|' 612 refused 'gzip route outside /omega/downloads/' c 'malformed line' 613 gzsub 's|^gzip main |gzip hopbot |' 614 refused 'gzip route on hopbot.org' c 'malformed line' 615 gzsub '/^gzip main /s/$/ hop/' 616 refused 'gzip route with an optional-data word' c 'malformed line' 617 gzsub 's|^gzip main /omega/downloads/|gzip main /omega/downloads/sub/|' 618 refused 'gzip route in a download subdirectory' c 'malformed line' 619 gzsub 's|^gzip main /omega/downloads/|gzip main /omega/downloads/.|' 620 refused 'gzip route whose filename starts with a dot' c 'malformed line' 621 gzsub '/^gzip main /s/\.tar\.gz /\.tgz /' 622 refused 'gzip route without a .tar.gz suffix' c 'malformed line' 623 gzsub '/^raw main .*install-omega-.*\.sh /d' 624 refused 'missing installer route' c 'Omega downloads must match' 625 626 gzsub 's|^gzip main /omega/downloads/|raw main /omega/downloads/|' 627 refused 'archive route declared as raw instead of gzip' c 'Omega downloads must match' 628 gzsub '/^raw main .*install-omega-.*\.sh /s/$/ hop/' 629 refused 'installer route with an optional-data word' c 'Omega downloads must match' 630 grep -Fq 'in: content/routes.txt' "$T/c.err" || fail 'installer route error does not name the route registry' 631 gzsub '/^raw main .*install-omega-.*\.sh /s/^raw main /raw hopbot /' 632 refused 'installer route on hopbot instead of interplane' c 'Omega downloads must match' 633 tree c 634 printf 'extra\n' | gzip -n > "$T/c/public/omega-downloads/extra.tar.gz" 635 printf '%s\n' 'gzip main /omega/downloads/extra.tar.gz public/omega-downloads/extra.tar.gz' >> "$T/c/content/routes.txt" 636 refused 'valid gzip route outside the pinned download set' c 'must contain only the three pinned release routes' 637 tree c 638 printf 'extra\n' > "$T/c/public/omega-downloads/extra.txt" 639 printf '%s\n' 'raw main /omega/downloads/extra.txt public/omega-downloads/extra.txt' >> "$T/c/content/routes.txt" 640 refused 'ordinary file route outside the pinned download set' c 'must contain only the three pinned release routes' 641 642 # Published HTML and guide assertions belong to the builder, so verify also 643 # refuses a source change even if the existing output manifest itself is valid. 644 tree c 645 sub "$T/c/content/omega/index.html" 's/{{omega.commit}}/`0000000000000000000000000000000000000000`/' 646 refused 'Omega page with a different compiler revision' c 'Omega download page must name' 647 vrefused 'a source page with a different compiler revision' c base.out base.hop 'Omega download page must name' 648 tree c 649 sub "$T/c/content/omega/index.html" '/

    /d' 650 refused 'Omega page missing its download section heading' c 'Omega download page must name' 651 for key in archive installer checksums; do 652 tree c 653 quote='"' 654 sub "$T/c/content/omega/index.html" "s|/omega/downloads/{{omega.$key}}$quote download|/omega/downloads/{{omega.$key}}$quote|" 655 refused "Omega page missing the $key download action" c 'Omega download page must name' 656 done 657 tree c 658 sub "$T/c/content/llms.txt" '/^- Omega programming language,/s/ compiler preview and installer for 64-bit Arm Linux/ compiler downloads not yet available/' 659 refused 'stale Omega download availability in llms.txt' c 'llms.txt must list the Omega compiler' 660 vrefused 'a source guide with stale Omega download availability' c base.out base.hop 'llms.txt must list the Omega compiler' 661 662 # ---- papers: the snapshot, the source links, fonts and data routes 663 psub() { tree c; sub "$T/c/content/papers.snapshot" "$1"; } 664 psub 's|^record 10.5281/zenodo.`24047504`$|record 10.5281/zenodo.2404750x|'; refused 'record DOI with a letter in the number' c 'a DOI must be 10.5281/zenodo. followed by digits' 665 psub 's|^concept 10.5281/zenodo.`24032442`$|concept 10.1234/zenodo.`24032442`|'; refused 'concept DOI under another prefix' c 'a DOI must be 10.5281/zenodo. followed by digits' 666 psub '0,/^title /{/^title /d;}'; refused 'record without a title line' c 'a record has no title' 667 psub '0,/^title /s/^title .*/title /'; refused 'record with an empty title' c 'a record has no title' 668 psub '0,/^title /s/^title The Spark/title The \\u2014 Spark/'; refused 'title with an escape the builder cannot write (em dash)' c 'escaped character that the builder cannot write' 669 psub '0,/^title /s/^title The Spark/title The Spark/'; refused 'title with markup' c 'content/papers.snapshot has a missing' 670 psub '0,/^title /s/^title The Spark/title The {{papers.count}} Spark/'; refused 'title with a placeholder' c 'content/papers.snapshot has a missing' 671 psub '0,/^date /s/^date .*/date 2020-01-01/'; refused 'records out of date order' c 'records must run newest first' 672 psub 's/^records [0-9]*$/records 14/'; refused 'records line that does not match the records' c 'records must run newest first' 673 psub 's|^record 10.5281/zenodo.`23774599`$|record 10.5281/zenodo.`24047504`|'; refused 'two records with the same record DOI' c 'a record DOI or a concept DOI appears twice' 674 psub 's|^concept 10.5281/zenodo.`23766141`$|concept 10.5281/zenodo.`24032442`|'; refused 'two records with the same concept DOI' c 'a record DOI or a concept DOI appears twice' 675 psub 's/md5:`038ffd922b26131d557c8bb6085e3bd7`/md5:038ffd/'; refused 'file checksum of the wrong length' c 'content/papers.snapshot has a missing' 676 psub '0,/^orcid_attached /s/^orcid_attached yes$/orcid_attached no/'; refused 'orcid_attached that contradicts the creator line' c 'content/papers.snapshot has a missing' 677 psub 's/^response 1 sha256:..../response 1 sha256:zzzz/'; refused 'response fingerprint that is not hex' c 'content/papers.snapshot has a missing' 678 psub 's/^fetched .*/fetched 2026-13-10/'; refused 'fetch date that is not a date' c 'content/papers.snapshot has a missing' 679 psub '0,/^type /s/^type .*/note an unknown key/'; refused 'unknown key in a record' c 'content/papers.snapshot has a missing' 680 psub '0,/^title /s/^title The Spark/title The fixture Spark/'; refused 'the word fixture in the snapshot in a release build' c 'release mode refuses made-up data' 681 MODE=--test-data; passes 'the word fixture in the snapshot with --test-data' c; MODE= 682 tree c; rm "$T/c/content/papers.snapshot"; refused 'missing papers snapshot' c 'papers.snapshot' 683 ssub() { tree c; sub "$T/c/content/papers.sources" "$1"; } 684 ssub '0,/^source /s/md5:[0-9a-f]*$/md5:`00112233445566778899aabbccddeeff`/'; refused 'source line whose checksum is not a file of the record' c 'content/papers.sources: a line must name' 685 ssub '0,/^source /s|https://interplane.io/|https://example.org/|'; refused 'source line with an address outside interplane.io' c 'content/papers.sources: a line must name' 686 ssub '0,/^source /s|^source 10.5281/zenodo.[0-9]*|source 10.5281/zenodo.1|'; refused 'source line for a record not in the snapshot' c 'content/papers.sources: a line must name' 687 tree c; printf 'not a font\n' > "$T/c/public/fonts/lmroman10-bold.otf"; refused 'font route whose file is not OpenType' c 'a font route must hold an OpenType file' 688 tree c; sub "$T/c/content/routes.txt" 's|^font main /public/fonts/lmroman10-bold.otf |font main /public/fonts/lmroman10-bold.ttf |'; refused 'font route that does not end in .otf' c 'malformed line' 689 tree c; sub "$T/c/content/routes.txt" 's|^font main /public/fonts/lmroman10-bold.otf |font main /public/lmroman10-bold.otf |'; refused 'font route outside /public/fonts/' c 'malformed line' 690 MODE=--test-data; tree c; fixtures c; printf 'not a png\n' > "$T/c/public/hop-screen.png"; refused 'png route whose file is not a PNG' c 'a png route must hold a PNG file'; MODE= 691 tree c; sub "$T/c/content/routes.txt" 's|^png main /public/hop-screen.png |png main /public/hop-screen.jpg |'; refused 'png route that does not end in .png' c 'malformed line' 692 tree c; sub "$T/c/content/routes.txt" 's|^png main /public/hop-screen.png |png main /hop-screen.png |'; refused 'png route outside /public/' c 'malformed line' 693 for u in explore drakestapleton/omega-mv; do 694 grep -q "^ https://interplane.io/$u\$" "$T/base.out/sitemap.xml" || fail "sitemap.xml lacks the forge page $u" 695 [ ! -e "$T/base.out/$u" ] || fail "a file was built for the forge page $u" 696 if grep -q " $u\(/\|\$\)" "$T/base.out/manifest.sha256"; then fail "the manifest names the forge page $u"; fi 697 done 698 fsub() { tree c; sub "$T/c/content/routes.txt" "$1"; } 699 fsub 's|^forge main /explore -$|forge main /elsewhere -|'; refused 'forge route outside /explore and /drakestapleton/' c 'malformed line' 700 fsub 's|^forge main /explore -$|forge main /explorer -|'; refused 'forge route that only starts with /explore' c 'malformed line' 701 fsub 's|^forge main /drakestapleton/omega-mv -$|forge main /drakestapleton/ -|'; refused 'forge route with an empty project name' c 'malformed line' 702 fsub 's|^forge main /drakestapleton/omega-mv -$|forge main /drakestapleton/.github -|'; refused 'forge route to a name that starts with a dot' c 'malformed line' 703 fsub 's|^forge main /drakestapleton/omega-mv -$|forge main /drakestapleton/omega-mv/tree -|'; refused 'forge route below a project page' c 'malformed line' 704 fsub 's|^forge main /drakestapleton/omega-mv -$|forge main /someone/omega-mv -|'; refused 'forge route under another owner' c 'malformed line' 705 fsub 's|^forge main /explore -$|forge hopbot /explore -|'; refused 'forge route on hopbot.org' c 'malformed line' 706 fsub 's|^forge main /explore -$|forge main /explore content/index.html|'; refused 'forge route with a source file' c 'malformed line' 707 fsub 's|^forge main /explore -$|forge main /explore - hop|'; refused 'forge route that depends on optional data' c 'malformed line' 708 tree c; echo 'forge main /explore -' >> "$T/c/content/routes.txt"; refused 'forge route listed twice' c 'same address on the same site twice' 709 tree c; grep '^page main /omega/ ' "$T/base/content/routes.txt" >> "$T/c/content/routes.txt"; refused 'page route listed twice' c 'same address on the same site twice' 710 ok 'forge routes: /explore and /drakestapleton/omega-mv are in sitemap.xml, with no file built or in the manifest; a route outside /explore and /drakestapleton/NAME, a dot name, a deeper path, another owner, hopbot.org, a source file, an optional-data word and a route listed twice (forge or page) are refused' 711 tree c; n=$(grep -cv '^#\|^$' "$T/c/content/routes.txt"); i=0 712 while [ $((n + i)) -le 500 ]; do echo "raw main /pad$i.txt content/robots.txt" >> "$T/c/content/routes.txt"; i=$((i + 1)); done 713 refused 'route table: 501 rows' c 'more rows than the route table holds' 714 MODE=--test-data; tree c; fixtures c; passes 'fixture build with the Hop screenshot' c 715 if grep -q 'interplane.io/' "$T/c.hop/sitemap.xml"; then fail 'the hopbot.org sitemap names an interplane.io or forge page'; fi 716 for o in c.out c.hop; do cmp "$ROOT/public/hop-screen.png" "$T/$o/public/hop-screen.png" || fail "the Hop screenshot is not copied unchanged into $o"; done 717 for o in c.out c.hop; do cmp "$ROOT/public/hop-background.png" "$T/$o/public/hop-background.png" || fail "the Hop background render is not copied unchanged into $o"; done 718 for o in c.out c.hop; do cmp "$ROOT/public/hop-background-render.swift" "$T/$o/public/hop-background-render.swift" || fail "the background render source is not copied unchanged into $o"; done 719 grep -q 'Hop background render: two black holes orbit among stars and expanding waves.' "$T/c.hop/index.html" || fail 'hopbot.org does not show the Hop background render with its alt text and size' 720 [ ! -e "$T/c.hop/public/fonts" ] && [ "$(grep -c '^@font-face{' "$T/c.out/public/style.css")" -eq 3 ] && grep -v '^@font-face{' "$T/c.out/public/style.css" | cmp -s - "$T/c.hop/public/style.css" || fail 'hopbot.org builds no font, so its stylesheet must be the interplane.io one without the three @font-face lines and it must hold no font file' 721 ok 'png route: legacy screenshot and current background are copied unchanged; hopbot.org shows the labelled background with alt text, width and height; hopbot.org builds no font and its stylesheet is the interplane.io one without the @font-face lines'; MODE= 722 tree c; printf '%s\n' '@font-face{font-family:x;src:url(/public/fonts/nope.otf)}' >> "$T/c/public/style.css"; refused 'CSS url() naming a font that is not built' c 'forbidden CSS' 723 tree c; printf '%s\n' '@font-face{font-family:x;src:url(/public/fonts/GUST-FONT-LICENSE.txt)}' >> "$T/c/public/style.css"; refused 'CSS url() naming a file that is not a font route' c 'forbidden CSS' 724 tree c; printf '%s\n' '@font-face{font-family:x;src:url(/public/fonts/lmroman10-bold.otf' >> "$T/c/public/style.css"; refused 'CSS url() left open' c 'forbidden CSS' 725 tree c; sub "$T/c/content/routes.txt" '/^font main \/public\/fonts\/lmroman10-italic.otf /d'; refused 'CSS url() naming a font whose route was removed' c 'forbidden CSS' 726 MODE=--test-data; tree c; fixtures c; printf 'font hopbot /public/fonts/lmroman10-regular.otf public/fonts/lmroman10-regular.otf\n' >> "$T/c/content/routes.txt"; refused 'CSS url() naming a font that hopbot.org does not build (it builds one of the three)' c 'forbidden CSS'; MODE= 727 tree c; printf '%s\n' '.x{background:url(/public/fonts/lmroman10-bold.otf)}' >> "$T/c/public/style.css"; passes 'CSS url() outside @font-face naming a font interplane.io builds' c; ok 'CSS url() outside @font-face naming a font interplane.io builds is accepted there' 728 MODE=--test-data; tree c; fixtures c; printf '%s\n' '.x{background:url(/public/fonts/lmroman10-bold.otf)}' >> "$T/c/public/style.css"; refused 'the same url() on hopbot.org, which builds no font: only @font-face blocks are left out' c 'forbidden CSS'; MODE= 729 MODE=--test-data; tree c; fixtures c; printf '%s' '@font-face{font-family:x' >> "$T/c/public/style.css"; refused '@font-face block left open on hopbot.org, which builds no font' c 'forbidden CSS'; MODE= 730 tree c; sub "$T/c/content/llms.txt" '/papers\/papers.bib$/d'; refused 'data file missing from llms.txt' c 'does not list every page and data file' 731 732 # ---- receipts (the fixtures need the test-data mode) 733 MODE=--test-data 734 tree r; fixtures r 735 awk 'NR==1{sub(/source is public/,"source is Public")}{print}' "$T/r/content/receipts/ledger.tsv" > "$T/r/l" && mv "$T/r/l" "$T/r/content/receipts/ledger.tsv" 736 refused 'ledger whose first row was changed while the last row was kept' r 'ledger does not verify' 737 grep -q '^BAD line 2 5$' "$T/r.err" || fail 'first row changed: expected BAD line 2 5 (record 2 no longer links)' 738 tree r; fixtures r; printf %s "$(cat "$T/r/content/receipts/ledger.tsv")" > "$T/r/l" && mv "$T/r/l" "$T/r/content/receipts/ledger.tsv" 739 refused 'ledger whose last line has no line feed' r 'ledger does not verify' 740 grep -q '^BAD line 1 7$' "$T/r.err" || fail 'no final line feed: expected BAD line 1 7' 741 tree r; fixtures r; printf '%064d\n' 0 > "$T/r/content/receipts/head.txt"; refused 'recorded head that is not the head of the ledger' r 'head.txt must hold the head' 742 tree r; fixtures r; rm "$T/r/content/receipts/head.txt"; refused 'ledger without its recorded head' r 'head.txt must hold the head' 743 tree r; fixtures r 744 awk 'NR==2{sub(/fixture-desk/,"fixture-desc")}{print}' "$T/r/content/receipts/ledger.tsv" > "$T/r/l" && mv "$T/r/l" "$T/r/content/receipts/ledger.tsv" 745 refused 'ledger with one altered byte in the middle line' r 'ledger does not verify' 746 grep -q '^BAD line 3 5$' "$T/r.err" || fail 'altered ledger: expected BAD line 3 5 (the next record no longer links)' 747 if [ -n "$CHAIN" ]; then 748 CRC=0; COUT=$("$CHAIN" verify "$T/r/content/receipts/ledger.tsv") || CRC=$? 749 [ "$CRC" -eq 2 ] && [ "$COUT" = "$(printf 'BAD\tline\t3\t5')" ] || fail "forge chain tool disagrees on the altered ledger: $CRC $COUT" 750 fi 751 tree r; fixtures r; rm "$(ls "$T/r/content/receipts/payload/"*.txt | head -n 1)"; refused 'missing payload file' r 'payload file is missing' 752 tree r; fixtures r; printf 'x' >> "$(ls "$T/r/content/receipts/payload/"*.txt | head -n 1)"; refused 'payload whose bytes do not match its name' r 'does not equal its name' 753 tree r; fixtures r; sub "$T/r/content/hop.release.txt" 's/^receipt_seqs 1 2 3$/receipt_seqs 1 2 9/'; refused 'receipt_seqs names a record that does not exist' r 'ledger does not hold' 754 tree r; fixtures r; rm -r "$T/r/content/receipts"; refused 'receipt_seqs without a ledger' r 'ledger does not hold' 755 tree r; fixtures r; sub "$T/r/content/hop.release.txt" 's/^zip_sha256 1111/zip_sha256 zzzz/'; refused 'malformed download fingerprint' r 'hop.release.txt' 756 tree r; fixtures r; printf 'notarised yes\n' >> "$T/r/content/hop.release.txt"; refused 'unknown Hop key' r 'hop.release.txt' 757 tree r; fixtures r; sub "$T/r/content/hop.release.txt" '/^commit /d'; refused 'missing Hop key' r 'hop.release.txt' 758 MODE= 759 760 # ---- rules that need the written output (a refused build may leave an incomplete directory) 761 tree l; add l '

    gone

    '; refused 'local link without a target' l 'link target is missing' late 762 tree l; add l '

    gone

    '; refused 'fragment without a matching id' l 'no matching id' late 763 VRC=0; (cd "$T/base" && "$BIN" verify "$T/base.out" "$T/base.hop" > "$T/v.log" 2> "$T/v.err") || VRC=$? 764 [ "$VRC" -eq 0 ] || fail "verify of an untouched build gave $VRC" 765 printf ' ' >> "$T/base.out/mission/index.html" 766 VRC=0; (cd "$T/base" && "$BIN" verify "$T/base.out" "$T/base.hop" > "$T/v.log" 2> "$T/v.err") || VRC=$? 767 [ "$VRC" -eq 1 ] && grep -q 'differs from the manifest' "$T/v.err" || fail 'verify accepted a changed output file' 768 ok 'verify passes an untouched build and refuses one changed byte, exit 1' 769 for f in $(find "$T/base.out" -name index.html); do 770 d=${f%index.html} 771 [ -s "${d}index.txt" ] && jq -e '.source_url and .lang and .text and .html' "${d}index.json" > /dev/null || fail "page without its text and JSON forms: $f" 772 grep -q "href=\"/translate/\">Read in your language" "$f" || fail "page without the translation help link: $f" 773 if grep -q '' "$T/base.out/contribute/index.html" || fail 'brand or code is translatable' 776 grep -q -x 'Explore the projects Open the map ->' "$T/base.out/forge/index.txt" || fail 'adjacent links run together in the text form' 777 if grep -q 'projectsOpen' "$T/base.out/forge/index.txt" "$T/base.out/forge/index.json"; then fail 'adjacent links run together in a source form'; fi 778 FX=$ROOT/tests/fixtures/translate 779 if "$BIN" translation-check "$FX/bare-hash.html" > /dev/null 2>&1; then fail 'translation check accepted a bare hash'; fi 780 "$BIN" translation-check "$FX/protected-hash.html" > /dev/null 2>&1 || fail 'translation check refused a protected hash' 781 "$BIN" headers-check "$FX/csp-ok.txt" > /dev/null 2>&1 && ! "$BIN" headers-check "$FX/csp-self.txt" > /dev/null 2>&1 || fail 'headers check did not separate script-src none from self' 782 ok 'translation: text and JSON forms, links, protected brand and code, bare-hash and CSP negatives' 783 784 # ---- translated copies are retired: no Chinese route, alternate or language switch is built 785 MODE= 786 if grep -rq -e 'hreflang' -e 'zh-CN' "$T/base.out" "$T/full.out" "$T/full.hop"; then fail 'a built file still names hreflang or zh-CN'; fi 787 tree z; printf 'page main /zh-CN/mission/ content/mission/index.html\n' >> "$T/z/content/routes.txt"; refused 'a /zh-CN/ route' z 'translated copies are retired' 788 tree z; printf 'page hopbot /zh/ content/hop/index.html\n' >> "$T/z/content/routes.txt"; refused 'a /zh/ route' z 'translated copies are retired' 789 tree z; sub "$T/z/content/_layout.html" 's|||'; refused 'a layout that does not declare lang en' z 'lang="en"' 790 tree z; add z "

    $(printf '\344\270\255\346\226\207')

    "; refused 'Chinese text in a page' z 'non-ASCII byte' 791 ok 'translated copies retired: built files name no hreflang or zh-CN; /zh-CN/ and /zh/ routes, a non-English layout and non-ASCII page text are refused' 792 MODE= 793 # check-render.sh on a page with CJK text (as a reader's tool may leave it): drawn in a system CJK 794 # font, and a codepoint no font covers is a missing glyph 795 if command -v "${CHROME:-google-chrome}" > /dev/null 2>&1; then 796 rm -rf "$T/g1" "$T/g2"; mkdir -p "$T/g1" "$T/g2" 797 cp -R "$T/full.out/public" "$T/g1/"; sed "s||

    $(printf '\344\270\255\346\226\207')

    |" "$T/full.out/mission/index.html" > "$T/g1/index.html" 798 cp -R "$T/full.out/public" "$T/g2/"; sed "s||

    $(printf '\352\246\200')

    |" "$T/g1/index.html" > "$T/g2/index.html" 799 GRC=0; WIDTHS=360 sh "$ROOT/scripts/tests/check-render.sh" "$T/g1" > "$T/g1.log" 2>&1 || GRC=$? 800 if [ "$GRC" -eq 3 ]; then 801 printf 'NOTE check-render.sh glyph controls NOT_RUN: %s\n' "$(cat "$T/g1.log")" 802 else 803 [ "$GRC" -eq 0 ] && grep -q 'CJK characters [1-9]' "$T/g1.log" || { cat "$T/g1.log" >&2; fail 'check-render.sh refused a Chinese page drawn in system fonts'; } 804 GRC=0; WIDTHS=360 sh "$ROOT/scripts/tests/check-render.sh" "$T/g2" > "$T/g2.log" 2>&1 || GRC=$? 805 [ "$GRC" -eq 1 ] && grep -q 'drawn as a missing glyph' "$T/g2.log" || { cat "$T/g2.log" >&2; fail 'check-render.sh accepted a character no font covers'; } 806 ok "check-render.sh draws CJK characters in a system font and refuses U+A980, which no font covers" 807 fi 808 else 809 printf 'NOTE check-render.sh glyph controls NOT_RUN: no browser\n' 810 fi 811 812 # ---- docs/CLAIMS.md against the built pages 813 CL=$ROOT/scripts/tests/check-claims.sh 814 sh "$CL" "$T/base.out" --hop "$ROOT/tests/fixtures/hop.release.txt" "$T/full.out" "$T/full.hop" > "$T/claims.log" 2>&1 || { cat "$T/claims.log" >&2; fail 'docs/CLAIMS.md and the built pages differ'; } 815 ok "$(cat "$T/claims.log")" 816 # Keep the same pages and row contents; break only their Markdown placement. 817 mkdir -p "$T/claims-layout/scripts/tests" "$T/claims-layout/docs" 818 cp "$CL" "$T/claims-layout/scripts/tests/check-claims.sh" 819 LAYOUT=$T/claims-layout/scripts/tests/check-claims.sh 820 for mutation in blank-row moved-row missing-delimiter; do 821 awk -v mutation="$mutation" ' 822 /^\| claim \| / && !changed { 823 changed=1 824 if (mutation == "blank-row") print "" 825 if (mutation == "moved-row") { moved=$0; next } 826 } 827 /^\|---\|---\|---\|---\|---\|$/ && mutation == "missing-delimiter" && !omitted { omitted=1; next } 828 { print } 829 /^\| hop \| / && moved != "" { print moved; moved="" } 830 ' "$ROOT/docs/CLAIMS.md" > "$T/claims-layout/docs/CLAIMS.md" 831 if sh "$LAYOUT" "$T/base.out" --hop "$ROOT/tests/fixtures/hop.release.txt" "$T/full.out" "$T/full.hop" > "$T/layout-$mutation.log" 2>&1; then 832 fail "claims check accepted $mutation Markdown table control" 833 fi 834 grep -q 'FAIL claims table layout' "$T/layout-$mutation.log" || { cat "$T/layout-$mutation.log" >&2; fail "claims $mutation control failed for an unrelated reason"; } 835 ok "claims layout refuses $mutation with unchanged page sentences" 836 done 837 tree cl; add cl '

    The rule here A new promise that is in no table.

    '; passes claim-added cl 838 if sh "$CL" "$T/cl.out" --hop "$ROOT/tests/fixtures/hop.release.txt" "$T/full.out" "$T/full.hop" > /dev/null 2>&1; then fail 'a new labelled sentence was accepted without a row in docs/CLAIMS.md'; fi 839 tree cl; add cl '

    We never fail.

    '; passes word-added cl 840 if sh "$CL" "$T/cl.out" --hop "$ROOT/tests/fixtures/hop.release.txt" "$T/full.out" "$T/full.hop" > /dev/null 2>&1; then fail 'a new universal word was accepted without a row in docs/CLAIMS.md'; fi 841 tree cl; add cl '

    What you can check today A fact with no link.

    '; passes check-nolink cl 842 if sh "$CL" "$T/cl.out" --hop "$ROOT/tests/fixtures/hop.release.txt" "$T/full.out" "$T/full.hop" > /dev/null 2>&1; then fail 'a check sentence without a link was accepted'; fi 843 if sh "$CL" "$T/base.out" "$T/full.out" "$T/full.hop" > /dev/null 2>&1; then fail 'Hop sentences were accepted without the release values they print'; fi 844 ok 'claims check without the release file fails: the Hop rows that print a version, commit, project ID or system are compared through its values' 845 tree cl; add cl '

    Hop also does a thing no table records.

    '; passes hop-sentence-added cl 846 if sh "$CL" "$T/cl.out" --hop "$ROOT/tests/fixtures/hop.release.txt" "$T/full.out" "$T/full.hop" > /dev/null 2>&1; then fail 'a new Hop sentence was accepted without a source row in docs/CLAIMS.md'; fi 847 ok 'claims check fails on a new labelled sentence, on a new universal word, on a check sentence without a link, and on a Hop sentence without a source row' 848 849 # ---- the committed release data, when this commit carries it (a release build of the tree as it is) 850 if [ -f "$ROOT/content/hop.release.txt" ]; then 851 MODE= 852 realtree real 853 passes 'the committed tree with its release data' real 854 [ -f "$T/real.out/hop/index.html" ] && [ -f "$T/real.hop/index.html" ] || fail 'the committed release data did not build the Hop page and hopbot.org' 855 [ ! -e "$T/real.out/TEST-DATA" ] && [ ! -e "$T/real.hop/TEST-DATA" ] || fail 'the committed release data built test-data output' 856 if grep -rq -e 'data-test-data' -e 'TEST DATA' "$T/real.out" "$T/real.hop"; then fail 'the committed release data carries the test-data banner'; fi 857 grep -q 'badge: rows backed by a receipt that holds the same value: 3 of 3' "$T/real.log" || fail 'the committed release data does not earn the badge: a row has no receipt that holds its value' 858 grep -q 'hop copy: the page wording is pinned to the release commit' "$T/real.log" || fail 'the committed release commit was not compared with content/hop.copy.txt' 859 vrun real real.out real.hop; [ "$VRC" -eq 0 ] || { cat "$T/v.err" >&2; fail 'verify of the committed release build failed'; } 860 (cd "$T/real.out" && sha256sum -c --quiet manifest.sha256) && (cd "$T/real.hop" && sha256sum -c --quiet manifest.sha256) || fail 'sha256sum disagrees with a manifest of the committed release build' 861 ok "the committed release data builds in release mode: Hop page and hopbot.org, no test-data mark, badge 3 of 3, pin compared, verify passes" 862 RHEAD=$(cat "$ROOT/content/receipts/head.txt") 863 VOUT=$(sh "$T/real.out/receipts/verify.sh" "file://$T/real.out/receipts") || fail 'the published verifier failed on the committed receipts' 864 [ "$(printf '%s\n' "$VOUT" | sed -n 's/^head //p')" = "$RHEAD" ] && grep -q "id=\"head\">$RHEAD<" "$T/real.out/receipts/index.html" || fail 'the committed receipts: verifier head, page head and head.txt differ' 865 if [ -n "$CHAIN" ]; then 866 [ "$("$CHAIN" verify "$ROOT/content/receipts/ledger.tsv" | cut -f1,3)" = "$(printf 'OK\t%s' "$RHEAD")" ] || fail 'forge chain tool disagrees on the committed ledger' 867 fi 868 ok "the committed receipts: the published verifier walks them to head $RHEAD, equal to the page and head.txt" 869 if [ -f "$ROOT/content/hop.install.sh" ]; then 870 cmp "$ROOT/content/hop.install.sh" "$T/real.hop/install.sh" || fail 'the committed installer was not copied byte for byte' 871 RIS=$(sha < "$ROOT/content/hop.install.sh") 872 grep -q "^install_sha256 $RIS\$" "$ROOT/content/hop.release.txt" && grep -q "echo \"$RIS install.sh\" | shasum -a 256 -c -" "$T/real.hop/index.html" || fail 'the committed installer fingerprint is not the one in the release file and in the printed line' 873 ok "the committed installer is served byte for byte as hopbot.org /install.sh and the printed line checks its fingerprint $RIS" 874 fi 875 sh "$CL" "$T/base.out" --hop "$ROOT/content/hop.release.txt" "$T/real.out" "$T/real.hop" > "$T/claims-real.log" 2>&1 || { cat "$T/claims-real.log" >&2; fail 'docs/CLAIMS.md and the pages built from the committed release data differ'; } 876 ok "committed release data: $(cat "$T/claims-real.log")" 877 else 878 printf 'NOTE this commit carries no Hop release data: the controls on committed release data did not run\n' 879 fi 880 881 (cd "$ROOT" && "$BIN" contrast) > "$T/contrast.log" 882 grep -c 'needed 4.50: PASS' "$T/contrast.log" | sed 's/^/button colour pairs at or above 4.5 to 1: /' 883 grep -E '^contrast --btn|ratio =' "$T/contrast.log" | sed 's/^ *//' 884 printf 'RESULT pass=%d fail=0\n' "$N"