code wiki / _hdl_build / nx_search_quality_gate.nx
nx_search_quality_gate.nx
buildroot/runtime/_hdl_build/nx_search_quality_gate.nx
about
nx_search_quality_gate.nx -- the ENGINEER's re-runnable instrument for the search engine (same pattern that
took andelinwest 700->1000: data-driven criteria TABLE -> grade the REAL artifact -> durable log -> find->
fix->re-prove). Criteria live in knowledge/index/search_oracle.tsv (rows: "query terms<TAB>expected-top-doc");
EXPANDING the gate = adding a row, not a code change. Each row fork/execs the LIVE /tmp/nx_search_cli.sov.elf
(the artifact users run, not a reimplementation), captures stdout, finds the expected doc's rank. Row passes
iff rank==1; score = MRR permil (1000/rank, 0 if absent). Verdict appends to
knowledge/status/search_quality.log (durable). Ground truth per row was grep-verified at authoring.
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 11 | const SQ_MAX_ROWS: i64 = 64 |
| 12 | const SQ_MAX_TERMS: i64 = 8 |
| 13 | const SQ_OUT_PATH_S: i64 = 0 // (doc anchor) |
functions
| 15 | func sq_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 16 | func sq_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;k=1}; while m>0{t[k]=48+(m%10);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 } |
| 17 | func sq_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 } |
| 18 | func sq_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);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 } |
| 20 | func sq_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: sq_find |
| 23 | func sq_find(hay: *u8, n: i64, needle: *u8) -> i64 |
| 38 | func sq_run_cli(terms: *i64, nterms: i64, out_path: *u8) -> i64 |
| 60 | func sq_rank_of(out_buf: *u8, out_len: i64, expected: *u8) -> i64 |
| 78 | func main() -> i64 |