nx_debtlive.nx source
↩ module page · 440 lines · 23174 B
1// nx_debtlive.nx -- IS THIS DEBT ALREADY FIXED? A mechanical closure check for the debt ledger.
2// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
3//
4// THE DEFECT THIS EXISTS TO KILL: the debt ledger is the first thing a seat reads and the last thing that
5// gets corrected. Fixes land; the rows that described them stay `open`. MEASURED 2026-07-31 (ws=mgmt-staging-cas):
6// of the FIVE top sev-9 rows picked off `nx_debt sev 9`, FIVE were already fixed in source and FOUR were
7// verified LIVE in the deployed binaries by string-grep of the artifacts themselves --
8// 1785453352 unpack staging CAS -> live in nx_mgmt_api.elf (pins the unpack to YOUR source)
9// 1785450506 deploy takes no lease -> live in nx_mgmt_api.elf (acquire mgmt-api-deploy 600)
10// 1785447965 rollback ignores target -> live in nx_mgmt_api.elf (ONE reverse gear)
11// 1785437278 unpack must not backdate -> live in nx_treepack.elf (REFUSED-WOULD-DROP-SYMBOLS)
12// 1785451053 4 MiB piece truncation -> fixed in source, PCAP 4 MiB -> 32 MiB plus a drop COUNTER
13// Every one cost a fresh session the same rediscovery: read the row, believe it, re-derive the fix, then find
14// it already shipped. That is not bookkeeping -- it is the ledger ACTIVELY MISDIRECTING the scarcest resource
15// in the ecosystem, from the boot path, to every seat, every session.
16// LAW: A LEDGER THAT CANNOT CLOSE ITS OWN ROWS BECOMES A LIST OF SOLVED PROBLEMS.
17//
18// WHY THIS IS DECIDABLE (the join key, and it is exact): fixers annotate the fix SITE with the debt row index --
19// seq1467, seq1379 HALF-2, seq1734, seq1807 CAS. And nx_debt row index IS that number: `nx_debt eat 1785451053`
20// answers at_idx=1734 while nx_torrent_get.nx carries seq1734 on the line that fixes it. Verified on three
21// independent pairs before a line of this was written. So the set of seqN tags in the tree is the set of debts
22// the tree CLAIMS to have fixed; intersect with rows still `open` and you have the stale-ledger set.
23//
24// WHAT IT DOES NOT DO, ON PURPOSE: it NEVER eats a debt. A seqN in source proves a fixer CITED that row -- not
25// that the fix is correct, complete, or deployed. Auto-eating on a comment would swap one lying instrument for
26// another, and a false EATEN is worse than an open row. The verdict is CANDIDATE-CLOSED: a queue for an agent
27// to confirm by ARTIFACT and then eat deliberately. Corroborates; never convicts.
28//
29// NON-VACUITY (this instrument can fail, and says so): a scanner that matches nothing reports no-stale-rows
30// forever while the ledger rots -- the redseen=0 / coverage-gaming / silent-512KB-cap class. So: zero seq tags
31// found -> INSTRUMENT-BLIND exit 2, no verdict; zero rows loaded -> INSTRUMENT-BLIND exit 2; declared rows >
32// found rows -> coverage_complete=0 and verdict PARTIAL, never a clean bill.
33//
34// nx_debtlive scan [prefix] [dir1] [dir2] full sweep -> JSON envelope plus bounded candidate list
35// nx_debtlive check <idx> [dir1] [dir2] one row: does the tree cite seq<idx>? exit 0=cited 1=not
36import "nx_store_seed_lib.nx"
37import "nx_seg_store.nx"
38import "nx_syscalls.nx"
39const DL_MAGIC_1024: i64 = 1024
40
41// Plane read cap. Mirrors nx_debt.nx DB_CAP exactly -- reading the SAME plane with a SMALLER buffer is how an
42// instrument silently sees a prefix of the truth (nx_debt_view 512KB blindness, 734 rows of 1835).
43const DL_CAP: i64 = 4194304
44// Highest row index the seq bitmap holds. Plane is ~1950 rows growing ~500/wk, so 65536 is ~2.5 years of
45// headroom; a tag at or above it is COUNTED as out-of-range rather than silently ignored.
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
51// How many candidates to NAME. Totals are always exact; only the listing is bounded, and when it truncates the
52// envelope says so (listed < candidates) so a reader can never mistake the sample for the set.
53const DL_LISTMAX: i64 = 240
54// How much of a row's SCOPE (its short title) to carry into the candidate list. A bare idx/id pair is not
55// triageable -- you cannot tell a shipped-and-recorded row from a live defect without opening all 164. The
56// scope makes the queue scannable. Bounded so the whole list stays inside one readable response; it is a
57// triage HINT, never the record -- the row itself still decides, which is why this organ never eats.
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
63
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 }
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 }
67func dl_catn(d: *u8, o: i64, v: i64) -> i64 {
68 let t: *u8 = sys_mmap(32)
69 var m: i64 = v
70 if m < 0 { m = 0 }
71 var k: i64 = 0
72 if m == 0 { t[0] = 48 as u8; k = 1 }
73 while m > 0 { t[k] = ((m - (m / 10) * 10) + 48) as u8; m = m / 10; k = k + 1 }
74 var o2: i64 = o
75 var i: i64 = 0
76 while i < k { d[o2] = t[k - 1 - i]; o2 = o2 + 1; i = i + 1 }
77 return o2
78}
79func dl_catsl(d: *u8, o: i64, src: *u8, off: i64, len: i64) -> i64 {
80 var i: i64 = 0
81 var o2: i64 = o
82 while i < len { d[o2] = src[off + i]; o2 = o2 + 1; i = i + 1 }
83 return o2
84}
85func dl_atoi(s: *u8) -> i64 {
86 var v: i64 = 0
87 var i: i64 = 0
88 var go: i64 = 1
89 while go == 1 {
90 let c: i64 = s[i] as i64
91 if c < 48 { go = 0 } else { if c > 57 { go = 0 } else { v = v * 10 + (c - 48); i = i + 1 } }
92 }
93 return v
94}
95
96// Read a whole file into a REUSED buffer. Deliberately not sys_read_file: this runs once per .nx across a
97// ~20k-file tree, and a fresh mmap per file is an allocator in a loop -- a clock, not a leak, but it ends the
98// same way (the memfloor class). Returns bytes read; 0 on any failure (an absent file is not an error here).
99func dl_read(path: *u8, buf: *u8, cap: i64) -> i64 {
100 let fd: i64 = sys_openat_rd(path)
101 if fd < 0 { return 0 }
102 var tot: i64 = 0
103 var go: i64 = 1
104 while go == 1 {
105 let want: i64 = cap - tot
106 if want <= 0 { go = 0 } else {
107 let n: i64 = sys_read(fd, ((buf as i64) + tot) as *u8, want)
108 if n <= 0 { go = 0 } else { tot = tot + n }
109 }
110 }
111 sys_close(fd)
112 return tot
113}
114
115func dl_is_nx(nm: *u8) -> i64 {
116 let n: i64 = dl_len(nm)
117 if n < 4 { return 0 }
118 if nm[n-3] != (46 as u8) { return 0 }
119 if nm[n-2] != (110 as u8) { return 0 }
120 if nm[n-1] != (120 as u8) { return 0 }
121 return 1
122}
123
124// Scan for seq<digits> tokens and set their bit. st[0] += unique tags, st[1] += occurrences, st[2] += tags at
125// or above DL_MAXSEQ (counted, never silently dropped), st[3] += files scanned (set by the caller).
126// Does buf[a..b) contain the NUL-terminated needle? Bounded substring search over ONE row.
127func dl_has(buf: *u8, a: i64, b: i64, pat: *u8) -> i64 {
128 let m: i64 = dl_len(pat)
129 if m == 0 { return 0 }
130 var i: i64 = a
131 while i + m <= b {
132 var k: i64 = 0
133 var ok: i64 = 1
134 // CASE-FOLDED. Measured 2026-07-31: row 1784480109 declares "Residual = extract ... to a shared lib"
135 // and a case-SENSITIVE compare against "RESIDUAL" sailed straight past it, so the row scored clean and
136 // entered the top-ranked queue. Debt prose is written by humans across months; its capitalisation is
137 // not a contract. Folding here fixes every marker at once instead of enumerating spellings forever.
138 while k < m {
139 var c1: i64 = buf[i+k] as i64
140 var c2: i64 = pat[k] as i64
141 if c1 >= 97 { if c1 <= 122 { c1 = c1 - 32 } }
142 if c2 >= 97 { if c2 <= 122 { c2 = c2 - 32 } }
143 if c1 != c2 { ok = 0; k = m } else { k = k + 1 }
144 }
145 if ok == 1 { return 1 }
146 i = i + 1
147 }
148 return 0
149}
150
151func dl_scan_seqs(buf: *u8, n: i64, bits: *u8, strong: *u8, st: *i64) -> i64 {
152 var i: i64 = 0
153 while i + 4 <= n {
154 var hit: i64 = 0
155 if buf[i] == (115 as u8) { if buf[i+1] == (101 as u8) { if buf[i+2] == (113 as u8) { hit = 1 } } }
156 if hit == 1 {
157 var j: i64 = i + 3
158 var v: i64 = 0
159 var nd: i64 = 0
160 var go: i64 = 1
161 while go == 1 {
162 if j >= n { go = 0 } else {
163 let c: i64 = buf[j] as i64
164 if c < 48 { go = 0 } else { if c > 57 { go = 0 } else {
165 if nd >= DL_MAXDIGITS { go = 0 } else { v = v * 10 + (c - 48); j = j + 1; nd = nd + 1 }
166 } }
167 }
168 }
169 if nd >= DL_MINDIGITS {
170 st[1] = st[1] + 1
171 if v >= DL_MAXSEQ { st[2] = st[2] + 1 } else {
172 if v > 0 {
173 if bits[v] == (0 as u8) { bits[v] = 1 as u8; st[0] = st[0] + 1 }
174 // ---- CITATION CONTEXT: is this site a LEAF FIX or just a mention? ----------------
175 // Measured on 7 hand-confirmed candidates: 0 were closeable, because a bare tag cannot
176 // separate (a) a leaf fix that implements the row, (b) a RUNG citing its multi-part
177 // parent, (c) an INCIDENTAL mention in unrelated code. idx1445's ONLY citation was a
178 // parenthetical aside. So read the LINE the tag sits on: a tag on a line that also says
179 // ROOT FIX / FIXED / SHIPPED / CLOSES is claiming to BE the fix; a tag inside prose is
180 // claiming nothing. Still evidence ABOUT the citation, never about the artifact -- it
181 // RANKS the reading queue, it does not close anything.
182 var ls: i64 = i
183 var gl: i64 = 1
184 while gl == 1 {
185 if ls <= 0 { gl = 0 } else { if buf[ls-1] == (10 as u8) { gl = 0 } else { ls = ls - 1 } }
186 }
187 var le: i64 = i
188 var gr: i64 = 1
189 while gr == 1 {
190 if le >= n { gr = 0 } else { if buf[le] == (10 as u8) { gr = 0 } else { le = le + 1 } }
191 }
192 var sh: i64 = 0
193 if dl_has(buf, ls, le, "ROOT FIX" as *u8) == 1 { sh = 1 }
194 if dl_has(buf, ls, le, "FIXED" as *u8) == 1 { sh = 1 }
195 if dl_has(buf, ls, le, "SHIPPED" as *u8) == 1 { sh = 1 }
196 if dl_has(buf, ls, le, "CLOSES" as *u8) == 1 { sh = 1 }
197 if sh == 1 { if strong[v] == (0 as u8) { strong[v] = 1 as u8; st[4] = st[4] + 1 } }
198 }
199 }
200 }
201 if j > i { i = j } else { i = i + 1 }
202 } else { i = i + 1 }
203 }
204 return 0
205}
206
207// Walk ONE directory (non-recursive: every organ source lives directly in runtime/ or runtime/_hdl_build/).
208func dl_walk(dir: *u8, bits: *u8, strong: *u8, st: *i64, fbuf: *u8) -> i64 {
209 let fd: i64 = sys_openat_rd(dir)
210 if fd < 0 { return 0 }
211 let dbuf: *u8 = sys_mmap(DL_DIRBUF)
212 let path: *u8 = sys_mmap(DL_PATHCAP)
213 let dn: i64 = dl_len(dir)
214 var go: i64 = 1
215 while go == 1 {
216 let nr: i64 = sys_getdents64(fd, dbuf, DL_DIRBUF)
217 if nr <= 0 { go = 0 } else {
218 var off: i64 = 0
219 while off < nr {
220 let rec: *u8 = (dbuf as i64 + off) as *u8
221 let nm: *u8 = dirent_name(rec)
222 if dl_is_nx(nm) == 1 {
223 var p: i64 = 0
224 while p < dn { path[p] = dir[p]; p = p + 1 }
225 path[p] = 47 as u8
226 p = p + 1
227 var q2: i64 = 0
228 while nm[q2] != (0 as u8) { if p < DL_PATHCAP - 2 { path[p] = nm[q2]; p = p + 1 } q2 = q2 + 1 }
229 path[p] = 0 as u8
230 let fn2: i64 = dl_read(path, fbuf, DL_FILEBUF)
231 if fn2 > 0 { dl_scan_seqs(fbuf, fn2, bits, strong, st); st[3] = st[3] + 1 }
232 }
233 off = off + dirent_reclen(rec)
234 }
235 }
236 }
237 sys_close(fd)
238 return 0
239}
240
241func main(argc: i64, argv: *i64) -> i64 {
242 if argc < 2 {
243 dl_puts("usage: nx_debtlive scan [prefix] [dir1] [dir2] | nx_debtlive check <idx> [dir1] [dir2]\n" as *u8)
244 sys_exit(2); return 2
245 }
246 let verb: *u8 = argv[1] as *u8
247 var is_check: i64 = 0
248 if verb[0] == (99 as u8) { is_check = 1 }
249
250 var prefix: *u8 = "knowledge/store/debt-" as *u8
251 var dir1: *u8 = "buildroot/runtime" as *u8
252 var dir2: *u8 = "buildroot/runtime/_hdl_build" as *u8
253 var want: i64 = 0
254 if is_check == 1 {
255 if argc < 3 { dl_puts("usage: nx_debtlive check <idx>\n" as *u8); sys_exit(2); return 2 }
256 want = dl_atoi(argv[2] as *u8)
257 if argc > 3 { dir1 = argv[3] as *u8 }
258 if argc > 4 { dir2 = argv[4] as *u8 }
259 } else {
260 if argc > 2 { prefix = argv[2] as *u8 }
261 if argc > 3 { dir1 = argv[3] as *u8 }
262 if argc > 4 { dir2 = argv[4] as *u8 }
263 }
264
265 let bits: *u8 = sys_mmap(DL_MAXSEQ)
266 let strongb: *u8 = sys_mmap(DL_MAXSEQ)
267 let st: *i64 = sys_mmap(64) as *i64
268 st[0] = 0
269 st[1] = 0
270 st[2] = 0
271 st[3] = 0
272 st[4] = 0
273 let fbuf: *u8 = sys_mmap(DL_FILEBUF)
274 dl_walk(dir1, bits, strongb, st, fbuf)
275 dl_walk(dir2, bits, strongb, st, fbuf)
276
277 // NON-VACUITY TOOTH. Zero tags means the walk found nothing to test -- wrong cwd, wrong dirs, stripped tree.
278 // Reporting no-stale-rows from that state is the lie this organ exists to prevent.
279 if st[0] == 0 {
280 dl_puts("{\"organ\":\"nx_debtlive\",\"verdict\":\"INSTRUMENT-BLIND\",\"reason\":\"zero seqN tags found in the source tree -- nothing was compared, so NO closure claim is made\",\"dirs\":\"" as *u8)
281 dl_puts(dir1); dl_puts(" " as *u8); dl_puts(dir2); dl_puts("\"}\n" as *u8)
282 sys_exit(2); return 2
283 }
284
285 if is_check == 1 {
286 let ob2: *u8 = sys_mmap(DL_MAGIC_1024)
287 var o3: i64 = dl_cat(ob2, 0, "{\"organ\":\"nx_debtlive\",\"verb\":\"check\",\"seq\":" as *u8)
288 o3 = dl_catn(ob2, o3, want)
289 var cited2: i64 = 0
290 if want > 0 { if want < DL_MAXSEQ { if bits[want] != (0 as u8) { cited2 = 1 } } }
291 if cited2 == 1 { o3 = dl_cat(ob2, o3, ",\"verdict\":\"CITED-IN-SOURCE\",\"note\":\"a fix site names this row; confirm by ARTIFACT before eating\"" as *u8) }
292 else { o3 = dl_cat(ob2, o3, ",\"verdict\":\"NOT-CITED\",\"note\":\"no fix site names this row; treat as genuinely open\"" as *u8) }
293 o3 = dl_cat(ob2, o3, ",\"unique_tags\":" as *u8); o3 = dl_catn(ob2, o3, st[0])
294 o3 = dl_cat(ob2, o3, ",\"files_scanned\":" as *u8); o3 = dl_catn(ob2, o3, st[3])
295 o3 = dl_cat(ob2, o3, "}\n" as *u8)
296 sys_write(1, ob2, o3)
297 if cited2 == 1 { sys_exit(0); return 0 }
298 sys_exit(1); return 1
299 }
300
301 let q: *u8 = sys_mmap(DL_CAP)
302 let dbf: *i64 = sys_mmap(64) as *i64
303 dbf[0] = 0
304 dbf[1] = 0
305 let n: i64 = sts_load_honest(prefix, q, DL_CAP, dbf)
306 if n <= 0 {
307 dl_puts("{\"organ\":\"nx_debtlive\",\"verdict\":\"INSTRUMENT-BLIND\",\"reason\":\"debt plane loaded ZERO bytes -- no rows were examined\"}\n" as *u8)
308 sys_exit(2); return 2
309 }
310
311 let ob: *u8 = sys_mmap(DL_OUTCAP)
312 var o: i64 = dl_cat(ob, 0, "{\"organ\":\"nx_debtlive\",\"verb\":\"scan\",\"candidate_rows\":[" as *u8)
313 var rows: i64 = 0
314 var open_rows: i64 = 0
315 var cand: i64 = 0
316 var cand_hi: i64 = 0
317 var blk: i64 = 0
318 var rank1: i64 = 0
319 var listed: i64 = 0
320 var pos: i64 = 0
321 while pos < n {
322 var e: i64 = pos
323 var fin: i64 = 0
324 while fin == 0 {
325 if e >= n { fin = 1 } else { if q[e] == (DL_NL as u8) { fin = 1 } else { e = e + 1 } }
326 }
327 if e > pos {
328 var f: i64 = 0
329 var fs: i64 = pos
330 var k: i64 = pos
331 var ep_off: i64 = pos
332 var ep_len: i64 = 0
333 var sev_off: i64 = 0 - 1
334 var sev_len: i64 = 0
335 var st_off: i64 = 0 - 1
336 var st_len: i64 = 0
337 var sc_off: i64 = 0 - 1
338 var sc_len: i64 = 0
339 while k <= e {
340 var sep: i64 = 0
341 if k == e { sep = 1 } else { if q[k] == (DL_TAB as u8) { sep = 1 } }
342 if sep == 1 {
343 if f == 0 { ep_off = fs; ep_len = k - fs }
344 if f == 1 { sev_off = fs; sev_len = k - fs }
345 if f == 2 { sc_off = fs; sc_len = k - fs }
346 if f == 3 { st_off = fs; st_len = k - fs }
347 f = f + 1
348 fs = k + 1
349 }
350 k = k + 1
351 }
352 var is_open: i64 = 0
353 if st_len == 4 { if st_off >= 0 {
354 if q[st_off] == (111 as u8) { if q[st_off+1] == (112 as u8) { if q[st_off+2] == (101 as u8) { if q[st_off+3] == (110 as u8) { is_open = 1 } } } }
355 } }
356 if is_open == 1 {
357 open_rows = open_rows + 1
358 var cited: i64 = 0
359 if rows > 0 { if rows < DL_MAXSEQ { if bits[rows] != (0 as u8) { cited = 1 } } }
360 if cited == 1 {
361 cand = cand + 1
362 var sev: i64 = 0
363 if sev_len > 0 { if sev_off >= 0 { sev = (q[sev_off] as i64) - 48 } }
364 // ---- PRECISION: does the ROW ITSELF declare that work remains? ---------------------
365 // Measured 2026-07-31 on the first five candidates confirmed by hand: 0 of 5 were
366 // closeable, because A ROW IS USUALLY BROADER THAN THE FIX THAT CITES IT -- a rung cites
367 // its PARENT (R1/R1b/R1c each cite seq1506 while shipping one piece of a five-piece ask).
368 // So CITED reliably means someone worked on this and only weakly means this is done.
369 // These markers are the row's OWN words about its own residue, not my judgement of it,
370 // which is why this is a derived signal and not taste. A row that says work remains is
371 // NOT closeable no matter how many fix sites cite it.
372 var blocked: i64 = 0
373 if dl_has(q, pos, e, "RESIDUAL" as *u8) == 1 { blocked = 1 }
374 if dl_has(q, pos, e, "STILL OPEN" as *u8) == 1 { blocked = 1 }
375 if dl_has(q, pos, e, "STILL UNEXPLAINED" as *u8) == 1 { blocked = 1 }
376 if dl_has(q, pos, e, "not close" as *u8) == 1 { blocked = 1 }
377 if dl_has(q, pos, e, "NOT close" as *u8) == 1 { blocked = 1 }
378 if dl_has(q, pos, e, "REMAINS" as *u8) == 1 { blocked = 1 }
379 // "REMAINING:" is the single most common way a row lists its own unfinished rungs, and
380 // "REMAINS" does NOT match it. Row 1785438962 listed three REMAINING items and still
381 // scored clean. Enumerated separately rather than truncating to "REMAIN", which would
382 // also fire on "remainder" and on prose like "what remained unclear".
383 if dl_has(q, pos, e, "REMAINING" as *u8) == 1 { blocked = 1 }
384 if dl_has(q, pos, e, "NOT YET" as *u8) == 1 { blocked = 1 }
385 if dl_has(q, pos, e, "UNFINISHED" as *u8) == 1 { blocked = 1 }
386 if blocked == 1 { blk = blk + 1 }
387 if sev >= 8 { cand_hi = cand_hi + 1 }
388 if listed < DL_LISTMAX { if o < DL_OUTCAP - 512 {
389 if listed > 0 { o = dl_cat(ob, o, "," as *u8) }
390 o = dl_cat(ob, o, "{\"idx\":" as *u8)
391 o = dl_catn(ob, o, rows)
392 o = dl_cat(ob, o, ",\"id\":" as *u8)
393 o = dl_catsl(ob, o, q, ep_off, ep_len)
394 o = dl_cat(ob, o, ",\"sev\":" as *u8)
395 o = dl_catn(ob, o, sev)
396 o = dl_cat(ob, o, ",\"self_blocked\":" as *u8)
397 o = dl_catn(ob, o, blocked)
398 o = dl_cat(ob, o, ",\"strong\":" as *u8)
399 var strg: i64 = 0
400 if rows < DL_MAXSEQ { if strongb[rows] != (0 as u8) { strg = 1 } }
401 o = dl_catn(ob, o, strg)
402 if strg == 1 { if blocked == 0 { rank1 = rank1 + 1 } }
403 o = dl_cat(ob, o, ",\"scope\":\"" as *u8)
404 var scl: i64 = sc_len
405 if scl > DL_SCOPEMAX { scl = DL_SCOPEMAX }
406 if sc_off >= 0 { if scl > 0 { o = dl_catsl(ob, o, q, sc_off, scl) } }
407 o = dl_cat(ob, o, "\"}" as *u8)
408 listed = listed + 1
409 } }
410 }
411 }
412 rows = rows + 1
413 }
414 pos = e + 1
415 }
416
417 o = dl_cat(ob, o, "],\"rows\":" as *u8); o = dl_catn(ob, o, rows)
418 o = dl_cat(ob, o, ",\"open_rows\":" as *u8); o = dl_catn(ob, o, open_rows)
419 o = dl_cat(ob, o, ",\"candidates\":" as *u8); o = dl_catn(ob, o, cand)
420 o = dl_cat(ob, o, ",\"candidates_sev8plus\":" as *u8); o = dl_catn(ob, o, cand_hi)
421 o = dl_cat(ob, o, ",\"self_blocked\":" as *u8); o = dl_catn(ob, o, blk)
422 o = dl_cat(ob, o, ",\"strong_cites\":" as *u8); o = dl_catn(ob, o, st[4])
423 o = dl_cat(ob, o, ",\"RANK1_strong_and_clean\":" as *u8); o = dl_catn(ob, o, rank1)
424 o = dl_cat(ob, o, ",\"clean_candidates\":" as *u8); o = dl_catn(ob, o, cand - blk)
425 o = dl_cat(ob, o, ",\"listed\":" as *u8); o = dl_catn(ob, o, listed)
426 o = dl_cat(ob, o, ",\"unique_seq_tags\":" as *u8); o = dl_catn(ob, o, st[0])
427 o = dl_cat(ob, o, ",\"seq_occurrences\":" as *u8); o = dl_catn(ob, o, st[1])
428 o = dl_cat(ob, o, ",\"seq_out_of_range\":" as *u8); o = dl_catn(ob, o, st[2])
429 o = dl_cat(ob, o, ",\"files_scanned\":" as *u8); o = dl_catn(ob, o, st[3])
430 o = dl_cat(ob, o, ",\"plane_declared\":" as *u8); o = dl_catn(ob, o, dbf[0])
431 o = dl_cat(ob, o, ",\"plane_found\":" as *u8); o = dl_catn(ob, o, dbf[1])
432 var complete: i64 = 1
433 if dbf[1] < dbf[0] { complete = 0 }
434 o = dl_cat(ob, o, ",\"coverage_complete\":" as *u8); o = dl_catn(ob, o, complete)
435 if complete == 1 { o = dl_cat(ob, o, ",\"verdict\":\"COMPLETE\"" as *u8) }
436 else { o = dl_cat(ob, o, ",\"verdict\":\"PARTIAL\",\"reason\":\"plane load returned fewer rows than the plane declares -- some rows were never examined\"" as *u8) }
437 o = dl_cat(ob, o, ",\"note\":\"CANDIDATE-CLOSED means a fix site in source CITES seq<idx>. It is a QUEUE, not a verdict: confirm against the DEPLOYED artifact before nx_debt eat. This organ never eats anything.\"}\n" as *u8)
438 sys_write(1, ob, o)
439 sys_exit(0); return 0
440}