code wiki / _hdl_build / nx_ecomat_page_gate.nx

nx_ecomat_page_gate.nx source

↩ module page · 40 lines · 2565 B

1// nx_ecomat_page_gate.nx -- proves the dashboard renders the LIVE measured numbers from the store 2// (not hardcoded), and carries NEGATIVE CONTROLS: a domain NOT in the store must NOT appear, and a 3// liar-kill MUST surface in the footer. license_tier: ORIGINAL 4import "nx_ecomat_lib.nx" 5 6func main() -> i64 { 7 var fails: i64 = 0 8 let alog: *u8 = "knowledge/status/autonomy_meter.log" as *u8 9 let szp: *i64 = sys_mmap(16) as *i64 10 // GOOD store: alphadom(cur2/bar4/ev1 DEPTH) + betadom(cur3/bar5/ev1 BREADTH) => overall 555, GREEN 11 let w: *i64 = ss_begin() 12 ec_seed_one(w, 0, 0, 1, 2, 4, 9, 1, "alphadom" as *u8, "b" as *u8, "nextalpha" as *u8) 13 ec_seed_one(w, 1, 1, 7, 3, 5, 9, 1, "betadom" as *u8, "b" as *u8, "nextbeta" as *u8) 14 ss_commit("/tmp/ecomat_pg" as *u8, w, sys_now_realtime_sec()) 15 let v: i64 = em_emit_page("/tmp/ecomat_pg" as *u8, alog, "/tmp/ecomat_pg.html" as *u8) 16 if v != 0 { fails = fails + 1 } 17 let html: *u8 = ss_readall("/tmp/ecomat_pg.html" as *u8, szp) 18 var hn: i64 = szp[0]; if hn < 0 { hn = 0 } 19 if el_contains(html, hn, "alphadom" as *u8) == 0 { fails = fails + 1 } 20 if el_contains(html, hn, "betadom" as *u8) == 0 { fails = fails + 1 } 21 if el_contains(html, hn, "555" as *u8) == 0 { fails = fails + 1 } 22 if el_contains(html, hn, "nextalpha" as *u8) == 0 { fails = fails + 1 } 23 if el_contains(html, hn, "FUNCTIONAL" as *u8) == 0 { fails = fails + 1 } 24 // NEG-CONTROL 1: a domain never seeded must NOT appear in the page 25 if el_contains(html, hn, "zzznotseeded" as *u8) == 1 { fails = fails + 1 } 26 // NEG-CONTROL 2: a liar-kill (S-CLASS, no evidence) must surface in the footer 27 let w2: *i64 = ss_begin() 28 ec_seed_one(w2, 0, 1, 9, 4, 5, 9, 0, "liardom" as *u8, "b" as *u8, "n" as *u8) 29 ss_commit("/tmp/ecomat_pg2" as *u8, w2, sys_now_realtime_sec()) 30 let v2: i64 = em_emit_page("/tmp/ecomat_pg2" as *u8, alog, "/tmp/ecomat_pg2.html" as *u8) 31 if v2 != 1 { fails = fails + 1 } 32 let html2: *u8 = ss_readall("/tmp/ecomat_pg2.html" as *u8, szp) 33 var hn2: i64 = szp[0]; if hn2 < 0 { hn2 = 0 } 34 if el_contains(html2, hn2, "LIAR-KILL" as *u8) == 0 { fails = fails + 1 } 35 _p("page-gate live-render + neg-controls ... fails=" as *u8); _fn(1, fails); _p("\n" as *u8) 36 if fails == 0 { _p("GATE nx_ecomat_page verdict=GREEN pass=9/9 (live numbers rendered; missing-domain + liar-kill-footer neg-controls)\n" as *u8); sys_exit(0); return 0 } 37 _p("GATE nx_ecomat_page verdict=RED fails=" as *u8); _fn(1, fails); _p("\n" as *u8) 38 sys_exit(1) 39 return 1 40}