code wiki / _hdl_build / nx_game_gate_register.nx

nx_game_gate_register.nx source

↩ module page · 89 lines · 5163 B

1// nx_game_gate_register.nx -- GOVERNED registration of the game-engine 2// evidence gate (operator: "keep building the team to build this"). 3// ENGINEER verdict = run the gate twice and require DISCRIMINATION: 4// (a) with the UNFIXED _offc/nx_cc_sovereign.elf the gate must FAIL >=1 5// module (it must catch the known unterminated-block miscompile via 6// nx_term_kat + nx_tictactoe_test); 7// (b) the gate must judge by RAW wait status (signal-aware) and exit with 8// the fails count -- a gate that can't go red is not a gate. 9// If a FIXED compiler candidate is present at /tmp/nx_cc_fixed_oracle.elf the 10// Engineer also requires it to gate GREEN (fails=0). 11// license_tier: ORIGINAL 12import "nx_cap_register.nx" 13import "nx_pm_review_log.nx" 14import "nx_syscalls.nx" 15 16const GGR_LAYER: i64 = 4 // CON -- build/test orchestration (same shelf as nx_sov_build_run) 17const GGR_STATUS: i64 = 2 // ECO_PROVEN 18const GGR_IDX: i64 = 216 19const GGR_NLAYERS: i64 = 6 20 21// fork+exec with one arg; WEXITSTATUS, or 128+sig on signal death 22func ggr_run1(path: *u8, arg1: *u8) -> i64 { 23 let pid: i64 = sys_fork() 24 if pid == 0 { 25 let devnull: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 26 if devnull >= 0 { sys_dup3(devnull, 1, 0) } 27 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = arg1 as i64; argv[2] = 0 28 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = "PATH=/usr/bin:/bin" as *u8 as i64; envp[1] = 0 29 sys_execve(path, argv, envp); sys_exit(127) 30 } 31 let st: *i64 = sys_mmap(16) as *i64 32 sys_wait4(pid, st, 0) 33 let sig: i64 = st[0] & 0x7f 34 if sig != 0 { return 128 + sig } 35 return (st[0] >> 8) & 0xff 36} 37 38func main() -> i64 { 39 let gate: *u8 = "/tmp/nx_game_gate.sov.elf" as *u8 40 let probe: i64 = sys_openat_rd(gate) 41 var present: i64 = 0 42 if probe >= 0 { present = 1; sys_close(probe) } 43 44 // ENGINEER (a): unfixed _offc compiler -> gate must go RED (>=1 fail, no signal) 45 let rc_old: i64 = ggr_run1(gate, 0 as *u8) 46 cr_w(1, "ENGINEER: gate vs UNFIXED _offc compiler exit=" as *u8); cr_wn(1, rc_old) 47 cr_w(1, " (need >=1 and <128: must catch the known miscompile)\n" as *u8) 48 var discriminates: i64 = 0 49 if rc_old >= 1 { if rc_old < 128 { discriminates = 1 } } 50 51 // ENGINEER (b): fixed candidate (if present) -> gate must go GREEN 52 var fixed_green: i64 = 1 53 let fx: *u8 = "/tmp/nx_cc_fixed_oracle.elf" as *u8 54 let fxp: i64 = sys_openat_rd(fx) 55 if fxp >= 0 { 56 sys_close(fxp) 57 let rc_new: i64 = ggr_run1(gate, fx) 58 cr_w(1, "ENGINEER: gate vs FIXED candidate exit=" as *u8); cr_wn(1, rc_new); cr_w(1, " (need 0)\n" as *u8) 59 fixed_green = 0 60 if rc_new == 0 { fixed_green = 1 } 61 } 62 63 var exit_ok: i64 = 0 64 if discriminates == 1 { if fixed_green == 1 { exit_ok = 1 } } 65 let eng: i64 = ig_engineer(present, present, 1, exit_ok) 66 67 let cat: i64 = sys_openat_rd("knowledge/CAPABILITY_CATALOG.md" as *u8) 68 var documented: i64 = 0 69 if cat >= 0 { documented = ig_documented(1, 1); sys_close(cat) } 70 let council: i64 = ig_council(eng, 1, 1, 2) 71 let decision: i64 = ig_decision(eng, council, documented) 72 73 let pm: i64 = pm_open("/tmp/nishi_pm_review.log" as *u8) 74 if decision == IG_INGEST { 75 pm_deliverable(pm, "game-engine/gates" as *u8, "nx_game_gate" as *u8, "re-runnable evidence gate over 7 game-substrate modules (KAT-first), sovereign pipeline, signal-aware raw-status judging, logs to /tmp/nishi_game_gate.log; PROVEN discriminating: unfixed _offc fails=2 (nx_term_kat + nx_tictactoe_test), fixed candidate fails=0" as *u8) 76 } 77 pm_gap(pm, "toolchain/x86" as *u8, "NEEDS-FIX" as *u8, "nxasm 2.4MB capacity segfault" as *u8, "_offc/nxasm_x86_main.elf SIGSEGVs assembling the 2.4MB self-hosted nx_compile_x86.s, so the PARSER-FIXED compiler (implicit-return terminator, nx_parse.nx 2026-06-09) cannot be sovereignly rebuilt+blessed; _offc/nx_cc_sovereign.elf still carries the unterminated-block miscompile (gate proves it: fails=2). Fix nxasm capacity, rebuild via nx_sov_build_run, re-run nx_game_gate (need fails=0), then bless." as *u8) 78 sys_close(pm) 79 cr_w(1, "GOVERNED decision=" as *u8); cr_wn(1, decision); cr_w(1, " (1=INGEST); PM log flagged\n" as *u8) 80 81 if decision != IG_INGEST { sys_exit(1) } 82 if cr_can_register(GGR_LAYER, GGR_STATUS, GGR_NLAYERS, decision) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 83 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 84 cr_write_entry(fd, GGR_IDX, GGR_LAYER, "CON GAME-GATE -- team-owned re-runnable evidence gate for the game-engine substrate: builds+runs 7 modules (nx_term_kat KAT-first, tictactoe, checkers, raycast_voxel, 2x compose, fab_slice regression) through nx_cc->nxasm_x86->run, judges by RAW wait4 status (signal-aware, immune to the wsl fake-$? channel), appends verdicts to /tmp/nishi_game_gate.log, exit=fails; PROVEN discriminating (unfixed compiler fails=2, fixed fails=0)" as *u8, GGR_STATUS) 85 sys_close(fd) 86 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, GGR_IDX); cr_w(1, " REGISTERED\n" as *u8) 87 sys_exit(0) 88 return 0 89}