code wiki / _hdl_build / nx_forkcensus.nx

nx_forkcensus.nx

buildroot/runtime/_hdl_build/nx_forkcensus.nx

47773 B896 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_forkcensus.nx _lawsweep_gate.nx

imports: nx_syscalls.nx

imported by: _lawsweep_gate.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main fc_starts fc_p sys_write sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_openat_rd sys_exit ↻ fc_slen sys_getdents64 dirent_reclen dirent_name fc_is_nx sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close fc_scan sys_mmap ↻ fc_open_quote fc_in_comment fc_classify fc_starts ↻ fc_exists

structs

none

consts

37const FC_MAGIC_4096: i64 = 4096
38const FC_MAGIC_1048576: i64 = 1048576
40const FC_STDOUT: i64 = 1
41const FC_DIRBUF: i64 = 1048640
42const FC_PATHCAP: i64 = 1024
43const FC_MAXROWS: i64 = 400
44const FC_BACKSCAN: i64 = 512
47const FC_FILES: i64 = 0
48const FC_LITS: i64 = 1
49const FC_VOL: i64 = 2
50const FC_VOLMISS: i64 = 3
51const FC_OFFC: i64 = 4
52const FC_OFFCMISS: i64 = 5
53const FC_OTHER: i64 = 6
54const FC_OTHERMISS: i64 = 7
55const FC_ROWS: i64 = 8
56const FC_SUPPRESSED: i64 = 9
57const FC_COMMENTS: i64 = 10
58const FC_FRAG: i64 = 11
59const FC_BARE: i64 = 12
60const FC_REPAIR: i64 = 13
61const FC_NOREPAIR: i64 = 14
67const FC_VOLREPOINT: i64 = 15
68const FC_VOLNOREPOINT: i64 = 16
75const FC_NAMESET: i64 = 17
76const FC_NAMEN: i64 = 18
77const FC_NAMEOVER: i64 = 19
83const FC_NAMEBUILDABLE: i64 = 20
84const FC_NSLOTS: i64 = 22
85const FC_DISTINCT_MAX: i64 = 1024
86const FC_NAMEW: i64 = 96
134const FC_ROOTS: *u8 = "knowledge/forkcensus_roots.conf"
168const FC_ALLOW: *u8 = "knowledge/forkcensus_allow.conf"
479const FC_LOG: *u8 = "knowledge/status/forkcensus.log"
480const FC_LOG_CAP: i64 = 1048576 // the procchurn.jrnl status-journal budget, reused not invented

functions

88func 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 }
called by 3: fc_rowfc_receiptmain calls 1: sys_write
90func fc_n(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
104func fc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
106func fc_starts(s: *u8, pre: *u8) -> i64
117func fc_exists(p: *u8) -> i64
135func fc_other_root(path: *u8, rb: *u8, rn: i64) -> i64
169func fc_allowed(name: *u8, ab: *u8, an: i64) -> i64
called by 1: main
194func fc_in_comment(buf: *u8, q: i64) -> i64
222func fc_open_quote(buf: *u8, i: i64) -> i64
243func fc_classify(path: *u8) -> i64
called by 1: fc_scan calls 1: fc_starts
278func fc_rootname(path: *u8, out: *u8) -> i64
called by 1: fc_scan
295func fc_durablename(path: *u8, out: *u8) -> i64
called by 1: fc_scan
331func fc_offcname(name: *u8, out: *u8) -> i64
called by 2: fc_remedyfc_scan
341func fc_row(src: *u8, path: *u8, cls: i64, present: i64) -> i64
called by 1: fc_scan calls 1: fc_p
356func fc_streq(a: *u8, b: *u8) -> i64
called by 1: fc_addname
366func fc_basename(path: *u8, out: *u8, cap: i64) -> i64
called by 1: fc_scan
383func fc_src_exists(name: *u8) -> i64
413func fc_addname(ctr: *i64, nm: *u8) -> i64
called by 1: fc_scan calls 2: fc_streqfc_src_exists
447func fc_remedy(name: *u8, rb: *u8, rn: i64) -> i64
481func fc_num_at(b: *u8, off: i64, v: i64) -> i64
called by 1: fc_receipt calls 2: sys_mmapsys_munmap
494func fc_receipt(dir: *u8, ctr: *i64, allowed: i64, inst: i64, other: i64, build: i64, phantom: i64, alt: i64) -> i64
529func fc_scan(src: *u8, buf: *u8, n: i64, ctr: *i64, mode: i64) -> i64
628func fc_is_nx(name: *u8, nl: i64) -> i64
called by 2: ls_walkmain
636func main(argc: i64, argv: *i64) -> i64