Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them.
Page: /drakestapleton/interplane-forge/blob/main/research/tests/authors.sh
# interplane-forge
INTERPLANE Forge
Brought by drakestapleton
Sign in to star 0 stars 0 watching
About Files History Releases Proposed changes Issues For developers
branch `main` Branches Tags History
`interplane-forge / research / tests / authors.sh`
236 lines ยท 19225 bytes Raw Blame History
1 #!/bin/sh
2 # Sourced by tests/run.sh after T/build is compiled and T, C, gen, ok and bad exist.
3 # No new compiler or host-language implementation: fixtures use the actual builder/publisher.
4 mkdir -p "$T/authors" "$T/auth-reg/show" "$T/auth-reg/text"
5 cat > "$T/authors/alice.tsv" <<'DATA'
6 O id alice
7 O name Alice "&'
13 S foreign-a Summary &
14 A foreign-a Abstract
15 C foreign-a Alice & Bob
16 B foreign-a Alice }evil{\%_$
17 K foreign-a
18 L foreign-a references http://example.org/insecure-link
19 L foreign-a references javascript:alert(1)
20 L foreign-a references https://example.org/"'&<>
21 F foreign-a File "&' 12bytes http://example.org/insecure-file
22 F foreign-a File "&' 12bytes https://example.org/file?x="'&<>
23 P foreign-a zenodo did:key:zAlice 2026-11-11 https://zenodo.org/records/1 1
24 DATA
25 cat > "$T/authors/bob.tsv" <<'DATA'
26 O id bob
27 O name Bob Separate
28 O orcid
29 O added-by did:key:zBob
30 O via radicle
31 O checked 2026-11-11
32 W foreign-b 2025-01-01 preprint Radicle 1 1 0 custom Bob metadata work
33 S foreign-b Metadata without text
34 A foreign-b A metadata-only abstract
35 C foreign-b Bob Separate
36 P foreign-b radicle did:key:zBob 2026-11-11 rad:zRepo 0
37 G foreign-b `0123456789abcdef0123456789abcdef01234567` `0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef`
38 DATA
39 for id in alice bob; do
40 gen merge '' "$T/authors/$id.tsv" > "$T/authors/$id.merged"
41 cp "$T/authors/$id.tsv" "$T/auth-reg/show/$id.tsv"
42 done
43 cat "$C" "$T/authors/alice.merged" "$T/authors/bob.merged" > "$T/authors/catalog"
44 ac=$T/authors/catalog
45 gen authors '' "$ac" > "$T/authors/ids"
46 is "$(cat "$T/authors/ids")" "$(printf 'drakestapleton\nalice\nbob')" 'authors returns validated separate IDs'
47 is "$(grep -c '^O' "$T/authors/alice.merged" || :)" 0 'merge removes foreign O lines'
48 grep -Fq "$(printf 'J\tforeign-a\talice')" "$T/authors/alice.merged" && ok 'merge joins work to author' || bad 'missing merge join'
49 for id in alice bob drakestapleton; do gen author "$id" "$ac" > "$T/authors/$id.html"; done
50 grep -Fq "/research/foreign-a'" "$T/authors/alice.html" && ok 'Alice page lists her work' || bad 'Alice work absent'
51 is "$(grep -c '/research/foreign-b' "$T/authors/alice.html" || :)" 0 'Alice page excludes Bob work'
52 grep -Fq "/research/foreign-b'" "$T/authors/bob.html" && ok 'Bob page lists his work' || bad 'Bob work absent'
53 is "$(grep -c '/research/foreign-a' "$T/authors/bob.html" || :)" 0 'Bob page excludes Alice work'
54 grep -Fq 'Alice <script> "&'' "$T/authors/alice.html" && ok 'author HTML escaped' || bad 'author name not escaped'
55 gen index '' "$ac" > "$T/authors/index.html"
56 gen json '' "$ac" > "$T/authors/index.json"
57 for id in alice bob; do
58 grep -Fq "/research/authors/$id'" "$T/authors/index.html" && ok "hub links $id" || bad "hub missing $id"
59 grep -Fq "\"author_ids\":[\"$id\"]" "$T/authors/index.json" && ok "JSON joins $id" || bad "JSON missing $id"
60 done
61 for mode in work wjson wbib; do gen "$mode" foreign-a "$ac" > "$T/authors/$mode"; done
62 is "$(grep -Eic ' \"' "$T/authors/wjson" && ok 'JSON quotes foreign title' || bad 'JSON title escaping'
65 is "$(grep -Ec 'http://|javascript:' "$T/authors/work" "$T/authors/wjson" | cut -d: -f2 | sort -u)" 0 'foreign HTML and JSON omit non-https links'
66 grep -Fq '"bytes":12' "$T/authors/wjson" && ok 'foreign file bytes numeric' || bad 'foreign file bytes invalid'
67 grep -Fq '"versions":2,' "$T/authors/wjson" && ok 'foreign versions numeric' || bad 'foreign versions invalid'
68 is "$(grep -c '}evil{' "$T/authors/wbib" || :)" 0 'foreign DOI and author cannot close BibTeX values'
69 grep -Fq 'doi = {10.1/x evil \%\&\#\_\$}' "$T/authors/wbib" && ok 'foreign DOI BibTeX punctuation escaped' || bad 'foreign DOI escaping wrong'
70 gen corpus '' "$ac" > "$T/authors/corpus-list"
71 grep -q '^foreign-a' "$T/authors/corpus-list" && ok 'open P admits foreign text' || bad 'open text missing'
72 is "$(grep -c '^foreign-b' "$T/authors/corpus-list" || :)" 0 'closed P excludes foreign text'
73 sed '/^P[[:space:]]foreign-a/d' "$ac" > "$T/authors/no-p"
74 gen corpus '' "$T/authors/no-p" > "$T/authors/no-p-list"
75 is "$(grep -c '^foreign-a' "$T/authors/no-p-list" || :)" 0 'missing P fails closed for text'
76 for mode in add doi; do
77 gen "$mode" '' "$ac" > "$T/authors/$mode.html"
78 is "$(grep -Eic '