code wiki / _hdl_build / _wiki_backlinks_gate.nx
_wiki_backlinks_gate.nx
buildroot/runtime/_hdl_build/_wiki_backlinks_gate.nx
about
_wiki_backlinks_gate.nx -- WIKI R4 GATE: backlinks + auto-TOC + static graph.
Re-proves, from a REAL run (no fabricated GREEN), the three R4 affordances on
GROUND TRUTH (substrings + ground-truth counts in the actually-produced
output), never a bare rc==const:
SEED a doc store with three pages:
alpha -- body has NO wikilinks.
beta -- body is "[[alpha]]".
gamma -- body is "[[alpha]] [[beta]] [[ZzqMissing]]".
backlinks_ok alpha's backlinks include BOTH beta AND gamma;
beta's backlinks include gamma; gamma's are EMPTY.
(the inversion of the forward [[wikilinks]] is correct)
toc_ok the TOC for a body "# Title / ## Section A / ## Section B"
contains BOTH "#section-a" and "#section-b" anchor links,
AND id-injection stamps id="section-a" onto the <h2>.
(TOC links jump to real injected ids)
graph_ok node_count==3 AND edge_count==3 (beta->alpha, gamma->alpha,
gamma->beta). The [[ZzqMissing]] reference is NOT a node and
NOT an edge -- it is rot.
rot_ok gamma's [[ZzqMissing]] is flagged broken (broken_count>=1).
Verdict line (judged by this marker; stdout + knowledge/status):
WIKIBACKLINKS backlinks_ok=<0|1> toc_ok=<0|1> graph_ok=<0|1> rot_ok=<0|1>
verdict=GREEN|RED
Pure NishiLang, NO SQL, NO .sh/.py/.js, no new .tsv/.conf. nx_sites_daemon
UNTOUCHED. Imports the three R4 organs under test; each shared base module is
imported via a single consistent path (the doc-store + syscalls come in
transitively through the R4 organs -- imported here only as needed) to avoid
the double-import nxasm rc6 trap.
license_tier: ORIGINAL
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_wiki_index_builder.nxnx_wiki_backlinks.nxnx_wiki_toc.nxnx_wiki_graph.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 40 | const WBG_LOG: *u8 = "knowledge/status/wiki_backlinks_gate.log" |
| 41 | const WBG_OUTCAP: i64 = 262144 // per-render output buffer (256 KiB) |
functions
| 44 | func wbg_w(fd: i64, s: *u8) -> i64 |
| 50 | func wbg_n(fd: i64, v: i64) -> i64 |
| 64 | func wbg_w2(lfd: i64, s: *u8) -> i64 { wbg_w(1, s); if lfd >= 0 { wbg_w(lfd, s) } return 0 } |
| 65 | func wbg_n2(lfd: i64, v: i64) -> i64 { wbg_n(1, v); if lfd >= 0 { wbg_n(lfd, v) } return 0 } |
| 66 | func wbg_p(s: *u8) -> i64 { wbg_w(1, s); return 0 } |
| 67 | func wbg_pn(v: i64) -> i64 { wbg_n(1, v); return 0 } |
| 68 | func wbg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 71 | func wbg_find(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 89 | func wbg_has(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 95 | func wbg_rowid_in(arr: *i64, cnt: i64, r: i64) -> i64 called by 1: main |
| 104 | func main() -> i64 |