code wiki / _hdl_build / nx_infomgmt_im7_race_register.nx

nx_infomgmt_im7_race_register.nx source

↩ module page · 46 lines · 4839 B

1// nx_infomgmt_im7_race_register.nx -- registers TWO infomgmt rungs via the 2// Librarian (cl_next_idx + dual-write): IM7a (team logs unified onto the 3// store) and IM6b (beat-FTS5 search race + the engine perf rungs it forced). 4// ENGINEER evidence = the full 15-row INFOMGMT gate re-run here. 5// license_tier: ORIGINAL 6import "nx_cap_register.nx" 7import "nx_capreg_librarian.nx" 8import "nx_syscalls.nx" 9 10func i7r_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 i7r_run("/tmp/nx_infomgmt_gate.sov.elf" as *u8) != 0 { allok = 0 } 27 cr_w(1, "ENGINEER: INFOMGMT gate (15 rows) pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 28 let eng: i64 = ig_engineer(1, 1, 1, allok) 29 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 30 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 31 if cr_can_register(6, 2, 7, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 32 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8 33 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8 34 let i1: i64 = cl_next_idx(lp, jp) 35 let ok1: i64 = cl_register_dual(lp, jp, i1, 6, 36 2, "GEN INFOMGMT-IM7a TEAM-LOG UNIFICATION (ONE substrate: the team's plan + capability evidence become first-class searchable records, NO SQL) -- nx_log_load: pm_plan_durable.log + cap_registry_durable.log lines -> canonical records {kind,log,line} keyed log:<CID> = IDEMPOTENT BY CONSTRUCTION (law 10: same line = same CID = dup never re-added); chunked 64-doc commits; PROVEN on the REAL store: run A added=7 (exactly the lines the CONCURRENT session appended mid-run) dup_instore=410, run B added=0 dup_instore=417 segments=0; dup_infile=1301 cross-checked EXACTLY vs external sort -u; loud-abort on any cap/commit refusal. ALSO KILLED the silent-caps defect class: ss_build_terms fixed caps SILENTLY dropped terms/pairs + emitted uninitialized doc offsets past 4096 docs -> ALL capacities now DATA-DRIVEN from writer size w/ defensive loud -1 (ss_build_keys + ss_compact same), gate row postings-scale-bulk proves a 4097-doc segment commits + term-counts EXACTLY 4097; corpus now 636 records (census 149 + team-log lines), term infomgmt=29 and infomgmt+postings=8 byte-stable across engine rewrite AND compaction. Composes CAPREG304/312/295/270-272" as *u8) 37 if ok1 != 1 { cr_w(1, "DUAL-WRITE FAILED 1\n" as *u8); sys_exit(1) } 38 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, i1); cr_w(1, " REGISTERED (IM7a team-log unification + silent-caps killed)\n" as *u8) 39 let i2: i64 = cl_next_idx(lp, jp) 40 let ok2: i64 = cl_register_dual(lp, jp, i2, 6, 41 2, "GEN INFOMGMT-IM6b BEAT-FTS5 SEARCH RACE + PERF RUNGS (operator: benchmark vs the best tools + research) -- nx_search_race Referee instrument: sovereign postings vs python3-sqlite3 FTS5 3.45.1 (external competitor process), SAME 486-doc team-log corpus, SAME 9 queries x200, per-query counts MUST match or INVALID (counts_ok=1 EVERY run = tokenizer-semantics parity w/ unicode61). Honest ladder MEASURED: first run SOV-LOSES-BOTH 24x/47x -> root-cause rewrites (NO patch cascades): FNV hash term dict O(1)/token + counting-bucket postings emit O(pairs) + bottom-up merge sorts + O(1) per-doc dedupe via last-doc-seen + 256-entry table tokenizer (ONE tokenizer law kept) + LIVE-DOC BITMAP at ss_open (Lucene live-docs pattern, derived from .keys index, zero probes single-segment) = currency check O(1) at query + per-segment sorted-docid MERGE-INTERSECT AND + handle scratch arena (queries allocate nothing) -> STANDING VERDICT MIXED-INDEX-LOSS: QUERY WON 3-4x (4.4-6.8ms vs 14-20ms) index 1.35x behind (29-36 vs 19-28ms); _ixprof localization: remaining gap = 5-file fsync ceremony ~12ms + ~10ms terms-build codegen floor; RESEARCH VERIFIED (tantivy ARCHITECTURE/jpountz 2025/lucene#12513): our delta-varint postings + flagged bitpack-128/FST rungs = EXACTLY the Tantivy/Lucene architecture; next rungs NAMED: merged .idx aux file, bitpack-128, FST dict, compiler codegen arc. EXCEED: query win + additive-history/time-travel/tamper-evidence/fault-injection FTS5 lacks. spec 2026-06-10-infomgmt-search-race-fts5.md; durable infomgmt_race.log" as *u8) 42 if ok2 != 1 { cr_w(1, "DUAL-WRITE FAILED 2\n" as *u8); sys_exit(1) } 43 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, i2); cr_w(1, " REGISTERED (IM6b beat-FTS5 race + perf rungs)\n" as *u8) 44 sys_exit(0) 45 return 0 46}