nx_debtlive.nx
buildroot/runtime/nx_debtlive.nx
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
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
structs
| none |
consts
| 39 | const DL_MAGIC_1024: i64 = 1024 |
| 43 | const DL_CAP: i64 = 4194304 |
| 46 | const DL_MAXSEQ: i64 = 65536 |
| 47 | const DL_DIRBUF: i64 = 131072 |
| 48 | const DL_FILEBUF: i64 = 2097152 // largest .nx measured ~170KB; 2MB headroom, and the buffer is REUSED |
| 49 | const DL_PATHCAP: i64 = 512 |
| 50 | const DL_OUTCAP: i64 = 262144 |
| 53 | const DL_LISTMAX: i64 = 240 |
| 58 | const DL_SCOPEMAX: i64 = 44 |
| 59 | const DL_TAB: i64 = 9 |
| 60 | const DL_NL: i64 = 10 |
| 61 | const DL_MINDIGITS: i64 = 3 // seq tags are 3-4 digits; rejects sequence, seq2 and friends |
| 62 | const DL_MAXDIGITS: i64 = 7 |
functions
| 64 | func dl_len(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i } |
| 65 | func dl_puts(s: *u8) -> i64 { sys_write(1, s, dl_len(s)); return 0 } |
| 66 | func 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 |
| 67 | func dl_catn(d: *u8, o: i64, v: i64) -> i64 |
| 79 | func dl_catsl(d: *u8, o: i64, src: *u8, off: i64, len: i64) -> i64 called by 1: main |
| 85 | func dl_atoi(s: *u8) -> i64 called by 1: main |
| 99 | func dl_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 115 | func dl_is_nx(nm: *u8) -> i64 |
| 127 | func dl_has(buf: *u8, a: i64, b: i64, pat: *u8) -> i64 |
| 151 | func dl_scan_seqs(buf: *u8, n: i64, bits: *u8, strong: *u8, st: *i64) -> i64 |
| 208 | func dl_walk(dir: *u8, bits: *u8, strong: *u8, st: *i64, fbuf: *u8) -> i64 |
| 241 | func main(argc: i64, argv: *i64) -> i64 |