code wiki / (root) / nx_debtlive.nx

nx_debtlive.nx

buildroot/runtime/nx_debtlive.nx

23174 B440 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_debtlive.nx -- IS THIS DEBT ALREADY FIXED? A mechanical closure check for the debt ledger. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0 THE DEFECT THIS EXISTS TO KILL: the debt ledger is the first thing a seat reads and the last thing that gets corrected. Fixes land; the rows that described them stay `open`. MEASURED 2026-07-31 (ws=mgmt-staging-cas): of the FIVE top sev-9 rows picked off `nx_debt sev 9`, FIVE were already fixed in source and FOUR were verified LIVE in the deployed binaries by string-grep of the artifacts themselves -- 1785453352 unpack staging CAS -> live in nx_mgmt_api.elf (pins the unpack to YOUR source) 1785450506 deploy takes no lease -> live in nx_mgmt_api.elf (acquire mgmt-api-deploy 600) 1785447965 rollback ignores target -> live in nx_mgmt_api.elf (ONE reverse gear) 1785437278 unpack must not backdate -> live in nx_treepack.elf (REFUSED-WOULD-DROP-SYMBOLS) 1785451053 4 MiB piece truncation -> fixed in source, PCAP 4 MiB -> 32 MiB plus a drop COUNTER Every one cost a fresh session the same rediscovery: read the row, believe it, re-derive the fix, then find it already shipped. That is not bookkeeping -- it is the ledger ACTIVELY MISDIRECTING the scarcest resource in the ecosystem, from the boot path, to every seat, every session. LAW: A LEDGER THAT CANNOT CLOSE ITS OWN ROWS BECOMES A LIST OF SOLVED PROBLEMS. WHY THIS IS DECIDABLE (the join key, and it is exact): fixers annotate the fix SITE with the debt row index -- seq1467, seq1379 HALF-2, seq1734, seq1807 CAS. And nx_debt row index IS that number: `nx_debt eat 1785451053` answers at_idx=1734 while nx_torrent_get.nx carries seq1734 on the line that fixes it. Verified on three independent pairs before a line of this was written. So the set of seqN tags in the tree is the set of debts the tree CLAIMS to have fixed; intersect with rows still `open` and you have the stale-ledger set. WHAT IT DOES NOT DO, ON PURPOSE: it NEVER eats a debt. A seqN in source proves a fixer CITED that row -- not that the fix is correct, complete, or deployed. Auto-eating on a comment would swap one lying instrument for another, and a false EATEN is worse than an open row. The verdict is CANDIDATE-CLOSED: a queue for an agent to confirm by ARTIFACT and then eat deliberately. Corroborates; never convicts. NON-VACUITY (this instrument can fail, and says so): a scanner that matches nothing reports no-stale-rows forever while the ledger rots -- the redseen=0 / coverage-gaming / silent-512KB-cap class. So: zero seq tags found -> INSTRUMENT-BLIND exit 2, no verdict; zero rows loaded -> INSTRUMENT-BLIND exit 2; declared rows > found rows -> coverage_complete=0 and verdict PARTIAL, never a clean bill. nx_debtlive scan [prefix] [dir1] [dir2] full sweep -> JSON envelope plus bounded candidate list nx_debtlive check <idx> [dir1] [dir2] one row: does the tree cite seq<idx>? exit 0=cited 1=not

dependencies 3 imports · 0 importers

nx_store_seed_lib.nx nx_seg_store.nx nx_syscalls.nx nx_debtlive.nx

imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main dl_puts sys_write dl_len sys_exit dl_atoi sys_mmap dl_walk sys_openat_rd sys_mmap ↻ dl_len ↻ sys_getdents64 dirent_name dl_is_nx dl_len ↻ dl_read sys_openat_rd ↻ sys_read sys_close dl_scan_seqs dl_has dl_len ↻ dirent_reclen sys_close ↻ dl_cat dl_catn sys_mmap ↻ sys_write ↻ sts_load_honest ss_open_cached ssc_init sys_mmap ↻ ssc_sig_of ss_cat sys_fstatat ssc_streq ss_open ss_open2 sys_mmap ↻ ss_manifest_dyn

structs

none

consts

39const DL_MAGIC_1024: i64 = 1024
43const DL_CAP: i64 = 4194304
46const DL_MAXSEQ: i64 = 65536
47const DL_DIRBUF: i64 = 131072
48const DL_FILEBUF: i64 = 2097152 // largest .nx measured ~170KB; 2MB headroom, and the buffer is REUSED
49const DL_PATHCAP: i64 = 512
50const DL_OUTCAP: i64 = 262144
53const DL_LISTMAX: i64 = 240
58const DL_SCOPEMAX: i64 = 44
59const DL_TAB: i64 = 9
60const DL_NL: i64 = 10
61const DL_MINDIGITS: i64 = 3 // seq tags are 3-4 digits; rejects sequence, seq2 and friends
62const DL_MAXDIGITS: i64 = 7

functions

64func dl_len(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i }
65func dl_puts(s: *u8) -> i64 { sys_write(1, s, dl_len(s)); return 0 }
called by 1: main calls 2: sys_writedl_len
66func dl_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var o2: i64 = o; while s[i] != (0 as u8) { d[o2] = s[i]; o2 = o2 + 1; i = i + 1 } return o2 }
called by 1: main
67func dl_catn(d: *u8, o: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
79func dl_catsl(d: *u8, o: i64, src: *u8, off: i64, len: i64) -> i64
called by 1: main
85func dl_atoi(s: *u8) -> i64
called by 1: main
99func dl_read(path: *u8, buf: *u8, cap: i64) -> i64
115func dl_is_nx(nm: *u8) -> i64
called by 1: dl_walk calls 1: dl_len
127func dl_has(buf: *u8, a: i64, b: i64, pat: *u8) -> i64
called by 2: dl_scan_seqsmain calls 1: dl_len
151func dl_scan_seqs(buf: *u8, n: i64, bits: *u8, strong: *u8, st: *i64) -> i64
called by 1: dl_walk calls 1: dl_has
208func dl_walk(dir: *u8, bits: *u8, strong: *u8, st: *i64, fbuf: *u8) -> i64
241func main(argc: i64, argv: *i64) -> i64