code wiki / _hdl_build / nx_ui_wiring_census.nx

nx_ui_wiring_census.nx source

↩ module page · 41 lines · 2393 B

1// nx_ui_wiring_census.nx -- BOTTOM-UP UI verifier (operator 2026-07-04: "the Nishi team should SEE 2// everything bottom-up"). Runs the SHARED wiring/init checks (nx_ui_checks) on the LOCAL SOURCE we are 3// about to ship: every <button id> must have a handler, and init host-API calls must be crash-guarded. 4// Catches dead-button + unguarded-init (the 2026-07-04 dead-buttons class) WITHOUT a browser. 5// The TOP-DOWN twin (nx_ui_live_verify) runs the SAME checks on the LIVE SERVED bytes -> redundancy. 6// HONEST SCOPE: static wiring, not execution (engine lacks async/await + event model -> task #35). 7// expect_exit: 0 when every button wired + init crash-safe. license_tier: ORIGINAL 8import "nx_ui_checks.nx" 9 10func main() -> i64 { 11 uc_w("=== nx_ui_wiring_census: BOTTOM-UP UI verifier (local source we are about to ship) ===\n" as *u8) 12 let hbox: *i64 = sys_mmap(16) as *i64 13 let html: *u8 = sys_read_file("sites/nishifamily/video/index.html" as *u8, hbox) 14 if (html as i64)==0 { uc_w("no index.html\n" as *u8); return 1 } 15 let hn: i64 = hbox[0] 16 let jbox: *i64 = sys_mmap(16) as *i64 17 let js: *u8 = sys_read_file("sites/nishifamily/video/app.v2.js" as *u8, jbox) 18 if (js as i64)==0 { uc_w("no app.v2.js\n" as *u8); return 1 } 19 let jn: i64 = jbox[0] 20 21 uc_w(" BUTTON WIRING (every <button id> -> a handler):\n" as *u8) 22 let tally: *i64 = sys_mmap(32) as *i64; tally[0]=0; tally[1]=0 23 uc_check_buttons(html, hn, js, jn, tally) 24 let dead: i64 = tally[1] 25 uc_w(" INIT-CRASH SAFETY:\n" as *u8) 26 let init_bad: i64 = uc_check_init(js, jn) 27 28 uc_w(" NEG-CONTROL: " as *u8) 29 var neg_ok: i64 = 0 30 if uc_has(js, jn, "\"zz_fake_button_9x7q\"" as *u8)==0 { neg_ok=1; uc_w("fake id UNREFERENCED (teeth ok)\n" as *u8) } else { uc_w("NEG FAIL\n" as *u8) } 31 32 uc_w(" SCORE: " as *u8); uc_n(tally[0]-dead); uc_w("/" as *u8); uc_n(tally[0]); uc_w(" wired dead=" as *u8); uc_n(dead); uc_w(" init_risk=" as *u8); uc_n(init_bad); uc_w("\n" as *u8) 33 var green: i64 = 1 34 if dead != 0 { green = 0 } 35 if init_bad != 0 { green = 0 } 36 if neg_ok != 1 { green = 0 } 37 if tally[0] <= 0 { green = 0 } 38 if green==1 { uc_w("UI-WIRING-CENSUS verdict=GREEN -- source wired + init crash-safe (bottom-up eye)\n" as *u8); return 0 } 39 uc_w("UI-WIRING-CENSUS verdict=RED -- a UI wiring/init defect the system CATCHES itself\n" as *u8) 40 return 1 41}