nx_firstbyte.nx source
↩ module page · 548 lines · 27154 B
1// nx_firstbyte.nx -- FIRST-BYTE-UP ANALYSIS FOR /compare: what does a rung REST ON, where does its
2// chain stop being sound, and WHICH unsound link is the one you can actually act on?
3//
4// WHY THIS EXISTS (measured 2026-08-23). Five foundation defects were each found LATE, by a lane
5// trying to build the rung ABOVE them: nx_skeleton capped at 32 bones / 2048 verts against a corpus of
6// 104-370 joints and 14,164-423,919 verts; nx_gsplat pinned to a compile-time 512x384 while every
7// inner kernel was ALREADY viewport-agnostic; PF_NB=48 binning an oracle holding 4096 points/section;
8// the LANGUAGE having no vector types; and nothing able to bind a generated mesh to a generated
9// skeleton. In EVERY case /compare showed the rung OPEN and never showed WHAT IT RESTS ON.
10//
11// *** NOT A SECOND GRAPH. *** nx_eco_graph_build already walks and persists the import graph, and
12// eg_ancestors is "roots-to-god (transitive imports, down to leaves)" -- that IS the first-byte-up
13// chain, and it had never been pointed at a compare board. This organ derives NO edges: it is the JOIN
14// between <domain>.matrix rows and that closure, plus a per-link soundness query.
15//
16// *** THE CAP AXIS IS MEASURED. *** `nx_capcensus file <path>` answers per module IN ITS EXIT CODE --
17// 0 CLEAN / 1 CAPPED / 3 UNREADABLE -- so a foundation check BRANCHES WITHOUT PARSING. We compose that
18// verdict; we never re-implement its classifier. Because the answer is the exit code and not the text,
19// a truncated capture cannot change it. ABSTENTION IS INHERITED: the census refuses to report CLEAN
20// over a module it never read, so this organ refuses READY over a chain containing such a module.
21//
22// *** RANKING: "NEAREST" IS NOT "MOST ACTIONABLE". ***
23// v1 named the FIRST capped link found. With only 2.56% of estate bounds DERIVED, most chains carry
24// SEVERAL capped links -- so v1 reported `first_unsound=nx_syscalls.nx` on rungs whose real problem was
25// elsewhere: true, and completely non-actionable. A CAP IN A LEAF EVERYONE SHARES IS A DIFFERENT
26// FINDING FROM A CAP IN YOUR OWN MODULE, AND REPORTING THE FIRST HIDES THE SECOND. Every capped link
27// is now reported, classified and ranked:
28// OWN the rung's own source -- the lane that owns this rung owns the fix. Ranked first.
29// RARE few dependents -- a targeted fix. Ranked by ASCENDING fan-in, rarest first.
30// UBIQUITOUS appears in EVERY resolved chain on this board -- an estate-wide concern, never a
31// rung's blocker. Ranked last so it can never mask an actionable link again.
32// BOTH CLASS BOUNDARIES ARE DERIVED, NOT PICKED. "Ubiquitous" is defined by the board itself (present
33// in all N resolved chains, N counted this run), and "rare" is ordered by the graph's own fan-in via
34// eg_ca -- the closure is already computed, so the dependent count is free. There is no threshold
35// constant anywhere in this classification, because a picked one would be the seventh phony cap.
36// A rung with ONE capped link in its own module and a rung with NINE scattered through shared leaves
37// are different situations, and the per-rung own/rare/ubiq counts now say which is which.
38//
39// KNOWN ERROR TERM ON EVERY CAPPED VERDICT, disclosed by the census itself: it flagged CE_C_SHOWMAX=12
40// -- a COUNTER INDEX, not a capacity bound -- because the name contains "MAX".
41// *** A CAP BOUNDS A SUBJECT; AN INDEX DOES NOT. *** So a CAPPED verdict may be an index wearing a
42// cap-shaped name until the census's subject resolver lands. Printed with every run so 27 CAPPED rows
43// are never read as 27 certainties.
44//
45// BUCKETS (mutually exclusive, first match wins; the partition MUST sum and the sum is printed):
46// PLACEHOLDER the rung's own symbol is _ABSENT_ -- a declared gap, not a built thing
47// ABSENT the rung names a source the import graph has never seen
48// EMPTY-CHAIN resolves, but imports NOTHING transitively -- a DIFFERENT question, see below
49// NOT-READY-CAPPED a link carries a PICKED bound; the ranked list says which one you can act on
50// UNOBSERVABLE a link could not be read, so soundness cannot be claimed either way
51// READY every link, and the source itself, answered CLEAN
52// UNKNOWN could not classify. Reported, NEVER folded into a known bucket.
53//
54// *** A SECOND, DIFFERENT INSTRUMENT: UNDECLARED-DEPENDENCY DETECTION. *** EMPTY-CHAIN is not a weaker
55// form of unsound. A real capability rests on SOMETHING, so a source that resolves yet imports nothing
56// transitively is suspicious -- a stub, a leaf wrongly named as a capability, or the wrong file in
57// field 2. Its gate tooth asserts the bucket EXISTS EVEN AT ZERO, because a measurement of zero that
58// stops being taken is indistinguishable from one never taken.
59//
60// *** NEXT RUNG, NAMED AND STILL NOT BUILT: DATA DEPENDENCIES. *** AN IMPORT GRAPH CANNOT SEE A DATA
61// DEPENDENCY -- proven by D3: PF_NB=48 capped a DATA prior read at runtime, so nx_profile_fit appears
62// in NO chain. Derive those from sys_read_file / sys_open literal paths and knowledge/ references, in
63// their OWN bucket. The organ keeps DECLARING this blind spot so it cannot imply coverage it lacks.
64//
65// NO PHONY CAP, BY CONSTRUCTION: the ancestors buffer and the eg_ancestors cap are both g.node_count,
66// and a transitive closure is a SUBSET of the node set. eg_ancestors silently stops recording once outn
67// hits cap, so a picked value there would have been a silent-truncation defect INSIDE the instrument
68// built to find silent truncation. The per-module cache is sized from node_count: one census fork per
69// DISTINCT module, never per chain occurrence.
70//
71// usage: nx_firstbyte chain <domain> [store-prefix]
72// exit 0 every rung READY | 1 a rung is NOT-READY or UNOBSERVABLE | 2 usage | 3 graph | 4 matrix
73// license_tier: ORIGINAL Read-only over the estate. No hw writes (Rule 26).
74import "nx_syscalls.nx"
75import "nx_eco_graph.nx"
76import "nx_gatekit_lib.nx"
77
78const FB_STORE: *u8 = "knowledge/store/ecograph_full" as *u8
79const FB_MATPFX: *u8 = "buildroot/knowledge/compare/" as *u8
80const FB_MATSFX: *u8 = ".matrix" as *u8
81const FB_CENSUS: *u8 = "./nx_capcensus.elf" as *u8
82const FB_RTPFX: *u8 = "buildroot/runtime/" as *u8
83const FB_HDLPFX: *u8 = "buildroot/runtime/_hdl_build/" as *u8
84const FB_PATHW: i64 = 4096
85const FB_NAMEW: i64 = 256
86// PROTECTIVE and inert: we branch on the census EXIT CODE, never on this text, so truncation here
87// cannot change a verdict. The buffer exists only so the child has somewhere to write.
88const FB_CAPBUF: i64 = 65536
89
90const FB_EXIT_NOTREADY: i64 = 1
91const FB_EXIT_USAGE: i64 = 2
92const FB_EXIT_NOGRAPH: i64 = 3
93const FB_EXIT_NOMATRIX: i64 = 4
94
95const FB_READY: i64 = 0
96const FB_PLACEHOLDER: i64 = 1
97const FB_ABSENT: i64 = 2
98const FB_UNKNOWN: i64 = 3
99const FB_EMPTY: i64 = 4
100const FB_CAPPED: i64 = 5
101const FB_UNOBS: i64 = 6
102
103const FB_Q_CLEAN: i64 = 1
104const FB_Q_CAPPED: i64 = 2
105const FB_Q_UNREAD: i64 = 3
106
107// actionability classes -- ranked in this order, and both boundaries are DERIVED (see header)
108const FB_K_OWN: i64 = 0
109const FB_K_RARE: i64 = 1
110const FB_K_UBIQ: i64 = 2
111
112static fb_path: *u8
113static fb_name: *u8
114static fb_cbuf: *u8
115static fb_state: *u8
116static fb_inchain: *i64
117static fb_forks: i64
118
119// The actionability class of a capped link. BOTH BOUNDARIES ARE DERIVED, NEVER PICKED: OWN is identity
120// with the rung's own source (the lane that owns the rung owns the fix), and UBIQUITOUS is "present in
121// EVERY resolved chain on this board" -- a property of the population actually being reported on, not a
122// fan-in threshold somebody chose. Everything else is RARE and is ordered by the graph's own dependent
123// count, which the closure already computed, so the ordering costs nothing.
124// *** A CAP IN A LEAF EVERYONE SHARES IS A DIFFERENT FINDING FROM A CAP IN YOUR OWN MODULE. ***
125func fb_rank_class(node: i64, own: i64, nres: i64) -> i64 {
126 if node == own { return FB_K_OWN }
127 if nres > 0 { if fb_inchain[node] >= nres { return FB_K_UBIQ } }
128 return FB_K_RARE
129}
130
131func fb_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
132func fb_span(b: *u8, s: i64, e: i64) -> i64 { if e > s { sys_write(1, ((b as i64) + s) as *u8, e - s) } return 0 }
133
134func fb_wn(v: i64) -> i64 {
135 var d: *u8 = sys_mmap(32)
136 var x: i64 = v
137 var neg: i64 = 0
138 if x < 0 { neg = 1; x = 0 - x }
139 var i: i64 = 31
140 if x == 0 { d[i] = 48 as u8; i = i - 1 }
141 while x > 0 { d[i] = ((x % 10) + 48) as u8; x = x / 10; i = i - 1 }
142 if neg == 1 { d[i] = 45 as u8; i = i - 1 }
143 sys_write(1, ((d as i64) + i + 1) as *u8, 31 - i)
144 return 0
145}
146
147func fb_join(dst: *u8, pfx: *u8, base: *u8) -> i64 {
148 var p: i64 = 0
149 var i: i64 = 0
150 while pfx[i] != (0 as u8) { dst[p] = pfx[i]; p = p + 1; i = i + 1 }
151 i = 0
152 while base[i] != (0 as u8) { if p < FB_PATHW - 1 { dst[p] = base[i]; p = p + 1 } i = i + 1 }
153 dst[p] = 0 as u8
154 return p
155}
156
157func fb_matpath(dom: *u8) -> i64 {
158 var p: i64 = fb_join(fb_path, FB_MATPFX, dom)
159 var i: i64 = 0
160 while FB_MATSFX[i] != (0 as u8) { if p < FB_PATHW - 1 { fb_path[p] = FB_MATSFX[i]; p = p + 1 } i = i + 1 }
161 fb_path[p] = 0 as u8
162 return p
163}
164
165// Ask the estate's own picked-cap ruler about ONE module; the answer is its EXIT CODE.
166// A module lives under runtime/ or runtime/_hdl_build/, so an UNREADABLE first answer is retried at
167// the second root before it is believed -- an unresolved path must not masquerade as an unread module.
168func fb_cap_query(base: *u8) -> i64 {
169 var blen: i64 = 0
170 fb_join(fb_path, FB_RTPFX, base)
171 fb_forks = fb_forks + 1
172 var rc: i64 = gk_run_capture(FB_CENSUS, "file" as *u8, fb_path, 0 as *u8, 0 as *u8, fb_cbuf, FB_CAPBUF, &blen)
173 if rc == 3 {
174 fb_join(fb_path, FB_HDLPFX, base)
175 fb_forks = fb_forks + 1
176 blen = 0
177 rc = gk_run_capture(FB_CENSUS, "file" as *u8, fb_path, 0 as *u8, 0 as *u8, fb_cbuf, FB_CAPBUF, &blen)
178 }
179 if rc == 0 { return FB_Q_CLEAN }
180 if rc == 1 { return FB_Q_CAPPED }
181 return FB_Q_UNREAD
182}
183
184func fb_state_of(g: *EcoGraph, node: i64) -> i64 {
185 let cur: i64 = fb_state[node] as i64
186 if cur != 0 { return cur }
187 let nm: *u8 = ((g.arena as i64) + g.node_off[node]) as *u8
188 let st: i64 = fb_cap_query(nm)
189 fb_state[node] = st as u8
190 return st
191}
192
193func fb_field(b: *u8, ls: i64, le: i64, idx: i64, fe: *i64) -> i64 {
194 var cur: i64 = 0
195 var s: i64 = ls
196 var j: i64 = ls
197 while j <= le {
198 var atend: i64 = 0
199 if j == le { atend = 1 } else { if b[j] == (124 as u8) { atend = 1 } }
200 if atend == 1 {
201 if cur == idx { fe[0] = j; return s }
202 cur = cur + 1
203 s = j + 1
204 }
205 j = j + 1
206 }
207 fe[0] = 0 - 1
208 return 0 - 1
209}
210
211func fb_basename(b: *u8, s: i64, e: i64) -> i64 {
212 var st: i64 = s
213 var j: i64 = s
214 while j < e { if b[j] == (47 as u8) { st = j + 1 } j = j + 1 }
215 var n: i64 = 0
216 var k: i64 = st
217 while k < e { if n < FB_NAMEW - 1 { fb_name[n] = b[k]; n = n + 1 } k = k + 1 }
218 fb_name[n] = 0 as u8
219 return n
220}
221
222func fb_is_absent_sym(b: *u8, s: i64, e: i64) -> i64 {
223 let pat: *u8 = "_ABSENT_" as *u8
224 var i: i64 = 0
225 while pat[i] != (0 as u8) {
226 if s + i >= e { return 0 }
227 if b[s + i] != pat[i] { return 0 }
228 i = i + 1
229 }
230 return 1
231}
232
233func main(argc: i64, argv: *i64) -> i64 {
234 if argc < 3 {
235 fb_w("usage: nx_firstbyte chain <domain> [store-prefix]\n" as *u8)
236 return FB_EXIT_USAGE
237 }
238 let verb: *u8 = argv[1] as *u8
239 let dom: *u8 = argv[2] as *u8
240 var store: *u8 = FB_STORE
241 if argc > 3 { store = argv[3] as *u8 }
242
243 fb_path = sys_mmap(FB_PATHW)
244 fb_name = sys_mmap(FB_NAMEW)
245 fb_cbuf = sys_mmap(FB_CAPBUF)
246 fb_forks = 0
247
248 fb_w("NX-FIRSTBYTE domain=" as *u8); fb_w(dom); fb_w(" verb=" as *u8); fb_w(verb); fb_w("\n" as *u8)
249
250 let g: *EcoGraph = eg_load(store)
251 if (g as i64) == 0 {
252 fb_w(" graph UNOBSERVABLE store=" as *u8); fb_w(store)
253 fb_w(" -- refusing to report chains from a graph that did not load\n" as *u8)
254 return FB_EXIT_NOGRAPH
255 }
256 // NO eg_finalize HERE. eg_load returns a graph with finalized=1 ALREADY SET but with edge_src /
257 // edge_dst left NULL. Calling eg_finalize on a loaded graph walks two null pointers and SIGSEGVs --
258 // measured 2026-08-23, signal 11. A struct whose FLAG claims a state its FIELDS do not hold will
259 // crash the next consumer who trusts the flag; named here so the next one does not.
260 let nnodes: i64 = g.node_count
261 fb_w(" graph nodes=" as *u8); fb_wn(nnodes)
262 fb_w(" edges=" as *u8); fb_wn(g.edge_count); fb_w("\n" as *u8)
263
264 fb_matpath(dom)
265 var mlen: i64 = 0
266 let mb: *u8 = sys_read_file(fb_path, &mlen)
267 if (mb as i64) == 0 {
268 fb_w(" matrix UNREADABLE path=" as *u8); fb_w(fb_path); fb_w("\n" as *u8)
269 return FB_EXIT_NOMATRIX
270 }
271 fb_w(" matrix bytes=" as *u8); fb_wn(mlen); fb_w("\n" as *u8)
272
273 let vis: *u8 = sys_mmap(nnodes + 1)
274 let outv: *i64 = sys_mmap((nnodes + 1) * 8) as *i64
275 let capv: *i64 = sys_mmap((nnodes + 1) * 8) as *i64
276 let capk: *i64 = sys_mmap((nnodes + 1) * 8) as *i64
277 fb_state = sys_mmap(nnodes + 1)
278 fb_inchain = sys_mmap((nnodes + 1) * 8) as *i64
279 var zz: i64 = 0
280 while zz <= nnodes { fb_state[zz] = 0 as u8; fb_inchain[zz] = 0; zz = zz + 1 }
281 var outn: i64 = 0
282
283 // ---- PASS 1: count, per module, HOW MANY resolved chains on this board contain it. That count is
284 // what makes "ubiquitous" a DERIVED property of this board rather than a picked threshold.
285 var nres: i64 = 0
286 var ls: i64 = 0
287 var i: i64 = 0
288 while i <= mlen {
289 var eol: i64 = 0
290 if i == mlen { eol = 1 } else { if mb[i] == (10 as u8) { eol = 1 } }
291 if eol == 1 {
292 var skip: i64 = 0
293 if i <= ls { skip = 1 }
294 else {
295 if mb[ls] == (35 as u8) { skip = 1 }
296 if mb[ls] == (64 as u8) { skip = 1 }
297 }
298 if skip == 0 {
299 var fe: i64 = 0
300 let f1s: i64 = fb_field(mb, ls, i, 1, &fe)
301 let f1e: i64 = fe
302 var fe2: i64 = 0
303 let f2s: i64 = fb_field(mb, ls, i, 2, &fe2)
304 let f2e: i64 = fe2
305 if f1s >= 0 {
306 if f2s >= 0 {
307 if fb_is_absent_sym(mb, f2s, f2e) == 0 {
308 let bn: i64 = fb_basename(mb, f1s, f1e)
309 let idx: i64 = eg_find(g, fb_name, bn)
310 if idx >= 0 {
311 var z: i64 = 0
312 while z <= nnodes { vis[z] = 0 as u8; z = z + 1 }
313 outn = 0
314 eg_ancestors(g, idx, vis, outv, &outn, nnodes)
315 if outn > 0 {
316 nres = nres + 1
317 var q: i64 = 0
318 while q < outn { fb_inchain[outv[q]] = fb_inchain[outv[q]] + 1; q = q + 1 }
319 }
320 }
321 }
322 }
323 }
324 }
325 ls = i + 1
326 }
327 i = i + 1
328 }
329 fb_w(" resolved_chains=" as *u8); fb_wn(nres)
330 fb_w(" ubiquitous-means-present-in-ALL-of-them (DERIVED from this board, never a threshold)\n" as *u8)
331
332 var rows: i64 = 0
333 var n_ready: i64 = 0
334 var n_place: i64 = 0
335 var n_abs: i64 = 0
336 var n_unk: i64 = 0
337 var n_empty: i64 = 0
338 var n_capped: i64 = 0
339 var n_unobs: i64 = 0
340 var chain_total: i64 = 0
341 var deepest: i64 = 0
342 var tot_own: i64 = 0
343 var tot_rare: i64 = 0
344 var tot_ubiq: i64 = 0
345
346 // ---- PASS 2: classify, rank and report.
347 ls = 0
348 i = 0
349 while i <= mlen {
350 var eol2: i64 = 0
351 if i == mlen { eol2 = 1 } else { if mb[i] == (10 as u8) { eol2 = 1 } }
352 if eol2 == 1 {
353 var skip2: i64 = 0
354 if i <= ls { skip2 = 1 }
355 else {
356 if mb[ls] == (35 as u8) { skip2 = 1 }
357 if mb[ls] == (64 as u8) { skip2 = 1 }
358 }
359 if skip2 == 0 {
360 var fe: i64 = 0
361 let f1s: i64 = fb_field(mb, ls, i, 1, &fe)
362 let f1e: i64 = fe
363 var fe2: i64 = 0
364 let f2s: i64 = fb_field(mb, ls, i, 2, &fe2)
365 let f2e: i64 = fe2
366 if f1s >= 0 {
367 if f2s >= 0 {
368 rows = rows + 1
369 var fe0: i64 = 0
370 let f0s: i64 = fb_field(mb, ls, i, 0, &fe0)
371 fb_w("rung|" as *u8)
372 fb_span(mb, f0s, fe0)
373 fb_w("|src=" as *u8)
374 let bn: i64 = fb_basename(mb, f1s, f1e)
375 fb_w(fb_name)
376 var cls: i64 = FB_READY
377 var clen: i64 = 0
378 var ncap: i64 = 0
379 var c_own: i64 = 0
380 var c_rare: i64 = 0
381 var c_ubiq: i64 = 0
382 var unreadnode: i64 = 0 - 1
383 if fb_is_absent_sym(mb, f2s, f2e) == 1 { cls = FB_PLACEHOLDER }
384 else {
385 let idx: i64 = eg_find(g, fb_name, bn)
386 if idx < 0 { cls = FB_ABSENT }
387 else {
388 var z: i64 = 0
389 while z <= nnodes { vis[z] = 0 as u8; z = z + 1 }
390 outn = 0
391 eg_ancestors(g, idx, vis, outv, &outn, nnodes)
392 clen = outn
393 fb_w("|rests_on=" as *u8)
394 var q: i64 = 0
395 while q < clen {
396 if q > 0 { fb_w("," as *u8) }
397 fb_w(((g.arena as i64) + g.node_off[outv[q]]) as *u8)
398 q = q + 1
399 }
400 chain_total = chain_total + clen
401 if clen > deepest { deepest = clen }
402 if clen == 0 { cls = FB_EMPTY }
403 else {
404 // THE SOURCE ITSELF IS PART OF ITS OWN FOUNDATION. D2 (nx_gsplat
405 // pinned to 512x384) is a rung's OWN module, so checking only the
406 // ancestors would have missed it entirely.
407 let s0: i64 = fb_state_of(g, idx)
408 if s0 == FB_Q_CAPPED { capv[ncap] = idx; capk[ncap] = fb_rank_class(idx, idx, nres); ncap = ncap + 1; c_own = c_own + 1 }
409 if s0 == FB_Q_UNREAD { unreadnode = idx }
410 var w: i64 = 0
411 while w < clen {
412 let d: i64 = outv[w]
413 let sd: i64 = fb_state_of(g, d)
414 if sd == FB_Q_CAPPED {
415 let kind: i64 = fb_rank_class(d, idx, nres)
416 capv[ncap] = d
417 capk[ncap] = kind
418 ncap = ncap + 1
419 if kind == FB_K_UBIQ { c_ubiq = c_ubiq + 1 } else { c_rare = c_rare + 1 }
420 }
421 if sd == FB_Q_UNREAD { if unreadnode < 0 { unreadnode = d } }
422 w = w + 1
423 }
424 if ncap > 0 { cls = FB_CAPPED }
425 else { if unreadnode >= 0 { cls = FB_UNOBS } }
426 }
427 }
428 }
429 fb_w("|chain=" as *u8); fb_wn(clen)
430 if cls == FB_PLACEHOLDER {
431 n_place = n_place + 1
432 fb_w("|link=PLACEHOLDER|first_unsound=SELF|reason=symbol-is-_ABSENT_-a-declared-gap|cap=NOT-APPLICABLE|state=NOT-READY" as *u8)
433 }
434 if cls == FB_ABSENT {
435 n_abs = n_abs + 1
436 fb_w("|link=ABSENT|first_unsound=" as *u8); fb_w(fb_name)
437 fb_w("|reason=source-not-in-the-import-graph|cap=NOT-APPLICABLE|state=NOT-READY" as *u8)
438 }
439 if cls == FB_EMPTY {
440 n_empty = n_empty + 1
441 fb_w("|link=EMPTY-CHAIN|first_unsound=SELF" as *u8)
442 fb_w("|reason=resolves-but-imports-NOTHING-transitively-undeclared-dependency-suspect|cap=NOT-APPLICABLE|state=NOT-READY" as *u8)
443 }
444 if cls == FB_CAPPED {
445 n_capped = n_capped + 1
446 tot_own = tot_own + c_own
447 tot_rare = tot_rare + c_rare
448 tot_ubiq = tot_ubiq + c_ubiq
449 // RANK: class first (own, then rare, then ubiquitous), and within a class by
450 // ASCENDING fan-in from the graph itself -- the rarest, most targeted fix
451 // first. Selection sort; the list is at most one chain long.
452 var a: i64 = 0
453 while a < ncap {
454 var best: i64 = a
455 var b2: i64 = a + 1
456 while b2 < ncap {
457 var better: i64 = 0
458 if capk[b2] < capk[best] { better = 1 }
459 else {
460 if capk[b2] == capk[best] {
461 if eg_ca(g, capv[b2]) < eg_ca(g, capv[best]) { better = 1 }
462 }
463 }
464 if better == 1 { best = b2 }
465 b2 = b2 + 1
466 }
467 if best != a {
468 let tv: i64 = capv[a]; capv[a] = capv[best]; capv[best] = tv
469 let tk: i64 = capk[a]; capk[a] = capk[best]; capk[best] = tk
470 }
471 a = a + 1
472 }
473 fb_w("|link=CAPPED|first_unsound=" as *u8)
474 fb_w(((g.arena as i64) + g.node_off[capv[0]]) as *u8)
475 fb_w("|reason=this-link-carries-a-PICKED-capacity-bound|cap=CAPPED|state=NOT-READY" as *u8)
476 fb_w("|capped_links=" as *u8); fb_wn(ncap)
477 fb_w("|own=" as *u8); fb_wn(c_own)
478 fb_w("|rare=" as *u8); fb_wn(c_rare)
479 fb_w("|ubiq=" as *u8); fb_wn(c_ubiq)
480 fb_w("|ranked=" as *u8)
481 var r: i64 = 0
482 while r < ncap {
483 if r > 0 { fb_w("," as *u8) }
484 fb_w(((g.arena as i64) + g.node_off[capv[r]]) as *u8)
485 if capk[r] == FB_K_OWN { fb_w("(OWN" as *u8) }
486 if capk[r] == FB_K_RARE { fb_w("(RARE" as *u8) }
487 if capk[r] == FB_K_UBIQ { fb_w("(UBIQ" as *u8) }
488 fb_w(":fanin=" as *u8); fb_wn(eg_ca(g, capv[r]))
489 fb_w(")" as *u8)
490 r = r + 1
491 }
492 }
493 if cls == FB_UNOBS {
494 n_unobs = n_unobs + 1
495 fb_w("|link=UNREADABLE|first_unsound=" as *u8)
496 fb_w(((g.arena as i64) + g.node_off[unreadnode]) as *u8)
497 fb_w("|reason=census-could-not-read-this-link-so-soundness-is-UNKNOWN|cap=UNOBSERVABLE|state=UNOBSERVABLE" as *u8)
498 }
499 if cls == FB_READY {
500 n_ready = n_ready + 1
501 fb_w("|link=CHAIN-RESOLVED|first_unsound=NONE|cap=CLEAN|state=READY" as *u8)
502 }
503 fb_w("\n" as *u8)
504 }
505 }
506 }
507 ls = i + 1
508 }
509 i = i + 1
510 }
511
512 let part: i64 = n_ready + n_capped + n_unobs + n_place + n_abs + n_empty + n_unk
513 fb_w("\nNX-FIRSTBYTE summary domain=" as *u8); fb_w(dom); fb_w("\n" as *u8)
514 fb_w(" rows=" as *u8); fb_wn(rows)
515 fb_w(" ready=" as *u8); fb_wn(n_ready)
516 fb_w(" capped=" as *u8); fb_wn(n_capped)
517 fb_w(" unobservable=" as *u8); fb_wn(n_unobs)
518 fb_w(" placeholder=" as *u8); fb_wn(n_place)
519 fb_w(" absent=" as *u8); fb_wn(n_abs)
520 fb_w(" empty_chain=" as *u8); fb_wn(n_empty)
521 fb_w(" unknown=" as *u8); fb_wn(n_unk); fb_w("\n" as *u8)
522 fb_w(" partition_sum=" as *u8); fb_wn(part)
523 fb_w(" population=" as *u8); fb_wn(rows)
524 fb_w(" SUMS=" as *u8)
525 if part == rows { fb_wn(1) } else { fb_wn(0) }
526 fb_w("\n" as *u8)
527 fb_w(" capped_links_own=" as *u8); fb_wn(tot_own)
528 fb_w(" capped_links_rare=" as *u8); fb_wn(tot_rare)
529 fb_w(" capped_links_ubiquitous=" as *u8); fb_wn(tot_ubiq)
530 fb_w(" OWN-is-the-actionable-class-UBIQ-is-an-estate-concern-never-a-rungs-blocker\n" as *u8)
531 fb_w(" chain_links_total=" as *u8); fb_wn(chain_total)
532 fb_w(" deepest_chain=" as *u8); fb_wn(deepest)
533 fb_w(" census_forks=" as *u8); fb_wn(fb_forks)
534 fb_w(" one-per-DISTINCT-module-cached-across-rows\n" as *u8)
535 fb_w(" ancestors_cap=" as *u8); fb_wn(nnodes)
536 fb_w(" DERIVED-from-node-count-a-closure-is-a-subset-so-it-cannot-truncate\n" as *u8)
537 fb_w(" capped_axis=MEASURED via-nx_capcensus-file-EXIT-CODE-0-clean-1-capped-3-unreadable\n" as *u8)
538 fb_w(" capped_error_term=an-INDEX-wearing-a-cap-shaped-name-can-read-CAPPED-until-the\n" as *u8)
539 fb_w(" census-subject-resolver-lands (A CAP BOUNDS A SUBJECT; AN INDEX DOES NOT)\n" as *u8)
540 fb_w(" data_edges=NOT-DERIVED an-import-graph-cannot-see-a-DATA-dependency-next-rung\n" as *u8)
541 var rc: i64 = 0
542 if n_abs > 0 { rc = FB_EXIT_NOTREADY }
543 if n_place > 0 { rc = FB_EXIT_NOTREADY }
544 if n_empty > 0 { rc = FB_EXIT_NOTREADY }
545 if n_capped > 0 { rc = FB_EXIT_NOTREADY }
546 if n_unobs > 0 { rc = FB_EXIT_NOTREADY }
547 return rc
548}