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 '
" || 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 '$(cat "$T/base.out$route")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" <
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 "
" "$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/.*$CMD\(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 '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
Write to someone@example.org today.
'; refused 'email address' c 'email address' 479 tree c; add c ''; 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 ''; 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/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---\nNew.
\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" '/
' "$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 '