code wiki / (root) / nx_lmexport.nx

nx_lmexport.nx

buildroot/runtime/nx_lmexport.nx

8738 B139 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_lmexport.nx -- SOVEREIGN replacement for nx_landmine_export.cron.sh (2026-08-07). OPERATOR DOCTRINE: .sh is not the Nishi ecosystem. But this wrapper is NOT a pure swap -- I said it was, from reading its FIRST LINE, and filed that as guidance (retracted in debt 1786114148). It carries THREE safety properties, and a bare organ row would have silently deleted all three: (1) FAIL-CLOSED ON EMPTY -- an empty plane load is REFUSED, never exported (the vacuous-verify law). (2) SHRINK GUARD -- a GENERATED VIEW that loses a third of its rows is a CLOBBER SIGNAL, not an export. Refuse when new < cur*2/3. (3) ATOMIC REPLACE -- assemble the whole file in a temp, then rename over the target, so a reader never observes a half-written registry. (STAR)A WRAPPER THAT LOOKS LIKE THE LAST WRAPPER IS NOT THE SAME WRAPPER -- ENUMERATE ITS SERVICES EVERY TIME. The argument-plus-redirection shape that made fallbackharden and ddqbeat pure swaps is exactly what made this one LOOK swappable; the resemblance is the hazard. FAITHFULNESS NOTE ON THE SHRINK TEST. The shell computed $((CUR * 2 / 3)) -- INTEGER division, which TRUNCATES -- and refused when NEW was strictly less than that. The obvious "cleaner" rewrite (new*3 < cur*2) is NOT the same predicate: at cur=10 the shell threshold is 6 and admits new=6, while the cross- multiplied form rejects it. A guard must be ported EXACTLY, not improved in passing, so the truncating form is reproduced verbatim. (STAR)PORTING A GUARD IS NOT REFACTORING IT -- AN OFF-BY-ONE IN A SAFETY PREDICATE IS A SAFETY CHANGE. nx_lmexport (no args; the clock dispatches it bare) Exit: 0 OK · 2 empty-load REFUSED · 3 shrink REFUSED · 1 internal failure. Output goes to stdout, which the clock's per-job capture routes to logs/lmexport.log automatically. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_lmexport.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_fork sys_openat_wr sys_dup3 sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_execve sys_exit ↻ lm_o sys_write ↻ sys_wait4 sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close lm_say sys_mmap ↻ lm_cat lm_kv lm_cat ↻ lm_num sys_mmap ↻ sys_write ↻ lm_cat ↻

structs

none

consts

28const LM_PLANE: *u8 = "knowledge/store/landmine-"
29const LM_CLI: *u8 = "/volume1/homes/elderwesto/nishihost/nx_store_put.elf"
30const LM_TMP: *u8 = "/tmp/nx_lmexport.tmp"
50const LM_FULL: *u8 = "knowledge/registry/.lmexport.tmp"
51const LM_TARGET: *u8 = "knowledge/registry/landmines.tsv"
52const LM_MODE: i64 = 0x1a4
53const LM_CAP: i64 = 4194304
54const LM_H1: *u8 = "# GENERATED VIEW (F871 2026-07-20) -- SSOT is the knowledge/store/landmine- seg-store plane. DO NOT hand-edit:\\n"
55const LM_H2: *u8 = "# hand edits are OVERWRITTEN by nx_lmexport.elf (clock beat). Add/retire landmines via:\\n"
56const LM_H3: *u8 = "# ./nx_store_put.elf knowledge/store/landmine- put <actor> <LM-id> <category> <text> (replaces by id, hist- provenanced)\\n"

functions

58func lm_o(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
59func lm_cat(d: *u8, o: i64, s: *u8) -> i64 { var x: i64=o; var i: i64=0; while s[i]!=(0 as u8){d[x]=s[i];x=x+1;i=i+1} return x }
called by 3: lm_kvlm_saymain
60func lm_num(d: *u8, o: i64, v: i64) -> i64 { var x: i64=o; var mm: i64=v; if mm<0{d[x]=45 as u8;x=x+1;mm=0-mm} if mm==0{d[x]=48 as u8;return x+1} let t:*u8=sys_mmap(24); var k:i64=0; while mm>0{t[k]=(48+(mm%10)) as u8;mm=mm/10;k=k+1} var j:i64=0; while j<k{d[x]=t[k-1-j];x=x+1;j=j+1} return x }
called by 1: lm_kv calls 1: sys_mmap
66func lm_kv(m: *u8, o: i64, k: *u8, v: i64) -> i64 { var x: i64 = lm_cat(m, o, k); x = lm_num(m, x, v); return x }
called by 1: lm_say calls 2: lm_catlm_num
67func lm_say(tag: *u8, a: i64, b: i64) -> i64
called by 1: main calls 4: sys_mmaplm_catlm_kvsys_write
76func main() -> i64