code wiki / _hdl_build / nx_wiki_answer_gate.nx

nx_wiki_answer_gate.nx

buildroot/runtime/_hdl_build/nx_wiki_answer_gate.nx

5728 B84 linesdepth 7pulls 13 transitivereach 0 importersview sourcekind gate/prooftopic wiki
docsdependenciesstructsconstsfunctions

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

nx_wiki_answer.nx nx_wiki_answer_gate.nx

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

main wg_puts wg_check_ok wa_new answer answer_ex wa_strlen sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close wa_lookup_site wa_streq nx_inv_load sys_read_file ↻ nx_inv_is_token_char nx_inv_query_term nx_inv_hash_bytes_lower nx_inv_lookup_slot nx_inv_slot_at nx_inv_slot_hash nx_inv_slot_postings_count nx_inv_slot_postings_offse nx_inv_slot_write_cursor wa_fold bmf_score re_count re_strlen bmf_contrib bmf_df re_count ↻ bm_idf_micro bm_ln_micro wa_read_threshold sys_read_file ↻ wa_strlen ↻ nx_search_query_init sys_mmap ↻

structs

none

consts

none

functions

27func 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 }
28func 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 }
29func 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
30func 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
31func 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
32func wg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
35func wg_check_ok(query: *u8, expect: *u8) -> i64
49func wg_check_no_answer(query: *u8) -> i64
60func main() -> i64