code wiki / _hdl_build / nx_uiq_perf_gate.nx

nx_uiq_perf_gate.nx source

↩ module page · 29 lines · 1938 B

1// nx_uiq_perf_gate.nx -- KAT gate for the static Core-Web-Vitals predictor. 2// Proves each counter (blocking-css / blocking-js / unsized-img) on known fixtures + a neg-control, before 3// any page is judged. Deterministic sovereign gate. license_tier: ORIGINAL expect_exit: 0 4import "nx_uiq_perf.nx" 5import "nx_gate_verdict.nx" 6 7func main() -> i64 { 8 uiq_w("=== nx_uiq_perf_gate -- static CWV predictor ===\n" as *u8) 9 let f: i64 = uiq_perf_selftest() 10 uiq_w("selftest checks failed=" as *u8); uiq_pn(f); uiq_w("\n" as *u8) 11 uiq_w("demo (2 blocking-css + 1 blocking-js + 1 unsized): " as *u8) 12 let d: *u8 = "<link rel=\"stylesheet\" href=\"a.css\"><link rel=\"stylesheet\" href=\"c.css\"><script src=\"x.js\"></script><img src=\"a.png\"><p>x</p>" as *u8 13 var dn: i64=0; while d[dn]!=(0 as u8) { dn=dn+1 } 14 perf_audit(d,dn,1) 15 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, ENRICHMENT form). This gate 16 // enumerated NO checks -- it printed one summary line -- and the base class REFUSES to emit 17 // GREEN with zero checks (gv_verdict requires ctr[1] > 0), which is right: a gate that checked 18 // nothing must not read GREEN. So the only expressible migration enumerates the gate's OWN 19 // GREEN condition as exactly ONE check -- the guard below is copied verbatim, not rewritten. 20 // The PASS/FAIL vector therefore goes 0 -> 1. That is an ENRICHMENT, not a divergence, and 21 // nx_gate_migrate accepts it only because exit code and judge verdict are both preserved. 22 var t1__dry: i64 = 0 23 if f==0 { t1__dry = 1 } 24 let ctr__dry: *i64 = gv_ctr() 25 gv_check("original GREEN condition (enumerated by nx_gate_dry_apply; the gate itself counted nothing)" as *u8, t1__dry, ctr__dry) 26 let rc__dry: i64 = gv_verdict("UIQ-PERF-GATE" as *u8, ctr__dry, "teeth unchanged; verdict emission migrated onto the shared base class" as *u8) 27 sys_exit(rc__dry) 28 return rc__dry 29}