code wiki / _hdl_build / nx_honesty_grade_gate.nx

nx_honesty_grade_gate.nx source

↩ module page · 60 lines · 3354 B

1// nx_honesty_grade_gate.nx -- proves the shared cynical bar (nx_honesty_grade_lib) actually downgrades 2// optimism and cannot be talked up. license_tier: ORIGINAL expect_exit: 0 3import "nx_syscalls.nx" 4import "nx_honesty_grade_lib.nx" 5 6func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 7func wn(v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; 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(28); var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } 8func ck(pass: i64, label: *u8, fails: *i64) -> i64 { 9 w(" " as *u8); w(label); w(": " as *u8) 10 if pass==1 { w("PASS\n" as *u8) } else { w("FAIL\n" as *u8); fails[0]=fails[0]+1 } 11 return 0 12} 13 14func main() -> i64 { 15 let fails: *i64 = sys_mmap(16) as *i64 16 fails[0]=0 17 w("=== nx_honesty_grade_gate -- the cynical bar downgrades optimism, cannot be talked up ===\n" as *u8) 18 19 // T1: a REAL claim on a STUB (9-word lexicon) is capped at STUB, not honored 20 var t1: i64=0 21 if hg_grade(HG_REAL, "9-word lexicon, 5 langs" as *u8)==HG_STUB { t1=1 } 22 ck(t1, "T1 REAL claim + stub-tell (lexicon) -> capped at STUB" as *u8, fails) 23 24 // T2: a REAL claim with no active non-synthetic proof is capped at PARTIAL (free-of-tells is not enough) 25 var t2: i64=0 26 if hg_grade(HG_REAL, "gated decision logic at /connect" as *u8)==HG_PARTIAL { t2=1 } 27 ck(t2, "T2 REAL claim without a live/production proof -> capped at PARTIAL" as *u8, fails) 28 29 // T3: an HONEST REAL claim (clean + active proof) is KEPT -- the bar is accurate, not merely negative 30 var t3: i64=0 31 if hg_grade(HG_REAL, "TLS 1.3 live, cert-validated, serves nishifamily.com over the wire" as *u8)==HG_REAL { t3=1 } 32 ck(t3, "T3 REAL claim with live+cert-validated proof -> KEPT REAL (accurate, not just cynical)" as *u8, fails) 33 34 // T4: NEG-CONTROL -- an OPTIMISTIC grader that skips hg_grade keeps the toy at REAL; hg_grade fixes it 35 let claimed: i64 = HG_REAL 36 var t4: i64=0 37 if claimed==HG_REAL { if hg_grade(claimed, "in-memory demo, per-session" as *u8)==HG_STUB { t4=1 } } 38 ck(t4, "T4 NEG-CONTROL: naive grader keeps demo=REAL; hg_grade downgrades it to STUB" as *u8, fails) 39 40 // T5: DEFAULT SKEPTICAL -- an absent/unknown claim stays ABSENT, never drifts up 41 var t5: i64=0 42 if hg_grade(HG_ABSENT, "no push; no real presence" as *u8)==HG_ABSENT { t5=1 } 43 ck(t5, "T5 default skeptical: absent stays absent" as *u8, fails) 44 45 // T6: readiness math is honest -- 8 stubs + 3 absent over 11 items = 8/33 46 var t6: i64=0 47 if hg_readiness(8, 11)==242 { t6=1 } 48 ck(t6, "T6 readiness(8 of 11 items, level 1 each) = 242 permil (honest denominator)" as *u8, fails) 49 50 // T7: PARTIAL claim with a stub-tell also drops to STUB (downgrades dominate at every level) 51 var t7: i64=0 52 if hg_grade(HG_PARTIAL, "real f32 serve but single-box" as *u8)==HG_STUB { t7=1 } 53 ck(t7, "T7 PARTIAL + stub-tell (single-box) -> STUB (downgrade dominates)" as *u8, fails) 54 55 w(" fails=" as *u8); wn(fails[0]); w("\n" as *u8) 56 if fails[0]==0 { w("VERDICT: verdict=GREEN (shared cynical bar: downgrades optimism, keeps honest REALs, defaults skeptical)\n" as *u8); sys_exit(0) } 57 w("VERDICT: verdict=RED\n" as *u8) 58 sys_exit(1) 59 return 1 60}