code wiki / _hdl_build / nx_parity_judge_gate.nx
nx_parity_judge_gate.nx source
↩ module page · 43 lines · 3418 B
1// nx_parity_judge_gate.nx -- PROOF the ORGAN EYE classifies like the human did (the operator's bar:
2// "the workflow isnt complete until you [the Nishi team] see the exact same issues i see without your
3// or my involvement"). The truth set = REAL top-20 suite captures a human eyeballed on 2026-07-16:
4// google -> BLANK-NISHI (1) blank render that fooled the parity metric at 97.3%
5// bing -> NO-ORACLE-CONTENT(5) headless Chrome itself served blank
6// wikipedia -> CONTENT-OK (0) the best real render
7// github -> CANVAS-OFF (3) white vs attribute-selector dark theme
8// linkedin -> SPARSE-NISHI (4) full text, missing decoration/columns
9// netflix -> BLANK-NISHI (1) near-black + a hairline strip (human said STRIP; blank accepted as
10// the honest coarser read -- the strip class needs >=2pm ink)
11// Fixture volatility: paths point at bench/top20 (regenerated by every suite run); if a site's live page
12// changes class legitimately, re-pin WITH an eyeball. license_tier: ORIGINAL expect_exit: 0
13import "nx_parity_judge.nx"
14
15func g_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
16func g_n(v: i64) -> i64 { let t: *u8=sys_mmap(24); var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} 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} let b: *u8=sys_mmap(24); var j: i64=0; while j<k{b[j]=t[k-1-j];j=j+1} sys_write(1,b,k); return 0 }
17
18func g_case(oracle: *u8, nishi: *u8, want: i64, label: *u8) -> i64 {
19 let a: *VdImg = vd_load(oracle)
20 let b: *VdImg = vd_load(nishi)
21 g_w(" " as *u8); g_w(label); g_w(": " as *u8)
22 if (a as i64) == 0 { g_w("FIXTURE MISSING (oracle)\n" as *u8); return 1 }
23 if (b as i64) == 0 { g_w("FIXTURE MISSING (nishi)\n" as *u8); return 1 }
24 let got: i64 = rj_classify(a, b, 44)
25 g_w(" want=" as *u8); g_n(want); g_w(" got=" as *u8); g_n(got)
26 if got == want { g_w(" PASS\n" as *u8); return 0 }
27 g_w(" FAIL\n" as *u8)
28 return 1
29}
30
31func main() -> i64 {
32 g_w("=== nx_parity_judge_gate -- the organ eye vs the HUMAN truth set (top-20, 2026-07-16) ===\n" as *u8)
33 var fails: i64 = 0
34 fails = fails + g_case("bench/top20/google_chrome_top.png" as *u8, "bench/top20/google_nishi_f0.png" as *u8, 1, "google blank-that-fooled-parity" as *u8)
35 fails = fails + g_case("bench/top20/bing_chrome_top.png" as *u8, "bench/top20/bing_nishi_f0.png" as *u8, 5, "bing oracle-itself-blank" as *u8)
36 fails = fails + g_case("bench/top20/wikipedia_chrome_top.png" as *u8, "bench/top20/wikipedia_nishi_f0.png" as *u8, 0, "wikipedia best-real-render" as *u8)
37 fails = fails + g_case("bench/top20/github_chrome_top.png" as *u8, "bench/top20/github_nishi_f0.png" as *u8, 3, "github canvas-theme-off" as *u8)
38 fails = fails + g_case("bench/top20/linkedin_chrome_top.png" as *u8, "bench/top20/linkedin_nishi_f0.png" as *u8, 4, "linkedin text-full-decor-missing" as *u8)
39 fails = fails + g_case("bench/top20/netflix_chrome_top.png" as *u8, "bench/top20/netflix_nishi_f0.png" as *u8, 1, "netflix near-blank-hairline" as *u8)
40 if fails == 0 { g_w("NX-PARITY-JUDGE GREEN -- the organ sees what the human saw (6/6 on real captures)\n" as *u8); sys_exit(0); return 0 }
41 g_w("NX-PARITY-JUDGE RED fails=" as *u8); g_n(fails); g_w("\n" as *u8)
42 sys_exit(1); return 1
43}