code wiki / _hdl_build / nx_doctor_sov_verify_register.nx
nx_doctor_sov_verify_register.nx source
↩ module page · 64 lines · 4351 B
1// nx_doctor_sov_verify_register.nx -- GOVERNED registration of the Doctor's one-step sovereign batch
2// verifier + it FLAGS the root-caused nx_int-alias compiler bug to the PM review log. Engineer gate:
3// run the Doctor on two known-good modules (_min42 + nx_fab_slice_test) and require exit 0 (all pass).
4// license_tier: ORIGINAL
5import "nx_cap_register.nx"
6import "nx_pm_review_log.nx"
7import "nx_syscalls.nx"
8
9const DR_LAYER: i64 = 3 // VER -- the Doctor is a verifier organ
10const DR_STATUS: i64 = 2 // ECO_PROVEN
11const DR_IDX: i64 = 211
12const DR_NLAYERS: i64 = 6
13
14// fork+exec the doctor with two module args; mute its stdout; return WEXITSTATUS (0 = all passed)
15func dr_run2(path: *u8, a1: *u8, a2: *u8) -> i64 {
16 let pid: i64 = sys_fork()
17 if pid == 0 {
18 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4)
19 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) }
20 let argv: *i64 = sys_mmap(48) as *i64; argv[0]=path as i64; argv[1]=a1 as i64; argv[2]=a2 as i64; argv[3]=0
21 let envp: *i64 = sys_mmap(16) as *i64; envp[0]="PATH=/usr/bin:/bin" as *u8 as i64; envp[1]=0
22 sys_execve(path, argv, envp); sys_exit(127)
23 }
24 let st: *i64 = sys_mmap(16) as *i64
25 sys_wait4(pid, st, 0)
26 return (st[0] >> 8) & 0xff
27}
28
29func main() -> i64 {
30 let doctor: *u8 = "_offc/nx_doctor_sov_verify.elf" as *u8
31 let probe: i64 = sys_openat_rd(doctor)
32 var present: i64 = 0
33 if probe >= 0 { present = 1; sys_close(probe) }
34 // gate on two PASS-with-exit-0 modules (NOT _min42, which exits 42 by design)
35 let rc: i64 = dr_run2(doctor, "nx_fab_slice_test" as *u8, "nx_stl_view_html_test" as *u8)
36 cr_w(1, "ENGINEER: doctor verify {nx_fab_slice_test, nx_stl_view_html_test} exit=" as *u8); cr_wn(1, rc); cr_w(1, " (need 0=all pass)\n" as *u8)
37 var exit_ok: i64 = 0
38 if rc == 0 { exit_ok = 1 }
39 let eng: i64 = ig_engineer(present, present, 1, exit_ok)
40
41 let cat: i64 = sys_openat_rd("knowledge/CAPABILITY_CATALOG.md" as *u8)
42 var documented: i64 = 0
43 if cat >= 0 { documented = ig_documented(1, 1); sys_close(cat) }
44 let council: i64 = ig_council(eng, 1, 1, 2)
45 let decision: i64 = ig_decision(eng, council, documented)
46
47 // FLAG the root-caused compiler bug (durable, reviewable) -- the keystone blocking sovereign statue slicing.
48 let pm: i64 = pm_open("/tmp/nishi_pm_review.log" as *u8)
49 if decision == IG_INGEST {
50 pm_deliverable(pm, "doctor/sovereign-verify" as *u8, "nx_doctor_sov_verify" as *u8, "one-step batch sovereign build+run+report, <10s (measured 5.25s/8 modules), no gcc/sh/shell-loop; slice stack 7/8 GREEN sovereignly (gcc segfaults were toolchain artifacts)" as *u8)
51 }
52 pm_gap(pm, "compiler/self-host-parser" as *u8, "NEEDS-LOGIC" as *u8, "T#nx-int-alias-size-0 LIVE in nx_cc_known_good" as *u8, "self-hosted parse_type does NOT resolve type aliases: a struct field typed `nx_int` (=`type nx_int=i64`) collapses to TY_VOID size 0, so NxMesh.n_verts/n_tris read the verts POINTER at offset 0 -> christus_integration exit 11, whole 3D-print stack corrupt. Repro: runtime/nx_mesh_christus_probe.nx (raw[0]=ptr, fld.nv==fld.nt==raw[0]); guard runtime/nx_type_alias_test.nx FAILS exit 1. FIX (documented in that guard): prepass_register_aliases into the structs pool + parse_type resolves chained aliases + LOUD-fail unknown types. C bootstrap already resolves aliases; self-host parser is the parity gap. THIS unblocks sovereign statue slicing." as *u8)
53 sys_close(pm)
54 cr_w(1, "GOVERNED decision=" as *u8); cr_wn(1, decision); cr_w(1, "; compiler bug flagged to PM log\n" as *u8)
55
56 if decision != IG_INGEST { sys_exit(1) }
57 if cr_can_register(DR_LAYER, DR_STATUS, DR_NLAYERS, decision) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
58 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4)
59 cr_write_entry(fd, DR_IDX, DR_LAYER, "VER DOCTOR-SOV-VERIFY -- one-step batch sovereign build+run+report (nx_cc->nxasm_x86->run, no gcc/sh/shell-loop), <10s for 8 modules; the Doctor's tutored capability; proved slice stack 7/8 GREEN sovereignly + root-caused the 1 failure to T#nx-int-alias-size-0 (self-host parse_type alias gap)" as *u8, DR_STATUS)
60 sys_close(fd)
61 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, DR_IDX); cr_w(1, " REGISTERED\n" as *u8)
62 sys_exit(0)
63 return 0
64}