code wiki / _hdl_build / nx_wiki_answer_gate.nx
nx_wiki_answer_gate.nx
buildroot/runtime/_hdl_build/nx_wiki_answer_gate.nx
about
nx_wiki_answer_gate.nx -- KAT RELEVANCE + TEETH for the instant-answer organ (IMS Thrust B rung 1).
The engineer's re-runnable instrument: import nx_wiki_answer, call answer() in-process over the COMMITTED
live wiki index (knowledge/index/wiki.idx + .manifest, registered in knowledge/index/onsite_sites.tsv),
and assert -- for a fixed query -> correct-source oracle -- that:
* the verdict is WA_OK,
* the source slug is EXACTLY the expected page slug (the slug-garble bug regression check),
* the answer snippet is NON-EMPTY (we actually surfaced a passage, not just a verdict),
and that the NONSENSE query "xyzzy qwffz" returns WA_NO_ANSWER (TEETH: no fabrication, the threshold gate
refuses rather than inventing an answer).
KAT oracle (query -> expected slug):
"zero trust access" -> access_wall
"NIST STEM maturity" -> nist_stem
"capitalism lab game" -> econsim
"genesis genealogy lineage" -> genesis_genealogy
"rollback versions" -> devlog (holds the versioning/rollback prose)
"chacha beats openssl" -> simd_backend (the measured ~3% Zen1 exceed -- batch #2)
"sovereign desktop operating system microkernel" -> nishi_os (the OS substrate page -- batch #2)
"xyzzy qwffz" -> WA_NO_ANSWER (teeth)
GREEN iff all 8 rows pass. Durable verdict appends to knowledge/status/wiki_answer_gate.log.
REUSE not reinvent: the whole search stack (registry lookup, BM25F, snippet extract, threshold) IS
nx_wiki_answer; this gate only feeds it the oracle and checks the verdict/slug/snippet it returns.
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_wiki_answer.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
| none |
functions
| 27 | func wg_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 28 | func wg_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 } |
| 29 | func wg_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } called by 1: main |
| 30 | func wg_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } called by 1: main |
| 31 | func wg_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i] { return 0 } i=i+1 } if b[i]!=(0 as u8) { return 0 } return 1 } called by 1: wg_check_ok |
| 32 | func wg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 35 | func wg_check_ok(query: *u8, expect: *u8) -> i64 |
| 49 | func wg_check_no_answer(query: *u8) -> i64 |
| 60 | func main() -> i64 |