code wiki / _hdl_build / nx_raci_audit_register.nx

nx_raci_audit_register.nx source

↩ module page · 46 lines · 2655 B

1// nx_raci_audit_register.nx -- GOVERNED registration of the full team RACI audit. 2// Engineer gate = REAL re-run of /tmp/nx_raci_audit_test.sov.elf (4/4). license_tier: ORIGINAL 3import "nx_cap_register.nx" 4import "nx_syscalls.nx" 5 6const AU_IDX: i64 = 227 7const AU_LAYER: i64 = 4 // CON -- governance/warden audit 8const AU_NLAYERS: i64 = 6 9 10func au_run_status(path: *u8) -> i64 { 11 let pid: i64 = sys_fork() 12 if pid == 0 { 13 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 14 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 15 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 16 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 17 sys_execve(path, argv, envp); sys_exit(127) 18 } 19 let st: *i64 = sys_mmap(16) as *i64 20 sys_wait4(pid, st, 0) 21 return st[0] 22} 23 24func main() -> i64 { 25 let elf: *u8 = "/tmp/nx_raci_audit_test.sov.elf" as *u8 26 let probe: i64 = sys_openat_rd(elf) 27 var present: i64 = 0 28 if probe >= 0 { present = 1; sys_close(probe) } 29 let raw: i64 = au_run_status(elf) 30 var ran_no_signal: i64 = 0 31 if (raw % 128) == 0 { ran_no_signal = 1 } 32 var exit_ok: i64 = 0 33 if raw == 0 { exit_ok = 1 } 34 let eng: i64 = ig_engineer(present, present, ran_no_signal, exit_ok) 35 cr_w(1, "ENGINEER: raci-audit gate raw=" as *u8); cr_wn(1, raw); cr_w(1, " (0=4/4)\n" as *u8) 36 let council: i64 = ig_council(eng, 1, 1, 2) 37 let decision: i64 = ig_decision(eng, council, 1) 38 if decision != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 39 if cr_can_register(AU_LAYER, 2, AU_NLAYERS, decision) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 40 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 41 cr_write_entry(fd, AU_IDX, AU_LAYER, "CON RACI-AUDIT -- the FULL team RACI partition check (operator: 'did you make sure all the raci makes sense and is correctly partitioned'). 10 roles each bound to ONE distinct verb (Builder=AUTHOR, Engineer=TEST, Doctor=HEAL, Researcher=RESEARCH, Referee=SCORE, PM=PLAN, Council=ADMIT, Librarian=REGISTER, Scribe=DOCUMENT, Warden=GOVERN); raa_conflating_pairs proves pairwise-distinct (clean partition), raa_all_present catches a missing role, raa_partition_clean composes br_separation_ok + br_roles_correct. PROVEN: canonical roster = 0 conflations, all present, partition-clean=1; HONESTY-tested -- catches the doctor=tester blur (the exact bug fixed) + a missing Referee. 4/4 KATs. Composes nx_role_audit + nx_build_raci" as *u8, 2) 42 sys_close(fd) 43 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, AU_IDX); cr_w(1, " REGISTERED\n" as *u8) 44 sys_exit(0) 45 return 0 46}