code wiki / (root) / nx_capcensus.nx

nx_capcensus.nx

buildroot/runtime/nx_capcensus.nx

42319 B871 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_capcensus.nx -- THE PICKED-CAP CENSUS: is a capacity bound DERIVED, or PICKED by an author? WHY THIS EXISTS, AND WHY IT IS NOT A DUPLICATE (measured 2026-08-23). The same defect class was found FOUR times in ONE session: nx_skeleton.nx SK_MAXB=32 bones / SK_MAXV=2048 verts against a corpus of 104-370 joints and 14,164-423,919 verts -- an 11.6x bone / 207x vertex overflow that made EVERY real character un-riggable, so the served worlds drew bind pose. nx_nxa_skin cluster cap 512 -> 8192, and the CAP IMPERSONATED A COUNT TWICE (clusters=510, then =2046): a saturated buffer read back as if it were a measurement. MG_CAP a SILENT input cap in the mesh path -- an oversized asset reads truncated with no announcement. nx_cron_reconcile one sys_read of 16,383 B against a 24,356 B registry: 11 production jobs silently inert, and it printed declared=55 as if that were the population. ***NAMING A MAGIC NUMBER DOES NOT MAKE IT DERIVED.*** nx_magic is the rule-11 fixer: it hoists an INLINE literal into a NAMED const, and it SKIPS const/static declaration lines BY CONSTRUCTION (its own header says so). So `const SK_MAXB: i64 = 32` is structurally invisible to it and every magic-number detector calls the file clean. Worse, its remedy MANUFACTURES this artifact: the auto-generated K_MAGIC_<value> / <PFX>_MAGIC_<value> names found in the wild (K_MAGIC_262144, K_MAGIC_65536, DC_MAGIC_131072) are picked caps wearing a constant's clothes -- THE NAME ENCODES THE VALUE, so it carries no purpose at all. That is not a defect in nx_magic (its neutrality is provable and its purpose is different); it is exactly why a SECOND, ORTHOGONAL instrument is needed. nx_magic asks "is this literal inline?". This organ asks "is this bound DERIVED or PICKED?". nx_capcliff is NOT the incumbent either: it forecasts RUNTIME growth of rostered append-only ledgers against a known reader cap. This is a STATIC census of bounds declared in source. nx_capcensus scan <dir> -> recursive classified census over every .nx under <dir> nx_capcensus selftest CLASSES (the partition MUST sum to the population, and the sum is printed): DERIVED value computed from an input size / another identifier / an expression. Healthy. PICKED a literal ceiling on data whose real size is knowable at runtime. THE WORKLIST. STRUCTURAL fixed by an external contract (syscall number, mode bits, seek whence, exit code). PROTECTIVE a bound NAMED for bounding unknowable input. See the declared limit below. UNKNOWN could not classify. Reported, NEVER folded into a known bucket. DECLARED LIMIT, so nobody reads this census as more than it is: PROTECTIVE IS UNDER-DETECTED BY CONSTRUCTION. Proving that a bound's truncation ANNOUNCES requires call-site analysis this organ does not perform; it recognises only bounds NAMED for that purpose (WINDOW/WIN/BUDGET/DEADLINE/

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_capcensus.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main ce_w sys_write sys_exit 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 ↻ ce_atoi_span ce_isdig ce_slen ce_streq sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ce_scan_file ce_scan_line ce_autohoist ce_has ce_slen ↻ ce_capshaped ce_has ↻ ce_all_digits ce_isdig ↻ ce_structural

structs

none

consts

58const CE_DIRWIN: i64 = 262144
59const CE_PATHW: i64 = 4096
61const CE_QSEED: i64 = 64
63const CE_SKIP: i64 = 0
64const CE_DERIVED: i64 = 1
65const CE_PICKED: i64 = 2
66const CE_STRUCTURAL: i64 = 3
67const CE_PROTECTIVE: i64 = 4
68const CE_UNKNOWN: i64 = 5
70const CE_DT_DIR: i64 = 4
71const CE_EXIT_USAGE: i64 = 2
72const CE_EXIT_SELFTEST: i64 = 3
73const CE_EXIT_PICKED: i64 = 1
76const CE_EXIT_UNREADABLE: i64 = 3
77const CE_WORKLIST_SHOWN: i64 = 60
78const CE_POW2_FLOOR: i64 = 4096
80const CE_C_SEEN: i64 = 0
81const CE_C_POP: i64 = 1
82const CE_C_DER: i64 = 2
83const CE_C_PICK: i64 = 3
84const CE_C_STR: i64 = 4
85const CE_C_PRO: i64 = 5
86const CE_C_UNK: i64 = 6
87const CE_C_AH: i64 = 7
88const CE_C_P2: i64 = 8
89const CE_C_SHOWN: i64 = 9
90const CE_C_MMAPLIT: i64 = 10
96const CE_C_UNNAMED: i64 = 11
107const CE_C_SHOWMAX: i64 = 12
108const CE_C_RESOLVED: i64 = 13
109const CE_C_EXCEEDED: i64 = 14
110const CE_C_NEAR: i64 = 15
111const CE_C_OKB: i64 = 16
112const CE_C_MISSING: i64 = 17
124const CE_C_TAILANCH: i64 = 18
125const CE_C_FIXTURE: i64 = 19
126const CE_NCTR: i64 = 24

functions

128func ce_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
129func ce_wspan(b: *u8, s: i64, e: i64) -> i64 { if e > s { sys_write(1, ((b as i64) + s) as *u8, e - s) } return 0 }
130func ce_wn(v: i64) -> i64
145func ce_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: ce_hasmain
146func ce_streq(a: *u8, b: *u8) -> i64
called by 1: main
160func ce_has(b: *u8, s: i64, e: i64, ned: *u8) -> i64
179func ce_isdig(c: i64) -> i64 { if c >= 48 { if c <= 57 { return 1 } } return 0 }
182func ce_all_digits(b: *u8, s: i64, e: i64) -> i64
197func ce_atoi_span(b: *u8, s: i64, e: i64) -> i64
210func ce_pow2_big(v: i64) -> i64
called by 1: ce_scan_line
218func ce_capshaped(b: *u8, s: i64, e: i64) -> i64
called by 2: ce_scan_linece_subjects_file calls 1: ce_has
232func ce_structural(b: *u8, s: i64, e: i64) -> i64
called by 1: ce_scan_line calls 1: ce_has
246func ce_protective(b: *u8, s: i64, e: i64) -> i64
called by 1: ce_scan_line calls 1: ce_has
257func ce_autohoist(b: *u8, s: i64, e: i64) -> i64
called by 1: ce_scan_line calls 1: ce_has
263func ce_scan_line(b: *u8, s: i64, e: i64, path: *u8, lineno: i64, ctr: *i64) -> i64
380func ce_scan_file(fb: *u8, flen: i64, path: *u8, ctr: *i64) -> i64
called by 1: main calls 3: ce_scan_linece_hasce_isdig
430func ce_path_size(p: *u8) -> i64
439func ce_span_in(b: *u8, s: i64, e: i64, nb: *u8, ns: i64, ne: i64) -> i64
called by 1: ce_subjects_file
456func ce_subjects_file(fb: *u8, flen: i64, path: *u8, ctr: *i64) -> i64
607func main(argc: i64, argv: *i64) -> i64