code wiki / _hdl_build / nx_pattern_emit3_register.nx

nx_pattern_emit3_register.nx source

↩ module page · 34 lines · 2208 B

1// nx_pattern_emit3_register.nx -- records the STATE_FLOW pattern emitter (shape 5 of 10 hands-off). 2// Engineer gate = the team-authored publish-lifecycle test passes. license_tier: ORIGINAL 3import "nx_cap_register.nx" 4import "nx_syscalls.nx" 5 6func pe3_run(path: *u8) -> i64 { 7 let pid: i64 = sys_fork() 8 if pid == 0 { 9 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 10 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 11 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 12 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 13 sys_execve(path, argv, envp); sys_exit(127) 14 } 15 let st: *i64 = sys_mmap(16) as *i64 16 sys_wait4(pid, st, 0) 17 return st[0] 18} 19 20func main() -> i64 { 21 var allok: i64 = 1 22 if pe3_run("/tmp/_pe_pub_test.sov.elf" as *u8) != 0 { allok = 0 } 23 cr_w(1, "ENGINEER: team-authored STATE_FLOW publish-lifecycle test all-pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 24 let eng: i64 = ig_engineer(1, 1, 1, allok) 25 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 26 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 27 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 28 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 29 cr_write_entry(fd, 241, 5, "SELF PATTERN-EMIT-3 (Builder authors STATE_FLOW, shape 5 of 10 hands-off) -- transitions-table state machine <name>_step(state,ev)->next|-1-refused, table = (from,event,to) triples = the single source of truth (data-driven, rule 11); test KATs derived FROM the table (every legal row + mechanically-derived illegal pair refused). PROVEN: the team authored _pe_pub = the CMS publish lifecycle (DRAFT/PUBLISHED/ROLLED-BACK x EDIT/PUBLISH/ROLLBACK, 5 transitions, rollback-of-draft REFUSED -1), ENGINEER verified green, ZERO Claude core logic. The CMS arc (ladder step 12 draft/revision/publish) now composes a team-authored core. Extends CAPREG231/235. Next shapes: PARSER_KAT/GOVERNOR/GEOMETRY/PID_LOOP/SCAFFOLD-CORE" as *u8, 2) 30 sys_close(fd) 31 cr_w(1, "CAPREG idx=241 REGISTERED (5/10 shapes hands-off)\n" as *u8) 32 sys_exit(0) 33 return 0 34}