code wiki / _hdl_build / nx_internal_sweep_gate.nx
nx_internal_sweep_gate.nx source
↩ module page · 57 lines · 3495 B
1// nx_internal_sweep_gate.nx -- the INTERNAL-ONLY S-class sweep (operator: "we need customer-facing AND internal-only
2// s-class exceed"; "can a person understand all those"). Reads the CAPTURED REAL OUTPUT of the hidden tools (the
3// census/PM scorecard, capability-audit, exceed-standard, clarity, researcher) and grades each on CLARITY (self-
4// describing real words, not cryptic codes) + a clear human-readable VERDICT + lean size = "a person can understand
5// it without a manual". A cryptic-log neg-control MUST be flagged not-S-class (proves the sweep discriminates).
6// REUSE: nx_clarity. 100% sovereign. expect_exit: 0
7import "nx_syscalls.nx"
8import "nx_sitegate_emit_lib.nx"
9import "nx_clarity.nx"
10import "nx_exceed_standard.nx"
11import "nx_brand_tokens.nx"
12
13
14func has(s: *u8, n: i64, lit: *u8) -> i64 { if bt_find(s, n, lit, bt_len(lit)) >= 0 { return 1 } return 0 }
15
16// grade one captured internal-tool output. expect = 1 (real tool must be S-class) / 0 (neg-control must not be).
17func sweep_one(path: *u8, name: *u8, expect: i64, tot: *i64) -> i64 {
18 let lp: *i64 = sys_mmap(16) as *i64
19 let out: *u8 = sys_read_file(path, lp)
20 if (out as i64) == 0 { gw(" MISS " as *u8); gw(name); gw(" (no captured output)\n" as *u8); tot[1]=tot[1]+1; return 0 }
21 let n: i64 = lp[0]
22 let words: i64 = cl_word_count(out, n)
23 var sd: i64 = 0; if words >= 10 { sd = 1 }
24 var verdict: i64 = 0
25 if has(out, n, "VERDICT" as *u8) == 1 { verdict = 1 }
26 if has(out, n, "GREEN" as *u8) == 1 { verdict = 1 }
27 if has(out, n, "PASS" as *u8) == 1 { verdict = 1 }
28 var lean: i64 = 0; if n > 0 { if n < 300000 { lean = 1 } }
29 var sclass: i64 = 0; if sd == 1 { if verdict == 1 { if lean == 1 { sclass = 1 } } }
30 gw(" " as *u8); gw(name); gw(": bytes=" as *u8); gn(n); gw(" words=" as *u8); gn(words); gw(" verdict=" as *u8); gn(verdict); gw(" -> S-class=" as *u8); gn(sclass)
31 var ok: i64 = 0; if sclass == expect { ok = 1 }
32 if ok == 1 { gw(" [ok]\n" as *u8); tot[0]=tot[0]+1 } else { gw(" [FAIL]\n" as *u8); tot[1]=tot[1]+1 }
33 return sclass
34}
35
36func main() -> i64 {
37 let tot: *i64 = sys_mmap(32) as *i64
38 tot[0]=0; tot[1]=0
39 gw("=== nx_internal_sweep_gate -- hidden tools held to the standard ('can a person understand all those') ===\n" as *u8)
40
41 var nsc: i64 = 0
42 nsc = nsc + sweep_one("/tmp/sweep_census.txt" as *u8, "census (PM scorecard) " as *u8, 1, tot)
43 nsc = nsc + sweep_one("/tmp/sweep_audit.txt" as *u8, "capability_audit " as *u8, 1, tot)
44 nsc = nsc + sweep_one("/tmp/sweep_standard.txt" as *u8, "exceed_standard " as *u8, 1, tot)
45 nsc = nsc + sweep_one("/tmp/sweep_clarity.txt" as *u8, "clarity " as *u8, 1, tot)
46 nsc = nsc + sweep_one("/tmp/sweep_research.txt" as *u8, "researcher signal-scan " as *u8, 1, tot)
47 sweep_one("/tmp/sweep_cryptic.txt" as *u8, "NEG-CONTROL cryptic log " as *u8, 0, tot)
48
49 gw(" internal tools clarity-S-class = " as *u8); gn(nsc); gw(" / 5\n" as *u8)
50 let ix: i64 = es_is_sclass_exceed(ES_EFFICIENCY, ES_INTERNAL, nsc, 0, 5)
51 t_row("INTERNAL clarity exceed via the standard (all 5 hidden tools understandable)" as *u8, ix, tot)
52
53 gw("\nrows pass=" as *u8); gn(tot[0]); gw(" fail=" as *u8); gn(tot[1]); gw("\n" as *u8)
54 if tot[1] == 0 { gw("VERDICT=GREEN -- the hidden tools are internal-only S-class on clarity (a person understands their output); neg-control caught.\n" as *u8); return 0 }
55 gw("VERDICT=RED\n" as *u8)
56 return 1
57}