code wiki / _hdl_build / nx_parity_judge_gate.nx
nx_parity_judge_gate.nx source
↩ module page · 64 lines · 4715 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 -> STRIP-COLLAPSE (2) near-black + a hairline strip (the HUMAN said STRIP on 2026-07-16; the
10// pin was held at BLANK only while the render carried <2pm ink. RE-PINNED
11// 2026-08-19 to the human's own word: the 2026-08-18 capture reads 4pm ink
12// and the organ now returns STRIP-COLLAPSE, i.e. it sees what the human saw)
13// ⚠2026-08-19 MEASURED on the laptop's 2026-08-18 capture set (bench/top20 is laptop-resident; this NAS copy
14// abstains): 4 of 6 reproduce the truth set; google's Nishi render is NO LONGER BLANK (search box, buttons,
15// footer render; organ says CONTENT-OK, ink 9pm spread80 368pm) -- the BROWSER improved, so the google pin
16// is a fossil awaiting the operator's eyeball. A seat's read nominates; it does not re-pin.
17// Fixture volatility: paths point at bench/top20 (regenerated by every suite run); if a site's live page
18// changes class legitimately, re-pin WITH an eyeball.
19// MIGRATED onto nx_gate_verdict 2026-08-11 (D001): the old g_case returned 1 for FIXTURE MISSING exactly
20// like a misclassification, so an absent bench/ read as a classifier regression. Missing fixtures are now
21// gv_need preconditions -> verdict=SKIP exit 3 (evidence=none), never RED; the six classification checks
22// are unchanged and their FAIL direction still exits 1 via gv_verdict.
23// license_tier: ORIGINAL expect_exit: 0
24import "nx_parity_judge.nx"
25import "nx_gate_verdict.nx"
26
27func 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 }
28func 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 }
29
30// 0 = classified as the human did, 1 = misclassified, 2 = fixture missing (precondition, not evidence)
31func g_case(oracle: *u8, nishi: *u8, want: i64, label: *u8) -> i64 {
32 let a: *VdImg = vd_load(oracle)
33 let b: *VdImg = vd_load(nishi)
34 if (a as i64) == 0 { return 2 }
35 if (b as i64) == 0 { return 2 }
36 let got: i64 = rj_classify(a, b, 44)
37 g_w(" " as *u8); g_w(label); g_w(": want=" as *u8); g_n(want); g_w(" got=" as *u8); g_n(got); g_w("\n" as *u8)
38 if got == want { return 0 }
39 return 1
40}
41
42// one truth-set row: missing fixture -> gv_need (SKIP lane); present -> gv_check on the classification.
43func g_row(oracle: *u8, nishi: *u8, want: i64, label: *u8, ctr: *i64) -> i64 {
44 let rc: i64 = g_case(oracle, nishi, want, label)
45 if rc == 2 { gv_need(label, 0, ctr); return 0 }
46 var ok: i64 = 0
47 if rc == 0 { ok = 1 }
48 gv_check(label, ok, ctr)
49 return 0
50}
51
52func main() -> i64 {
53 gv_head("=== nx_parity_judge_gate -- the organ eye vs the HUMAN truth set (top-20, 2026-07-16) ===" as *u8)
54 let ctr: *i64 = gv_ctr()
55 g_row("bench/top20/google_chrome_top.png" as *u8, "bench/top20/google_nishi_f0.png" as *u8, 1, "google blank-that-fooled-parity" as *u8, ctr)
56 g_row("bench/top20/bing_chrome_top.png" as *u8, "bench/top20/bing_nishi_f0.png" as *u8, 5, "bing oracle-itself-blank" as *u8, ctr)
57 g_row("bench/top20/wikipedia_chrome_top.png" as *u8, "bench/top20/wikipedia_nishi_f0.png" as *u8, 0, "wikipedia best-real-render" as *u8, ctr)
58 g_row("bench/top20/github_chrome_top.png" as *u8, "bench/top20/github_nishi_f0.png" as *u8, 3, "github canvas-theme-off" as *u8, ctr)
59 g_row("bench/top20/linkedin_chrome_top.png" as *u8, "bench/top20/linkedin_nishi_f0.png" as *u8, 4, "linkedin text-full-decor-missing" as *u8, ctr)
60 g_row("bench/top20/netflix_chrome_top.png" as *u8, "bench/top20/netflix_nishi_f0.png" as *u8, 2, "netflix hairline-strip (human said STRIP)" as *u8, ctr)
61 let rc: i64 = gv_verdict("PARITY-JUDGE" as *u8, ctr, "the organ sees what the human saw on real top-20 captures" as *u8)
62 sys_exit(rc)
63 return rc
64}