nx_debtlive.nx source
↩ module page · 447 lines · 23962 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).
43// 2026-08-06: RAISED 4194304 -> 33554432 IN LOCKSTEP WITH nx_debt.nx DB_CAP, because the plane CROSSED 4 MiB
44// (measured 4,217,666B / 3,326 rows; nx_debt page saw 3311 and could not show the ~15 newest rows).
45// ***THE MIRROR IS THE DEFECT.*** Three organs hand-copy this number and each carries a comment swearing it
46// mirrors the others -- which is exactly the condition under which they stop. It happened within the hour:
47// nx_debt.nx was raised first and THIS FILE was briefly left at 4 MiB, reading the same plane with a smaller
48// buffer, the precise failure the line above warns about. A CONSTANT THAT MUST AGREE ACROSS FILES AND IS
49// MAINTAINED BY HAND WILL DIVERGE ON THE NEXT EDIT; the real fix is ONE exported cap in the shared plane lib.
50const DL_CAP: i64 = 33554432
51// Highest row index the seq bitmap holds. Plane is ~1950 rows growing ~500/wk, so 65536 is ~2.5 years of
52// headroom; a tag at or above it is COUNTED as out-of-range rather than silently ignored.
53const DL_MAXSEQ: i64 = 65536
54const DL_DIRBUF: i64 = 131072
55const DL_FILEBUF: i64 = 2097152 // largest .nx measured ~170KB; 2MB headroom, and the buffer is REUSED
56const DL_PATHCAP: i64 = 512
57const DL_OUTCAP: i64 = 262144
58// How many candidates to NAME. Totals are always exact; only the listing is bounded, and when it truncates the
59// envelope says so (listed < candidates) so a reader can never mistake the sample for the set.
60const DL_LISTMAX: i64 = 240
61// How much of a row's SCOPE (its short title) to carry into the candidate list. A bare idx/id pair is not
62// triageable -- you cannot tell a shipped-and-recorded row from a live defect without opening all 164. The
63// scope makes the queue scannable. Bounded so the whole list stays inside one readable response; it is a
64// triage HINT, never the record -- the row itself still decides, which is why this organ never eats.
65const DL_SCOPEMAX: i64 = 44
66const DL_TAB: i64 = 9
67const DL_NL: i64 = 10
68const DL_MINDIGITS: i64 = 3 // seq tags are 3-4 digits; rejects sequence, seq2 and friends
69const DL_MAXDIGITS: i64 = 7
70
71func dl_len(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i }
72func dl_puts(s: *u8) -> i64 { sys_write(1, s, dl_len(s)); return 0 }
73func 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 }
74func dl_catn(d: *u8, o: i64, v: i64) -> i64 {
75 let t: *u8 = sys_mmap(32)
76 var m: i64 = v
77 if m < 0 { d[o] = 45 as u8; o = o + 1; m = 0 - m }
78 var k: i64 = 0
79 if m == 0 { t[0] = 48 as u8; k = 1 }
80 while m > 0 { t[k] = ((m - (m / 10) * 10) + 48) as u8; m = m / 10; k = k + 1 }
81 var o2: i64 = o
82 var i: i64 = 0
83 while i < k { d[o2] = t[k - 1 - i]; o2 = o2 + 1; i = i + 1 }
84 return o2
85}
86func dl_catsl(d: *u8, o: i64, src: *u8, off: i64, len: i64) -> i64 {
87 var i: i64 = 0
88 var o2: i64 = o
89 while i < len { d[o2] = src[off + i]; o2 = o2 + 1; i = i + 1 }
90 return o2
91}
92func dl_atoi(s: *u8) -> i64 {
93 var v: i64 = 0
94 var i: i64 = 0
95 var go: i64 = 1
96 while go == 1 {
97 let c: i64 = s[i] as i64
98 if c < 48 { go = 0 } else { if c > 57 { go = 0 } else { v = v * 10 + (c - 48); i = i + 1 } }
99 }
100 return v
101}
102
103// Read a whole file into a REUSED buffer. Deliberately not sys_read_file: this runs once per .nx across a
104// ~20k-file tree, and a fresh mmap per file is an allocator in a loop -- a clock, not a leak, but it ends the
105// same way (the memfloor class). Returns bytes read; 0 on any failure (an absent file is not an error here).
106func dl_read(path: *u8, buf: *u8, cap: i64) -> i64 {
107 let fd: i64 = sys_openat_rd(path)
108 if fd < 0 { return 0 }
109 var tot: i64 = 0
110 var go: i64 = 1
111 while go == 1 {
112 let want: i64 = cap - tot
113 if want <= 0 { go = 0 } else {
114 let n: i64 = sys_read(fd, ((buf as i64) + tot) as *u8, want)
115 if n <= 0 { go = 0 } else { tot = tot + n }
116 }
117 }
118 sys_close(fd)
119 return tot
120}
121
122func dl_is_nx(nm: *u8) -> i64 {
123 let n: i64 = dl_len(nm)
124 if n < 4 { return 0 }
125 if nm[n-3] != (46 as u8) { return 0 }
126 if nm[n-2] != (110 as u8) { return 0 }
127 if nm[n-1] != (120 as u8) { return 0 }
128 return 1
129}
130
131// Scan for seq<digits> tokens and set their bit. st[0] += unique tags, st[1] += occurrences, st[2] += tags at
132// or above DL_MAXSEQ (counted, never silently dropped), st[3] += files scanned (set by the caller).
133// Does buf[a..b) contain the NUL-terminated needle? Bounded substring search over ONE row.
134func dl_has(buf: *u8, a: i64, b: i64, pat: *u8) -> i64 {
135 let m: i64 = dl_len(pat)
136 if m == 0 { return 0 }
137 var i: i64 = a
138 while i + m <= b {
139 var k: i64 = 0
140 var ok: i64 = 1
141 // CASE-FOLDED. Measured 2026-07-31: row 1784480109 declares "Residual = extract ... to a shared lib"
142 // and a case-SENSITIVE compare against "RESIDUAL" sailed straight past it, so the row scored clean and
143 // entered the top-ranked queue. Debt prose is written by humans across months; its capitalisation is
144 // not a contract. Folding here fixes every marker at once instead of enumerating spellings forever.
145 while k < m {
146 var c1: i64 = buf[i+k] as i64
147 var c2: i64 = pat[k] as i64
148 if c1 >= 97 { if c1 <= 122 { c1 = c1 - 32 } }
149 if c2 >= 97 { if c2 <= 122 { c2 = c2 - 32 } }
150 if c1 != c2 { ok = 0; k = m } else { k = k + 1 }
151 }
152 if ok == 1 { return 1 }
153 i = i + 1
154 }
155 return 0
156}
157
158func dl_scan_seqs(buf: *u8, n: i64, bits: *u8, strong: *u8, st: *i64) -> i64 {
159 var i: i64 = 0
160 while i + 4 <= n {
161 var hit: i64 = 0
162 if buf[i] == (115 as u8) { if buf[i+1] == (101 as u8) { if buf[i+2] == (113 as u8) { hit = 1 } } }
163 if hit == 1 {
164 var j: i64 = i + 3
165 var v: i64 = 0
166 var nd: i64 = 0
167 var go: i64 = 1
168 while go == 1 {
169 if j >= n { go = 0 } else {
170 let c: i64 = buf[j] as i64
171 if c < 48 { go = 0 } else { if c > 57 { go = 0 } else {
172 if nd >= DL_MAXDIGITS { go = 0 } else { v = v * 10 + (c - 48); j = j + 1; nd = nd + 1 }
173 } }
174 }
175 }
176 if nd >= DL_MINDIGITS {
177 st[1] = st[1] + 1
178 if v >= DL_MAXSEQ { st[2] = st[2] + 1 } else {
179 if v > 0 {
180 if bits[v] == (0 as u8) { bits[v] = 1 as u8; st[0] = st[0] + 1 }
181 // ---- CITATION CONTEXT: is this site a LEAF FIX or just a mention? ----------------
182 // Measured on 7 hand-confirmed candidates: 0 were closeable, because a bare tag cannot
183 // separate (a) a leaf fix that implements the row, (b) a RUNG citing its multi-part
184 // parent, (c) an INCIDENTAL mention in unrelated code. idx1445's ONLY citation was a
185 // parenthetical aside. So read the LINE the tag sits on: a tag on a line that also says
186 // ROOT FIX / FIXED / SHIPPED / CLOSES is claiming to BE the fix; a tag inside prose is
187 // claiming nothing. Still evidence ABOUT the citation, never about the artifact -- it
188 // RANKS the reading queue, it does not close anything.
189 var ls: i64 = i
190 var gl: i64 = 1
191 while gl == 1 {
192 if ls <= 0 { gl = 0 } else { if buf[ls-1] == (10 as u8) { gl = 0 } else { ls = ls - 1 } }
193 }
194 var le: i64 = i
195 var gr: i64 = 1
196 while gr == 1 {
197 if le >= n { gr = 0 } else { if buf[le] == (10 as u8) { gr = 0 } else { le = le + 1 } }
198 }
199 var sh: i64 = 0
200 if dl_has(buf, ls, le, "ROOT FIX" as *u8) == 1 { sh = 1 }
201 if dl_has(buf, ls, le, "FIXED" as *u8) == 1 { sh = 1 }
202 if dl_has(buf, ls, le, "SHIPPED" as *u8) == 1 { sh = 1 }
203 if dl_has(buf, ls, le, "CLOSES" as *u8) == 1 { sh = 1 }
204 if sh == 1 { if strong[v] == (0 as u8) { strong[v] = 1 as u8; st[4] = st[4] + 1 } }
205 }
206 }
207 }
208 if j > i { i = j } else { i = i + 1 }
209 } else { i = i + 1 }
210 }
211 return 0
212}
213
214// Walk ONE directory (non-recursive: every organ source lives directly in runtime/ or runtime/_hdl_build/).
215func dl_walk(dir: *u8, bits: *u8, strong: *u8, st: *i64, fbuf: *u8) -> i64 {
216 let fd: i64 = sys_openat_rd(dir)
217 if fd < 0 { return 0 }
218 let dbuf: *u8 = sys_mmap(DL_DIRBUF)
219 let path: *u8 = sys_mmap(DL_PATHCAP)
220 let dn: i64 = dl_len(dir)
221 var go: i64 = 1
222 while go == 1 {
223 let nr: i64 = sys_getdents64(fd, dbuf, DL_DIRBUF)
224 if nr <= 0 { go = 0 } else {
225 var off: i64 = 0
226 while off < nr {
227 let rec: *u8 = (dbuf as i64 + off) as *u8
228 let nm: *u8 = dirent_name(rec)
229 if dl_is_nx(nm) == 1 {
230 var p: i64 = 0
231 while p < dn { path[p] = dir[p]; p = p + 1 }
232 path[p] = 47 as u8
233 p = p + 1
234 var q2: i64 = 0
235 while nm[q2] != (0 as u8) { if p < DL_PATHCAP - 2 { path[p] = nm[q2]; p = p + 1 } q2 = q2 + 1 }
236 path[p] = 0 as u8
237 let fn2: i64 = dl_read(path, fbuf, DL_FILEBUF)
238 if fn2 > 0 { dl_scan_seqs(fbuf, fn2, bits, strong, st); st[3] = st[3] + 1 }
239 }
240 off = off + dirent_reclen(rec)
241 }
242 }
243 }
244 sys_close(fd)
245 return 0
246}
247
248func main(argc: i64, argv: *i64) -> i64 {
249 if argc < 2 {
250 dl_puts("usage: nx_debtlive scan [prefix] [dir1] [dir2] | nx_debtlive check <idx> [dir1] [dir2]\n" as *u8)
251 sys_exit(2); return 2
252 }
253 let verb: *u8 = argv[1] as *u8
254 var is_check: i64 = 0
255 if verb[0] == (99 as u8) { is_check = 1 }
256
257 var prefix: *u8 = "knowledge/store/debt-" as *u8
258 var dir1: *u8 = "buildroot/runtime" as *u8
259 var dir2: *u8 = "buildroot/runtime/_hdl_build" as *u8
260 var want: i64 = 0
261 if is_check == 1 {
262 if argc < 3 { dl_puts("usage: nx_debtlive check <idx>\n" as *u8); sys_exit(2); return 2 }
263 want = dl_atoi(argv[2] as *u8)
264 if argc > 3 { dir1 = argv[3] as *u8 }
265 if argc > 4 { dir2 = argv[4] as *u8 }
266 } else {
267 if argc > 2 { prefix = argv[2] as *u8 }
268 if argc > 3 { dir1 = argv[3] as *u8 }
269 if argc > 4 { dir2 = argv[4] as *u8 }
270 }
271
272 let bits: *u8 = sys_mmap(DL_MAXSEQ)
273 let strongb: *u8 = sys_mmap(DL_MAXSEQ)
274 let st: *i64 = sys_mmap(64) as *i64
275 st[0] = 0
276 st[1] = 0
277 st[2] = 0
278 st[3] = 0
279 st[4] = 0
280 let fbuf: *u8 = sys_mmap(DL_FILEBUF)
281 dl_walk(dir1, bits, strongb, st, fbuf)
282 dl_walk(dir2, bits, strongb, st, fbuf)
283
284 // NON-VACUITY TOOTH. Zero tags means the walk found nothing to test -- wrong cwd, wrong dirs, stripped tree.
285 // Reporting no-stale-rows from that state is the lie this organ exists to prevent.
286 if st[0] == 0 {
287 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)
288 dl_puts(dir1); dl_puts(" " as *u8); dl_puts(dir2); dl_puts("\"}\n" as *u8)
289 sys_exit(2); return 2
290 }
291
292 if is_check == 1 {
293 let ob2: *u8 = sys_mmap(DL_MAGIC_1024)
294 var o3: i64 = dl_cat(ob2, 0, "{\"organ\":\"nx_debtlive\",\"verb\":\"check\",\"seq\":" as *u8)
295 o3 = dl_catn(ob2, o3, want)
296 var cited2: i64 = 0
297 if want > 0 { if want < DL_MAXSEQ { if bits[want] != (0 as u8) { cited2 = 1 } } }
298 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) }
299 else { o3 = dl_cat(ob2, o3, ",\"verdict\":\"NOT-CITED\",\"note\":\"no fix site names this row; treat as genuinely open\"" as *u8) }
300 o3 = dl_cat(ob2, o3, ",\"unique_tags\":" as *u8); o3 = dl_catn(ob2, o3, st[0])
301 o3 = dl_cat(ob2, o3, ",\"files_scanned\":" as *u8); o3 = dl_catn(ob2, o3, st[3])
302 o3 = dl_cat(ob2, o3, "}\n" as *u8)
303 sys_write(1, ob2, o3)
304 if cited2 == 1 { sys_exit(0); return 0 }
305 sys_exit(1); return 1
306 }
307
308 let q: *u8 = sys_mmap(DL_CAP)
309 let dbf: *i64 = sys_mmap(64) as *i64
310 dbf[0] = 0
311 dbf[1] = 0
312 let n: i64 = sts_load_honest(prefix, q, DL_CAP, dbf)
313 if n <= 0 {
314 dl_puts("{\"organ\":\"nx_debtlive\",\"verdict\":\"INSTRUMENT-BLIND\",\"reason\":\"debt plane loaded ZERO bytes -- no rows were examined\"}\n" as *u8)
315 sys_exit(2); return 2
316 }
317
318 let ob: *u8 = sys_mmap(DL_OUTCAP)
319 var o: i64 = dl_cat(ob, 0, "{\"organ\":\"nx_debtlive\",\"verb\":\"scan\",\"candidate_rows\":[" as *u8)
320 var rows: i64 = 0
321 var open_rows: i64 = 0
322 var cand: i64 = 0
323 var cand_hi: i64 = 0
324 var blk: i64 = 0
325 var rank1: i64 = 0
326 var listed: i64 = 0
327 var pos: i64 = 0
328 while pos < n {
329 var e: i64 = pos
330 var fin: i64 = 0
331 while fin == 0 {
332 if e >= n { fin = 1 } else { if q[e] == (DL_NL as u8) { fin = 1 } else { e = e + 1 } }
333 }
334 if e > pos {
335 var f: i64 = 0
336 var fs: i64 = pos
337 var k: i64 = pos
338 var ep_off: i64 = pos
339 var ep_len: i64 = 0
340 var sev_off: i64 = 0 - 1
341 var sev_len: i64 = 0
342 var st_off: i64 = 0 - 1
343 var st_len: i64 = 0
344 var sc_off: i64 = 0 - 1
345 var sc_len: i64 = 0
346 while k <= e {
347 var sep: i64 = 0
348 if k == e { sep = 1 } else { if q[k] == (DL_TAB as u8) { sep = 1 } }
349 if sep == 1 {
350 if f == 0 { ep_off = fs; ep_len = k - fs }
351 if f == 1 { sev_off = fs; sev_len = k - fs }
352 if f == 2 { sc_off = fs; sc_len = k - fs }
353 if f == 3 { st_off = fs; st_len = k - fs }
354 f = f + 1
355 fs = k + 1
356 }
357 k = k + 1
358 }
359 var is_open: i64 = 0
360 if st_len == 4 { if st_off >= 0 {
361 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 } } } }
362 } }
363 if is_open == 1 {
364 open_rows = open_rows + 1
365 var cited: i64 = 0
366 if rows > 0 { if rows < DL_MAXSEQ { if bits[rows] != (0 as u8) { cited = 1 } } }
367 if cited == 1 {
368 cand = cand + 1
369 var sev: i64 = 0
370 if sev_len > 0 { if sev_off >= 0 { sev = (q[sev_off] as i64) - 48 } }
371 // ---- PRECISION: does the ROW ITSELF declare that work remains? ---------------------
372 // Measured 2026-07-31 on the first five candidates confirmed by hand: 0 of 5 were
373 // closeable, because A ROW IS USUALLY BROADER THAN THE FIX THAT CITES IT -- a rung cites
374 // its PARENT (R1/R1b/R1c each cite seq1506 while shipping one piece of a five-piece ask).
375 // So CITED reliably means someone worked on this and only weakly means this is done.
376 // These markers are the row's OWN words about its own residue, not my judgement of it,
377 // which is why this is a derived signal and not taste. A row that says work remains is
378 // NOT closeable no matter how many fix sites cite it.
379 var blocked: i64 = 0
380 if dl_has(q, pos, e, "RESIDUAL" as *u8) == 1 { blocked = 1 }
381 if dl_has(q, pos, e, "STILL OPEN" as *u8) == 1 { blocked = 1 }
382 if dl_has(q, pos, e, "STILL UNEXPLAINED" as *u8) == 1 { blocked = 1 }
383 if dl_has(q, pos, e, "not close" as *u8) == 1 { blocked = 1 }
384 if dl_has(q, pos, e, "NOT close" as *u8) == 1 { blocked = 1 }
385 if dl_has(q, pos, e, "REMAINS" as *u8) == 1 { blocked = 1 }
386 // "REMAINING:" is the single most common way a row lists its own unfinished rungs, and
387 // "REMAINS" does NOT match it. Row 1785438962 listed three REMAINING items and still
388 // scored clean. Enumerated separately rather than truncating to "REMAIN", which would
389 // also fire on "remainder" and on prose like "what remained unclear".
390 if dl_has(q, pos, e, "REMAINING" as *u8) == 1 { blocked = 1 }
391 if dl_has(q, pos, e, "NOT YET" as *u8) == 1 { blocked = 1 }
392 if dl_has(q, pos, e, "UNFINISHED" as *u8) == 1 { blocked = 1 }
393 if blocked == 1 { blk = blk + 1 }
394 if sev >= 8 { cand_hi = cand_hi + 1 }
395 if listed < DL_LISTMAX { if o < DL_OUTCAP - 512 {
396 if listed > 0 { o = dl_cat(ob, o, "," as *u8) }
397 o = dl_cat(ob, o, "{\"idx\":" as *u8)
398 o = dl_catn(ob, o, rows)
399 o = dl_cat(ob, o, ",\"id\":" as *u8)
400 o = dl_catsl(ob, o, q, ep_off, ep_len)
401 o = dl_cat(ob, o, ",\"sev\":" as *u8)
402 o = dl_catn(ob, o, sev)
403 o = dl_cat(ob, o, ",\"self_blocked\":" as *u8)
404 o = dl_catn(ob, o, blocked)
405 o = dl_cat(ob, o, ",\"strong\":" as *u8)
406 var strg: i64 = 0
407 if rows < DL_MAXSEQ { if strongb[rows] != (0 as u8) { strg = 1 } }
408 o = dl_catn(ob, o, strg)
409 if strg == 1 { if blocked == 0 { rank1 = rank1 + 1 } }
410 o = dl_cat(ob, o, ",\"scope\":\"" as *u8)
411 var scl: i64 = sc_len
412 if scl > DL_SCOPEMAX { scl = DL_SCOPEMAX }
413 if sc_off >= 0 { if scl > 0 { o = dl_catsl(ob, o, q, sc_off, scl) } }
414 o = dl_cat(ob, o, "\"}" as *u8)
415 listed = listed + 1
416 } }
417 }
418 }
419 rows = rows + 1
420 }
421 pos = e + 1
422 }
423
424 o = dl_cat(ob, o, "],\"rows\":" as *u8); o = dl_catn(ob, o, rows)
425 o = dl_cat(ob, o, ",\"open_rows\":" as *u8); o = dl_catn(ob, o, open_rows)
426 o = dl_cat(ob, o, ",\"candidates\":" as *u8); o = dl_catn(ob, o, cand)
427 o = dl_cat(ob, o, ",\"candidates_sev8plus\":" as *u8); o = dl_catn(ob, o, cand_hi)
428 o = dl_cat(ob, o, ",\"self_blocked\":" as *u8); o = dl_catn(ob, o, blk)
429 o = dl_cat(ob, o, ",\"strong_cites\":" as *u8); o = dl_catn(ob, o, st[4])
430 o = dl_cat(ob, o, ",\"RANK1_strong_and_clean\":" as *u8); o = dl_catn(ob, o, rank1)
431 o = dl_cat(ob, o, ",\"clean_candidates\":" as *u8); o = dl_catn(ob, o, cand - blk)
432 o = dl_cat(ob, o, ",\"listed\":" as *u8); o = dl_catn(ob, o, listed)
433 o = dl_cat(ob, o, ",\"unique_seq_tags\":" as *u8); o = dl_catn(ob, o, st[0])
434 o = dl_cat(ob, o, ",\"seq_occurrences\":" as *u8); o = dl_catn(ob, o, st[1])
435 o = dl_cat(ob, o, ",\"seq_out_of_range\":" as *u8); o = dl_catn(ob, o, st[2])
436 o = dl_cat(ob, o, ",\"files_scanned\":" as *u8); o = dl_catn(ob, o, st[3])
437 o = dl_cat(ob, o, ",\"plane_declared\":" as *u8); o = dl_catn(ob, o, dbf[0])
438 o = dl_cat(ob, o, ",\"plane_found\":" as *u8); o = dl_catn(ob, o, dbf[1])
439 var complete: i64 = 1
440 if dbf[1] < dbf[0] { complete = 0 }
441 o = dl_cat(ob, o, ",\"coverage_complete\":" as *u8); o = dl_catn(ob, o, complete)
442 if complete == 1 { o = dl_cat(ob, o, ",\"verdict\":\"COMPLETE\"" as *u8) }
443 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) }
444 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)
445 sys_write(1, ob, o)
446 sys_exit(0); return 0
447}