code wiki / _hdl_build / nx_forkcensus.nx
nx_forkcensus.nx
buildroot/runtime/_hdl_build/nx_forkcensus.nx
about
nx_forkcensus.nx -- WHICH FORKED BINARIES DO NOT EXIST? A census of every "<path>.elf" string
literal in a source tree, RESOLVED against the filesystem and classified by DURABILITY.
THE MEASURED PROBLEM (debt 1786073817). _timer_irq_gate forked "/tmp/nx_timer_irq_emit.sov.elf" --
the VOLATILE build-time twin -- while every other fork in the SAME FILE already used _offc/. /tmp is
cleared on idle, so the moment that happened the gate printed reason=emit-failed forever and indicted
the KERNEL for a missing temp file. The emitter was never broken: run directly it still wrote its
image (84 B, golden=BT). Repointing that ONE literal flipped the gate RED -> GREEN 2/2.
A grep then found 490 such literals over 255 files, 151 of them gates -- and nobody knew how many were
DEAD, because a grep can find the string but only the filesystem can say whether the target exists.
A GREP FINDS THE CLAIM; ONLY A STAT SETTLES IT.
Classes, in the order that matters for repair:
VOLATILE-MISSING under /tmp/, absent NOW -- dead, silently. THE ACTIONABLE SET.
DURABLE-MISSING under _offc/ or the root, absent -- dead, loudly (exit 127 = NOT-FOUND).
VOLATILE-PRESENT under /tmp/, present NOW -- ALIVE ONLY UNTIL THE NEXT /tmp SWEEP.
DURABLE-PRESENT durable path, present -- correct.
VOLATILE-PRESENT is not a pass. It is the same defect between cleanups, and reporting it as healthy
is how this class stayed invisible: every one of the 151 looked fine on the day it was written.
usage: nx_forkcensus [dir] [mode]
dir default buildroot/runtime/_hdl_build
mode dead (default, prints the two MISSING classes) | all | summary | repairable | subjects
exit 0 ALL-RESOLVABLE · 1 MISSING (a durable subject is absent from the CWD and from every deploy
root in knowledge/forkcensus_roots.conf, and not in knowledge/forkcensus_allow.conf) ·
3 UNPROVEN (unsound arithmetic / cap hit / nothing scanned)
`subjects` prints the deduped remedy worklist: ALLOWED | REPAIR-OFFC-INSTALL | PRESENT-OTHER-ROOT |
BUILD | PHANTOM | ALT-SPELLING -- the last line is always the verdict (positional anchor).
KNOWN IMPRECISION (stated, not hidden): a caller that probes SEVERAL candidate paths in order
registers every non-winning candidate as a dead literal; the subject then prints as
ALT-SPELLING (binary present) or PRESENT-OTHER-ROOT, never as clean. Read the caller.
SHIP-PROOF 2026-08-07: this line was added solely to prove /api/ship moves the LIVE artefact in one
call. staged==live proves nothing when the source is unchanged -- the binary must actually change.
license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: _lawsweep_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 37 | const FC_MAGIC_4096: i64 = 4096 |
| 38 | const FC_MAGIC_1048576: i64 = 1048576 |
| 40 | const FC_STDOUT: i64 = 1 |
| 41 | const FC_DIRBUF: i64 = 1048640 |
| 42 | const FC_PATHCAP: i64 = 1024 |
| 43 | const FC_MAXROWS: i64 = 400 |
| 44 | const FC_BACKSCAN: i64 = 512 |
| 47 | const FC_FILES: i64 = 0 |
| 48 | const FC_LITS: i64 = 1 |
| 49 | const FC_VOL: i64 = 2 |
| 50 | const FC_VOLMISS: i64 = 3 |
| 51 | const FC_OFFC: i64 = 4 |
| 52 | const FC_OFFCMISS: i64 = 5 |
| 53 | const FC_OTHER: i64 = 6 |
| 54 | const FC_OTHERMISS: i64 = 7 |
| 55 | const FC_ROWS: i64 = 8 |
| 56 | const FC_SUPPRESSED: i64 = 9 |
| 57 | const FC_COMMENTS: i64 = 10 |
| 58 | const FC_FRAG: i64 = 11 |
| 59 | const FC_BARE: i64 = 12 |
| 60 | const FC_REPAIR: i64 = 13 |
| 61 | const FC_NOREPAIR: i64 = 14 |
| 67 | const FC_VOLREPOINT: i64 = 15 |
| 68 | const FC_VOLNOREPOINT: i64 = 16 |
| 75 | const FC_NAMESET: i64 = 17 |
| 76 | const FC_NAMEN: i64 = 18 |
| 77 | const FC_NAMEOVER: i64 = 19 |
| 83 | const FC_NAMEBUILDABLE: i64 = 20 |
| 84 | const FC_NSLOTS: i64 = 22 |
| 85 | const FC_DISTINCT_MAX: i64 = 1024 |
| 86 | const FC_NAMEW: i64 = 96 |
| 134 | const FC_ROOTS: *u8 = "knowledge/forkcensus_roots.conf" |
| 168 | const FC_ALLOW: *u8 = "knowledge/forkcensus_allow.conf" |
| 479 | const FC_LOG: *u8 = "knowledge/status/forkcensus.log" |
| 480 | const FC_LOG_CAP: i64 = 1048576 // the procchurn.jrnl status-journal budget, reused not invented |
functions
| 88 | func fc_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(FC_STDOUT, s, n); return 0 } |
| 90 | func fc_n(v: i64) -> i64 |
| 104 | func fc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 106 | func fc_starts(s: *u8, pre: *u8) -> i64 |
| 117 | func fc_exists(p: *u8) -> i64 called by 5: ls_count_pathsfc_other_rootfc_src_existsfc_remedyfc_scan calls 2: sys_openat_rdsys_close |
| 135 | func fc_other_root(path: *u8, rb: *u8, rn: i64) -> i64 |
| 169 | func fc_allowed(name: *u8, ab: *u8, an: i64) -> i64 called by 1: main |
| 194 | func fc_in_comment(buf: *u8, q: i64) -> i64 |
| 222 | func fc_open_quote(buf: *u8, i: i64) -> i64 |
| 243 | func fc_classify(path: *u8) -> i64 |
| 278 | func fc_rootname(path: *u8, out: *u8) -> i64 called by 1: fc_scan |
| 295 | func fc_durablename(path: *u8, out: *u8) -> i64 called by 1: fc_scan |
| 331 | func fc_offcname(name: *u8, out: *u8) -> i64 |
| 341 | func fc_row(src: *u8, path: *u8, cls: i64, present: i64) -> i64 |
| 356 | func fc_streq(a: *u8, b: *u8) -> i64 called by 1: fc_addname |
| 366 | func fc_basename(path: *u8, out: *u8, cap: i64) -> i64 called by 1: fc_scan |
| 383 | func fc_src_exists(name: *u8) -> i64 |
| 413 | func fc_addname(ctr: *i64, nm: *u8) -> i64 |
| 447 | func fc_remedy(name: *u8, rb: *u8, rn: i64) -> i64 |
| 481 | func fc_num_at(b: *u8, off: i64, v: i64) -> i64 |
| 494 | func fc_receipt(dir: *u8, ctr: *i64, allowed: i64, inst: i64, other: i64, build: i64, phantom: i64, alt: i64) -> i64 |
| 529 | func fc_scan(src: *u8, buf: *u8, n: i64, ctr: *i64, mode: i64) -> i64 |
| 628 | func fc_is_nx(name: *u8, nl: i64) -> i64 |
| 636 | func main(argc: i64, argv: *i64) -> i64 |