code wiki / _hdl_build / nx_queue_store_register.nx
nx_queue_store_register.nx source
↩ module page · 39 lines · 3183 B
1// nx_queue_store_register.nx -- records IM-Q1 (the queue on the sovereign
2// store). Engineer gate = the 5-check QLGATE proof re-run GREEN at register
3// time. Registered via Librarian alloc + dual-write. license_tier: ORIGINAL
4import "nx_cap_register.nx"
5import "nx_capreg_librarian.nx"
6import "nx_syscalls.nx"
7
8func qsr_run(path: *u8) -> i64 {
9 let pid: i64 = sys_fork()
10 if pid == 0 {
11 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4)
12 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) }
13 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0
14 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0
15 sys_execve(path, argv, envp); sys_exit(127)
16 }
17 let st: *i64 = sys_mmap(16) as *i64
18 sys_wait4(pid, st, 0)
19 return st[0]
20}
21
22func main() -> i64 {
23 var allok: i64 = 1
24 if qsr_run("/tmp/_queue_load_gate_authored.sov.elf" as *u8) != 0 { allok = 0 }
25 cr_w(1, "ENGINEER: queue-on-store 5-check gate re-run all-pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8)
26 let eng: i64 = ig_engineer(1, 1, 1, allok)
27 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
28 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
29 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
30 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8
31 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8
32 let idx: i64 = cl_next_idx(lp, jp)
33 let ok: i64 = cl_register_dual(lp, jp, idx, 5,
34 2, "SELF QUEUE-ON-SOVEREIGN-STORE (IM-Q1; operator: a tsv is not nishi, own our information management bottom-up) -- nx_queue_load puts the PROGRAM'S OWN coordination data on the team's hardware-up seg-store substrate (rungs 1-9, beats-FTS5 lineage): assignment_queue rows -> aq:<id> canonical records where EVERY status change = a NEW VERSION under the same key (nx_store_query hist aq:X-Q-003 = the row's full status time-travel w/ CID provenance -- unanswerable from the bare TSV); sponsor_decisions/planning_prefs/callouts -> content-CID line records (sd:/pp:/co:) so the sponsor's decisions and the training corpus gain tamper-evident lineage. Idempotent BY CONSTRUCTION (unchanged row = identical canonical bytes = dup_instore; gate proves added=0 re-run, added=1 on a single flip, latest-reflects-flip), chunked fsync commits, additive-only. LIVE: 149 records ingested first pass, probe aq:X-Q-003 FOUND; pulse step live (every beat = store snapshot of queue+sponsor state, 30/31 green); QLGATE 5/5 + rung_gates R6 row; per-run unique scratch prefix kills the cross-run dedup staleness class. TSV stays the WRITE surface this rung (API stability law); migration ladder FILED: IM-Q2 writers-store-first (TSV becomes derived render, actor provenance), IM-Q3 parsers-read-store (TSV export-only, queue FULLY nishi), IM-Q4 flip-provenance surface. Composes nx_seg_store/nx_canon_cid (nx_log_load IM7a pattern)" as *u8)
35 if ok != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) }
36 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED -- the queue lives on our own substrate\n" as *u8)
37 sys_exit(0)
38 return 0
39}