code wiki / (root) / nx_promotestale.nx

nx_promotestale.nx

buildroot/runtime/nx_promotestale.nx

10643 B224 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_promotestale.nx -- IS THE BINARY WE ARE SERVING THE ONE THE LAST BUILD PRODUCED? WHY IT EXISTS, MEASURED 2026-08-14: two organs were found SERVING STALE CODE purely because a human happened to notice nx_catalog's BUILT and PROMOTED columns disagree -- nx_vizsla_digest (47,402 served vs 47,596 built) and nx_vizsla_plan (176,882 served vs 217,561 built: ~40 KB, a FIFTH of the organ, missing from the running binary). Both were invisible to every health check the estate runs, because nothing compares those two numbers across the fleet. -- A RUNNING BINARY THAT IS NOT WHAT ITS SOURCE BUILT IS A SILENT CORRECTNESS AND SECURITY DEFECT: every fix, every audit and every gate verdict describes code that is not the code being executed. -- SPOTTING IT BY EYE DOES NOT SCALE. nx_catalog answers this one NAME at a time; this sweeps. nx_promotestale [registry] [buildroot] THE UNIT IS THE BINARY, NOT THE REGISTRY ROW. Several names legitimately share one elf (nx_status and nx_torstat both point at nx_hostctl; nx_services/nx_health/nx_mgmt all at nx_mgmt_call.elf), so counting rows would INFLATE the population and report one stale binary as three. CLASSES -- a PARTITION whose parts are printed and MUST sum: IDENTICAL served bytes == built bytes -> what we run is what we built STALE both exist and DIFFER -> THE WORKLIST; the served code is not the build NO-BUILD no build artifact to compare against -> CANNOT JUDGE, never folded into IDENTICAL NO-SERVED the registry points at a missing elf -> a dangling row, a different defect entirely -- "I COULD NOT LOOK" GETS ITS OWN BUCKET. Folding NO-BUILD into IDENTICAL would report the fleet healthy in exactly the state this organ exists to catch -- the defect nx_offc_install already made once when it read "no twin to judge" as "not stale". CHEAP BY CONSTRUCTION: size comes from sys_fstatat (a stat, NOT a read), so the common case costs two stats per binary and reads NOTHING. A full byte compare runs ONLY when the sizes match, which is the only case where size cannot decide. Equal size with different bytes is real, so it is never assumed away. exit 0 census printed | 2 usage | 3 cannot read registry | 4 no rows | 5 capacity exceeded (REFUSES) license_tier: ORIGINAL. Read-only. No hw writes (Rule 26).

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_promotestale.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 ps_puts sys_write ps_len 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_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close sys_exit ↻ ps_streq ps_size sys_mmap ↻ sys_fstatat ps_same sys_mmap ↻ sys_read_file ↻ ps_pn ps_puts ↻ sys_mmap ↻ sys_write ↻

structs

none

consts

34const PS_MAXROW: i64 = 4096
35const PS_NAMEMAX: i64 = 256
36const PS_STAT_SIZE_OFF: i64 = 48
37const PS_DEFAULT_REG: *u8 = "tool_allowlist.conf"
38const PS_DEFAULT_BROOT: *u8 = "buildroot/_build/"
39const PS_TAB: i64 = 9
40const PS_NL: i64 = 10

functions

42func ps_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: ps_puts
43func ps_puts(s: *u8) -> i64 { sys_write(1, s, ps_len(s)); return 0 }
called by 2: ps_pnmain calls 2: sys_writeps_len
44func ps_pn(v: i64) -> i64
called by 1: main calls 3: ps_putssys_mmapsys_write
58func ps_size(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_fstatat
64func ps_streq(a: *u8, b: *u8) -> i64
called by 1: main
76func ps_same(a: *u8, b: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
95func main(argc: i64, argv: *i64) -> i64