code wiki / _hdl_build / _wiki_wikilink_gate.nx
_wiki_wikilink_gate.nx
buildroot/runtime/_hdl_build/_wiki_wikilink_gate.nx
about
_wiki_wikilink_gate.nx -- THE LIVE-[[WIKILINK]] GATE.
Re-proves, from a REAL run (never a fabricated GREEN), that served
[[wikilink]] cross-references actually WORK -- they render as LIVE clickable
<a> anchors (resolved) or clean broken-spans (missing), NOT as html-escaped
dead text (<a ...) and NOT always-broken. Judged on GROUND-TRUTH SUBSTRINGS
in the actually-served HTML, driven through the SAME handler the daemon forks
(nx_wiki_doc_handle) -- never a bare rc==const.
THE TWO BUGS THIS KILLS (both pre-existing):
1. ESCAPED -- the preprocessor expanded [[X]] -> <a ...> BEFORE markdown,
so markdown_inline html-escaped the '<','>' to <,> and
the link served as DEAD TEXT. FIX: resolve [[X]] in a
POST-markdown pass, emitting the <a> RAW (never re-escaped).
2. BROKEN -- the handler init'd the resolver with doc_names_count=0 (a
16-arg IR cap trimmed the names arg), so EVERY [[X]] resolved
to a broken-span even when X existed. FIX: derive the
known-page set FROM THE STORE the handler holds.
SEED a doc store with two pages:
realpage -- a real page (URL /wiki/realpage), so [[realpage]] resolves.
linker -- body "...[[realpage]]... [[zzqmissing]]..." (URL /wiki/linker);
the page under test. zzqmissing is NOT a page -> broken-span.
live_ok the served HTML contains a LIVE <a href="/wiki/realpage"
(NOT <a, NOT a broken-span for realpage).
not_escaped the served HTML does NOT contain "<a href=" ANYWHERE
(no dead html-escaped anchor leaked through).
broken_ok [[zzqmissing]] rendered to <span class="wikilink-broken".
Verdict line (stdout + knowledge/status/wiki_wikilink_gate.log):
WIKILINKLIVE live_ok=<0|1> not_escaped=<0|1> broken_ok=<0|1> verdict=GREEN|RED
Pure NishiLang, NO SQL, NO .sh/.py/.js, no new .tsv/.conf. nx_sites_daemon
UNTOUCHED. Imports the served handler under test; each shared base module
resolves via a single canonical path to avoid the nxasm rc6 double-import.
license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_wiki_index_builder.nxnx_wiki_doc_handler.nxnx_artifact_store.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
| 43 | const WLG_LOG: *u8 = "knowledge/status/wiki_wikilink_gate.log" |
| 44 | const WLG_RESP_CAP: i64 = 2097152 // 2 MiB served-response buffer |
functions
| 47 | func wlg_w(fd: i64, s: *u8) -> i64 |
| 53 | func wlg_n(fd: i64, v: i64) -> i64 |
| 66 | func wlg_w2(lfd: i64, s: *u8) -> i64 { wlg_w(1, s); if lfd >= 0 { wlg_w(lfd, s) } return 0 } |
| 67 | func wlg_n2(lfd: i64, v: i64) -> i64 { wlg_n(1, v); if lfd >= 0 { wlg_n(lfd, v) } return 0 } |
| 68 | func wlg_p(s: *u8) -> i64 { wlg_w(1, s); return 0 } |
| 69 | func wlg_pn(v: i64) -> i64 { wlg_n(1, v); return 0 } |
| 70 | func wlg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 73 | func wlg_find(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 91 | func wlg_has(hay: *u8, hn: i64, needle: *u8) -> i64 calls 1: wlg_find |
| 96 | func main() -> i64 |