code wiki / (root) / nx_stalecensus.nx

nx_stalecensus.nx

buildroot/runtime/nx_stalecensus.nx

15759 B295 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_stalecensus.nx -- RESOLVE THE AMBIGUITY nx_stalesweep NAMES (2026-08-07). nx_stalesweep already measures stale MIRRORS by mtime and maintains knowledge/status/stale_mirror.worklist. Its own header states the limit it cannot pass, and states it honestly: "source-newer is AMBIGUOUS (pending upgrade vs uncommitted WIP), so the debt says TRIAGE and explicitly forbids blanket-rebuild." That is correct AND it leaves every entry unactionable -- an mtime says a dependency MOVED, never that codegen CHANGED, and never whether rebuilding is SAFE. This organ consumes that worklist and resolves each row to a verdict by the only instrument that can: nx_stale_check rebuilds the target and byte-compares against the DEPLOYED elf, and its capability_check refuses a rebuild that would DELETE shipped strings. *THE WORKLIST IS CONSUMED, NEVER RE-DERIVED. A second scan would drift from the one the clock already maintains, and two censuses that disagree about the corpus are worse than either alone. WHY THE CAPABILITY SPLIT IS THE WHOLE POINT: hand-sampling 8 targets gave 6 safe / 2 CAPABILITY-LOSS -- nx_verify's rebuild drops 19 of 64 shipped strings, and nx_render3d's rebuild is LARGER and still loses 2. So a blanket rebuild of the flagged population would delete working features from roughly a quarter of it, silently. 8 samples is enough to know the split is not uniform and nowhere near enough to plan against; this produces the distribution. *A SIZE INCREASE DOES NOT PROVE NOTHING WAS LOST -- only the string-level check decides. DETECT-ONLY, DELIBERATELY. It never promotes. nx_stale_check is the safe half of the deploy-drift loop precisely because it never writes, and a census that promoted as it went could not be re-run to check its own work. Promotion stays an explicit per-target operator step (/api/build + /api/promote with expect_sha256), and CAP-LOSS rows must never be promoted at all until their source is recovered. ENVELOPE, declared in-band and never silent: bounded by an explicit max (REFUSES <= 0 -- no runaway over a 1,500-row worklist), resumable by an explicit skip, and every per-target rebuild carries a deadline because ONE hanging compile must not wedge the sweep. usage: nx_stalecensus <max> [skip] [timeout_ms] [worklist] license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_tool_run.nx nx_stalecensus.nx

imports: nx_tool_run.nx

imported by: nobody (leaf or entry point)

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

main sce sc_atoi tr_run_capture_cwd tr_run_capture_core tr_run_capture_core_owned tr_run_capture_core_eviden sys_mmap_shared tr_clock_ms sys_clock_gettime_mono sys_munmap sys_pipe2 sys_fork sys_close sys_default_signal sys_mmap sys_bind_parent_lifetime sys_prctl sys_exit sys_setpgid tr_capture_redirect sys_dup3 sys_chdir sys_mmap ↻ sys_close_inherited sys_close_inherited_proc sys_execve tr_exec_failed sys_write sys_exit ↻ tr_watchdog_start sys_mmap ↻ sys_pipe2 ↻ sys_munmap ↻ sys_fork ↻ tr_watchdog_child sys_exit ↻ sys_close ↻ tr_drain_until nx_kill

structs

none

consts

36const SC_WORKLIST: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/status/stale_mirror.worklist"
37const SC_CHECKER: *u8 = "/volume1/homes/elderwesto/nishihost/nx_stale_check.elf"
38const SC_CWD: *u8 = "/volume1/homes/elderwesto/nishihost"
39const SC_CAP: i64 = 262144
40const SC_WLCAP: i64 = 4194304
41const SC_DEF_TMO: i64 = 240000
44const SC_CONTROL: *u8 = "nx_footcheck"

functions

46func scp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 3: scnsc_labelmain
47func sce(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(2,s,n); return 0 }
called by 1: main
48func scn(v: i64) -> i64
called by 1: main calls 1: scp
61func sc_atoi(s: *u8) -> i64
called by 1: main
88func sc_class(o: *u8, n: i64) -> i64
called by 1: main
122func sc_label(k: i64) -> i64
called by 1: main calls 1: scp
135func main(argc: i64, argv: *i64) -> i64