code wiki / _hdl_build / nx_jam_check_register.nx

nx_jam_check_register.nx source

↩ module page · 57 lines · 2949 B

1// nx_jam_check_register.nx -- GOVERNED registration of the jam-physics pre-flight gate. 2// Engineer verdict from a REAL re-run of /tmp/nx_jam_check_test.sov.elf (wait4 status); 3// Council sep-of-duties + additive-only; Scribe catalog row checked; only IG_INGEST writes CAPREG. 4// license_tier: ORIGINAL 5import "nx_cap_register.nx" 6import "nx_syscalls.nx" 7 8const JR_LAYER: i64 = 3 // VER -- a verifier gate (physics pre-flight beside the Klipper syntax gate) 9const JR_STATUS: i64 = 2 // ECO_PROVEN 10const JR_IDX: i64 = 212 11const JR_NLAYERS: i64 = 6 12 13func jr_run_status(path: *u8) -> i64 { 14 let pid: i64 = sys_fork() 15 if pid == 0 { 16 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 17 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 18 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 19 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 20 sys_execve(path, argv, envp); sys_exit(127) 21 } 22 let st: *i64 = sys_mmap(16) as *i64 23 sys_wait4(pid, st, 0) 24 return st[0] 25} 26 27func main() -> i64 { 28 let elf: *u8 = "/tmp/nx_jam_check_test.sov.elf" as *u8 29 let probe: i64 = sys_openat_rd(elf) 30 var present: i64 = 0 31 if probe >= 0 { present = 1; sys_close(probe) } 32 let raw: i64 = jr_run_status(elf) 33 var ran_no_signal: i64 = 0 34 if (raw % 128) == 0 { ran_no_signal = 1 } 35 var exit_ok: i64 = 0 36 if raw == 0 { exit_ok = 1 } 37 let eng: i64 = ig_engineer(present, present, ran_no_signal, exit_ok) 38 cr_w(1, "ENGINEER: jam-check test re-run raw=" as *u8); cr_wn(1, raw); cr_w(1, " (0=all KATs pass)\n" as *u8) 39 40 let cat: i64 = sys_openat_rd("knowledge/CAPABILITY_CATALOG.md" as *u8) 41 var documented: i64 = 0 42 if cat >= 0 { documented = ig_documented(1, 1); sys_close(cat) } 43 let council: i64 = ig_council(eng, 1, 1, 2) 44 let decision: i64 = ig_decision(eng, council, documented) 45 cr_w(1, "GOVERNED decision=" as *u8); cr_wn(1, decision); cr_w(1, " (1=INGEST)\n" as *u8) 46 if decision != IG_INGEST { 47 cr_w(1, "HELD reason=" as *u8); cr_wn(1, ig_held_reason(eng, council, documented)); cr_w(1, "\n" as *u8) 48 sys_exit(1) 49 } 50 if cr_can_register(JR_LAYER, JR_STATUS, JR_NLAYERS, decision) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 51 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 52 cr_write_entry(fd, JR_IDX, JR_LAYER, "VER JAM-CHECK -- jam-physics pre-flight gate vs the X-Max 3's constant jamming: per-G1 volumetric flow demand (integer, 1.75mm xsec) vs temp-dependent melt capacity (DATA-DRIVEN table, provisional pending A7 calibration); verdicts TOO-COLD(line+flow+cap+fix-temp)/TOO-FAST(slow down)/NO-TEMP(cold extrusion)/OK + retraction-churn count; the diagnosis QIDIStudio does not give; 9/9 exact KATs" as *u8, JR_STATUS) 53 sys_close(fd) 54 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, JR_IDX); cr_w(1, " REGISTERED\n" as *u8) 55 sys_exit(0) 56 return 0 57}