code wiki / _hdl_build / nx_gatebuilt_gate.nx

nx_gatebuilt_gate.nx

buildroot/runtime/_hdl_build/nx_gatebuilt_gate.nx

35788 B589 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_gatebuilt_gate.nx -- THE UNBUILT-GATE CENSUS. For every authored *_gate.nx, does a promoted *_gate.elf actually exist? A gate that lives only in source makes its subject PERMANENTLY UNVERIFIABLE, and nothing in the ecosystem reports it. WHY (found by accident 2026-07-30, id 1785472297): I tried to VERIFY the FD_CLOEXEC port-hostage fix before eating three sev-9 rows that depend on it. `POST /api/gate_run target=nx_cloexec_gate` returned **exit_code=127 verdict=NOT-FOUND bytes=0** -- a fully-written gate (T1 control proving the disease state is reachable, T5 neg-control, T6 non-vacuity) that had NEVER BEEN COMPILED. Building it took one call and it came back 6/6 GREEN. Until then, three sev-9 incidents rested on a fix nobody could prove. A two-glob spot check then said the gap is systemic: ~2877 *_gate.nx sources vs ~187 *_gate.elf binaries. WHY NOTHING ELSE CATCHES IT -- an unbuilt gate is invisible in EVERY direction: nx_gate_rollup reads LOGS -> no binary means no log means the gate is ABSENT from the roster, not RED. nx_wirecensus S3 counts promoted-but-unregistered -- never authored-but-unbuilt. every debt row citing 'gate-proven' reads as evidence regardless. It is the exact INVERSE of PROVEN_UNWIRED (4952 capabilities BUILT+GATED+never called): there the gate exists and the capability is unused; here the capability is used and the gate does not exist. BOTH SCORE AS DONE. LAW: AN UNBUILT GATE IS INDISTINGUISHABLE FROM A PASSING ONE IN EVERY REPORT THAT MENTIONS IT. SECOND CLASS, ADDED 2026-08-07 -- STALE-BUILT: the binary EXISTS but PREDATES its own source. Strictly WORSE than unbuilt, because unbuilt fails LOUD: /api/gate_run answers exit 127 NOT-FOUND for a missing binary, but exit 0 verdict=GREEN for a stale one -- and a GREEN is believed. Found the expensive way: nx_fsops_gate served pass=23/23 GREEN off a 2026-07-29 binary while its source declared 28 checks. The contradiction sat in the SAME response (printed total != declared total) and nothing read it; I reported "no regression" on that GREEN. MEASURED on this census first run: 3168 sources, 715 built, of which only 176 are CURRENT and 539 are STALE-BUILT -- so 5.6pc of authored gates can speak about their own source. LAW: A STALE GATE IS WORSE THAN AN UNBUILT ONE. UNBUILT FAILS LOUD; STALE PASSES QUIETLY. COROLLARY, and the reason this organ must be rebuilt on every edit: EDITING A GATE SOURCE WITHOUT REBUILDING IT CREATES THE VERY CONDITION THIS GATE REPORTS. ENVELOPE, declared in the output and never silent: FLAT scan of the two named dirs (no recursion, so the _attic/_retired/_stage_local shadow trees are deliberately EXCLUDED and this counts LIVE gates only); existence is probed with openat, not a read, so it is cheap and cannot be fooled by an empty file being unreadable; the shown list is capped and the cap is printed. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_srcfresh.nx nx_doc_mainscan.nx nx_gatebuilt_gate.nx

imports: nx_syscalls.nxnx_srcfresh.nxnx_doc_mainscan.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 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_wr gb_puts sys_write ↻ gb_scan sys_openat_rd sys_mmap ↻ sys_getdents64 gb_is_gate_src gb_read_src sys_openat_rd ↻ sys_read sys_close ms_has_main_buf dhl_isident dhl_name_at dhl_isident ↻ kw_eq gb_find gb_at gb_wo sys_mmap ↻ sys_munmap sys_write ↻ gb_import_at_bol

structs

none

consts

42const GB_DIR1: *u8 = "buildroot/runtime" as *u8
43const GB_DIR2: *u8 = "buildroot/runtime/_hdl_build" as *u8
44const GB_DIRBUF: i64 = 262144
45const GB_NAMEBUF: i64 = 512
46const GB_MAXSHOW: i64 = 25
47const GB_RECLEN_OFF: i64 = 16
48const GB_NAME_OFF: i64 = 19
49const GB_STATBUF: i64 = 256 // fstatat buffer -- sized as nx_gate_verdict_lib.gv_mtime does
50const GB_STAT_MTIME_OFF: i64 = 88 // st_mtime offset, LIFTED from gv_mtime rather than re-derived
51const GB_SEC_MIN: i64 = 60
52const GB_MAXSTALE: i64 = 25 // capped list, and the cap is PRINTED
53const GB_MAXPARTIAL: i64 = 40 // PARTIAL names listed: a count nobody can act on is a scoreboard
54const GB_LINE: i64 = 640
55const GB_MODE_644: i64 = 0x1a4
59const GB_WO_BUILD: *u8 = "knowledge/status/gatebuilt_buildstate.tsv"
60const GB_WO_GV: *u8 = "knowledge/status/gatebuilt_verdictstate.tsv"
61const GB_SRCSCAN: i64 = 262144 // entry-point probe buffer, allocated ONCE and REUSED per scan

functions

63func gb_puts(s: *u8)
called by 2: gb_scanmain calls 1: sys_write
69func gb_puti(x: i64)
called by 2: gb_scanmain calls 2: sys_mmapsys_write
96func gb_is_gate_src(nm: *u8, n: i64) -> i64
called by 1: gb_scan
108func gb_exists(path: *u8) -> i64
called by 1: gb_scan calls 2: sys_openat_rdsys_close
116func gb_at(buf: *u8, i: i64, n: i64, needle: *u8) -> i64
135func gb_wo(fd: i64, lb: *u8, cls: *u8, path: *u8, num: i64) -> i64
called by 1: gb_scan calls 3: sys_mmapsys_munmapsys_write
160func gb_read_src(path: *u8, buf: *u8) -> i64
179func gb_import_at_bol(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: gb_scan calls 1: gb_at
192func gb_call_site(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: gb_scan calls 1: gb_at
203func gb_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: gb_scan calls 1: gb_at
212func gb_mtime(path: *u8) -> i64
222func gb_scan(dir: *u8, ctr: *i64) -> i64
458func main(argc: i64, argv: *i64) -> i64