code wiki / _hdl_build / nx_audit_heal_register.nx
nx_audit_heal_register.nx source
↩ module page · 43 lines · 3235 B
1// nx_audit_heal_register.nx -- GOVERNED registration of the 2026-06-10
2// standards-audit pass over the SREACH session work (operator: "make sure the
3// work we just did meets our standards"). Engineer gate = the KAT + the healed
4// grader + a live consumer all exit 0; Council admits; Librarian allocs.
5// license_tier: ORIGINAL
6import "nx_cap_register.nx"
7import "nx_capreg_librarian.nx"
8import "nx_syscalls.nx"
9
10func ahr_run(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 var allok: i64 = 1
26 if ahr_run("/tmp/nx_gate_green_test.sov.elf" as *u8) != 0 { allok = 0 }
27 if ahr_run("/tmp/nx_sreach_scorecard.sov.elf" as *u8) != 0 { allok = 0 }
28 if ahr_run("/tmp/nx_ignored_host_reach.sov.elf" as *u8) != 0 { allok = 0 }
29 cr_w(1, "ENGINEER: gate-green KAT + healed scorecard + live consumer all-pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8)
30 let eng: i64 = ig_engineer(1, 1, 1, allok)
31 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
32 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
33 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
34 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8
35 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8
36 let idx1: i64 = cl_next_idx(lp, jp)
37 let ok1: i64 = cl_register_dual(lp, jp, idx1, 5,
38 2, "GEN STANDARDS-AUDIT PASS over SREACH session work (operator: 'make sure the work meets our standards'). TWO REAL FINDINGS, BOTH FIXED + GATED: (1) FALSE-GREEN BUG in nx_sreach_scorecard's private line-judge -- the line-bounding loop DISCARDED the newline index so the pattern window ran to EOF; a 'rc=0' on a LATER line could green a rung whose own line said rc=1 (the grader itself violating evidence-driven law). FIX = shared lib nx_gate_green (found-index line bounding) + nx_gate_green_test 6/6 KATs incl the exact false-green construction (no-tail-bleed) + last-wins + eof-line; scorecard refactored onto the lib, re-graded 9/9 legitimately. ANY module judging gate logs should adopt this lib, not a private copy. (2) RULE-15 DRY VIOLATION -- _ed_fetch_html copy-pasted ~150 lines of _dlr_fetch_one's staged-fetch helpers. FIX = nx_fetch_unit.nx (nx_fetch_staged: validated HTTPS + redirect-follow + chunked-decode, the fixes live in ONE place), both children now thin mains; re-proven LIVE through all 3 consumers: ignored-host census 6/8 GREEN, entity discovery 8/5 GREEN, live SERP PASS -- results identical to pre-refactor. LESSON: graders are code too -- a scorecard ships with KATs like any kernel" as *u8)
39 if ok1 != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) }
40 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx1); cr_w(1, " REGISTERED -- standards-audit pass\n" as *u8)
41 sys_exit(0)
42 return 0
43}