nx_image_index_gate.nx
buildroot/runtime/nx_image_index_gate.nx
about
nx_image_index_gate.nx -- referee for the REAL-CORPUS ingestor (nx_image_index).
Unlike the search gate (synthetic raw-gray buffers), this builds REAL encoded PNG files at runtime
(valid signature + IHDR + zlib stored-block IDAT + IEND, with chunk CRC-32s and the zlib Adler-32
computed by the shipped substrate primitives -- same technique as nx_png_real_smoke), writes them to
/tmp, forks+execs the REAL /tmp/nx_image_index.sov.elf over them, and verifies the produced
fingerprint index. Because each PNG is filled RGB=(v,v,v), Rec.709 luma == v, so the FULL decode path
(inflate -> unfilter -> RGB -> gray -> dHash) must reproduce the KNOWN dHashes proven in the search
gate -- a true end-to-end KAT, checkable by pure string match:
row1 grad-up -> dHash 0000000000000000 (decode->gray->dHash correct, end to end)
row2 +bright -> dHash 0000000000000000 (brightness invariance survives a real PNG round-trip)
row3 grad-down -> dHash ffffffffffffffff (second KAT, opposite extreme)
row4 mid -> present and DISTINCT from grad-up
row5 corrupt -> SKIPPED (graceful degradation, Cardinal 14 -- one bad file can't abort a crawl)
row6 summary -> ingestor exit 0, indexed=4 skipped=1
GREEN iff 6/6. Durable verdict appends to knowledge/status/image_index_gate.log. license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_crc32.nxnx_adler32.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
| 20 | func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 21 | func g_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 } |
| 22 | func g_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 } |
| 23 | func g_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 } |
| 24 | func g_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 26 | func g_write_bytes(path: *u8, buf: *u8, n: i64) -> i64 |
| 33 | func g_write_file(path: *u8, data: *u8) -> i64 { return g_write_bytes(path, data, g_strlen(data)) } |
| 34 | func g_read_small(path: *u8, buf: *u8, cap: i64) -> i64 |
| 43 | func g_find(hay: *u8, n: i64, needle: *u8) -> i64 |
| 55 | func g_contains(hay: *u8, n: i64, needle: *u8) -> i64 { if g_find(hay,n,needle)>=0 { return 1 } return 0 } |
| 58 | func gp_wbe(buf: *u8, off: i64, val: i64) -> i64 called by 1: gp_build |
| 65 | func gp_val(kind: i64, x: i64, w: i64, bright: i64) -> i64 called by 1: gp_build |
| 75 | func gp_build(out: *u8, w: i64, h: i64, kind: i64, bright: i64) -> i64 |
| 120 | func g_run(corpus: *u8, outidx: *u8, outcap: *u8) -> i64 |
| 138 | func main() -> i64 |