code wiki / _hdl_build / nx_layerscan_gate.nx

nx_layerscan_gate.nx

buildroot/runtime/_hdl_build/nx_layerscan_gate.nx

9580 B247 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_layerscan_gate.nx -- LAYERING-VIOLATION CENSUS: which runtime/ organs import a lib that exists ONLY in _hdl_build/, and are therefore SILENTLY UNBUILDABLE? WHY (three instances found BY CHANCE in one session, each a whole capability): nx_clock.nx -> darkened 174 gguf/f32_llm organs (the sovereign LLM stack, frozen ~Jul 16) nx_bm25.nx -> darkens rights-enforced DMS search (licensed-media consent gating) nx_fft.nx -> darkens nx_fft_f32 -> nx_autograd_tensor -> THE ENTIRE TRAINING CAPABILITY Each was found only because somebody happened to build the right target. Three hits from a handful of attempts means this is a POPULATION, not a coincidence -- and it is mechanically detectable in one pass. THE RULE BEING ENFORCED (banked law, re-confirmed by measurement): **runtime/ CANNOT import _hdl_build/**, while _hdl_build/ CAN import runtime/. Proven both directions: nx_syscalls.nx exists ONLY in runtime/ and every _hdl_build organ imports it and builds; nx_clock.nx existed ONLY in _hdl_build/ and runtime/nx_loop.nx could not see it until a copy was placed in runtime/. The asymmetry is what makes the remedy a MOVE. METHOD, deliberately probe-based rather than table-based: for each flat runtime/*.nx, scan its import lines; for each imported basename X, if runtime/X does NOT exist but _hdl_build/X DOES, that is a violation. No name tables, no hashing -- two openat probes per import, so the scan cannot silently overflow a table. FIX FOR EVERY HIT IS THE SAME AND IT IS A MOVE, NEVER A COPY: relocate the lib _hdl_build/ -> runtime/. Because _hdl_build can still reach runtime/, existing consumers keep resolving it and NO duplicate basename is created. Copy-and-leave manufactures the same-name-two-copies divergence class measured repeatedly. ENVELOPE, declared in output and never silent: FLAT scan of runtime/ (no recursion, so _attic/_retired/ _stage_local shadows are excluded); only the first LS_HEADCAP bytes of each file are scanned for imports (imports are declared at the top of every organ in this tree); file and hit counts are capped and the caps are PRINTED with the remainder. A capped scan reports PARTIAL, never a clean total. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_layerscan_gate.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 sys_mmap ls_puts sys_write sys_openat_rd sys_getdents64 ls_ends_nx ls_scan_file sys_mmap ↻ ls_join sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read sys_close ls_match ls_exists sys_openat_rd ↻ sys_close ↻ ls_puts ↻ sys_close ↻ ls_puti sys_mmap ↻ sys_write ↻

structs

none

consts

31const LS_RUNTIME: *u8 = "buildroot/runtime" as *u8
32const LS_HDL: *u8 = "buildroot/runtime/_hdl_build" as *u8
33const LS_DIRBUF: i64 = 262144
34const LS_PATHBUF: i64 = 1024
35const LS_HEADCAP: i64 = 16384
43const LS_FILECAP: i64 = 40000
44const LS_MAXSHOW: i64 = 30
45const LS_RECLEN_OFF: i64 = 16
46const LS_NAME_OFF: i64 = 19

functions

48func ls_puts(s: *u8)
called by 2: ls_scan_filemain calls 1: sys_write
54func ls_puti(x: i64)
called by 1: main calls 2: sys_mmapsys_write
80func ls_ends_nx(nm: *u8, n: i64) -> i64
called by 1: main
88func ls_exists(path: *u8) -> i64
called by 1: ls_scan_file calls 2: sys_openat_rdsys_close
96func ls_join(out: *u8, dir: *u8, name: *u8)
called by 1: ls_scan_file
115func ls_match(b: *u8, at: i64, end: i64, pat: *u8, pl: i64) -> i64
called by 1: ls_scan_file
126func ls_scan_file(fname: *u8, ctr: *i64)
177func main(argc: i64, argv: *i64) -> i64