code wiki / _hdl_build / nx_gate_build_sweep.nx

nx_gate_build_sweep.nx

buildroot/runtime/_hdl_build/nx_gate_build_sweep.nx

22138 B453 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic gate
docsdependenciesstructsconstsfunctions

about

nx_gate_build_sweep.nx -- THE UNBUILT-GATE PARTITIONER (2026-07-31, ws=gate-dry-d001). WHY: nx_gatebuilt_gate measures gate_sources=2891 built=232 UNBUILT=2659 (built_permil=80) and states the law -- AN UNBUILT GATE IS INDISTINGUISHABLE FROM A PASSING ONE IN EVERY REPORT THAT MENTIONS IT. But it stops at the COUNT. A count cannot tell you whether those 2659 are merely NEVER-COMPILED (cheap: nobody ran the builder) or GENUINELY BROKEN (real defects hiding behind a number). Those two populations need opposite remedies, and conflating them is the same class of error as a MISSING X vs a WEDGED X. A hand spot-check of 4 (nx_cap_keygen_gate/nx_coindex_gate/nx_anti_slop_gate/nx_warc_index_gate) built 4/4 CLEAN on the first try -- which says the population is probably mostly the cheap kind, but 4 is a spot check and MUST NOT be banked as a measurement (a candidate ruler's output is never a measurement). This organ turns the spot check into a census. WHAT IT IS NOT: it does NOT promote. Compiling proves a gate CAN exist; promoting it into the shared prod root is an outward-facing change to a tree seven sibling sessions are using, and belongs to a deliberate operator-authorised step. This organ ONLY partitions, and says so in its own output. ENVELOPE, declared in-band and never silent: FLAT scan of runtime + runtime/_hdl_build relative to the DISCOVERED buildroot (no recursion -- the _attic/_retired/_stage_local shadow trees stay excluded, same envelope as nx_gatebuilt_gate so the two numbers are comparable); every run is BOUNDED by an explicit max (argv[1]) and resumable by an explicit skip (argv[2]) so it can never run away; every build is deadline-bounded (tr_run_capture_to) because ONE hanging compile must not wedge a 2659-target sweep. IDEMPOTENT (rule 10): a target whose /tmp/<t>.sov.elf already exists is SKIP-EXISTS, not rebuilt. ADDITIVE (rule 13): appends one frame per target to an append-only journal; never rewrites history. ANOMALY class, deliberately its own bucket: builder returns rc=0 but NO artifact appears. That is an instrument claiming success it cannot show, and it must never be silently counted as BUILT. usage: nx_gate_build_sweep <max> [skip] [journal] [timeout_ms] argv[1] max REQUIRED, > 0 -- refuse rather than default to unbounded (no silent runaway) argv[2] skip resume offset into the scan order, default 0 argv[3] journal append-only outcome log, default /tmp/gate_build_sweep.jrnl (absolute recommended: this organ chdir's to the buildroot, so a relative path resolves THERE) argv[4] timeout per-build deadline in ms, default 180000 license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_gate_build_sweep.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_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 gv_puts sys_write gs_atoi gs_enter_buildroot gs_exists sys_openat_rd sys_close sys_chdir sys_mmap sys_mmap ↻ sys_openat_append gs_scan sys_openat_rd ↻ sys_mmap ↻ sys_getdents64 gs_is_gate_src gs_promoted gv_cat gs_exists ↻ gs_have_artifact gs_artifact gv_cat ↻ gs_exists ↻ gs_artifact_alt gv_cat ↻ gs_frame sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real gv_cat ↻ sys_write ↻ gs_build sys_mmap ↻ gs_admit_path gv_cat ↻

structs

none

consts

41const GS_DIRBUF: i64 = 262144
42const GS_PATH: i64 = 512
43const GS_CAP: i64 = 262144
44const GS_SLOT: i64 = 16
45const GS_LINE: i64 = 1024
46const GS_MODE: i64 = 420
47const GS_RECLEN_OFF: i64 = 16
48const GS_NAME_OFF: i64 = 19
49const GS_TAB: i64 = 9
50const GS_NL: i64 = 10
51const GS_ZERO: i64 = 48
52const GS_B10: i64 = 10
53const GS_DEF_TIMEOUT: i64 = 180000
54const GS_NOBUILDER: i64 = 0 - 99
58const GS_C_SEEN: i64 = 0
59const GS_C_SKIPPED: i64 = 1
60const GS_C_EXISTS: i64 = 2
61const GS_C_BUILT: i64 = 3
62const GS_C_FAILED: i64 = 4
63const GS_C_TIMEOUT: i64 = 5
64const GS_C_ANOMALY: i64 = 6
65const GS_C_ATTEMPT: i64 = 7
66const GS_C_WAITED: i64 = 8
67const GS_C_PAUSED: i64 = 9
68const GS_C_PROMOTED: i64 = 10
69const GS_C_COMPILED_ONLY: i64 = 11
70const GS_C_NEVER: i64 = 12
71const GS_CN: i64 = 13
83const GS_ADMIT_EVERY: i64 = 8
84const GS_ADMIT_WAIT_MS: i64 = 30000
85const GS_ADMIT_MAX_WAITS: i64 = 20
86const GS_ADMIT_TIMEOUT: i64 = 20000
87const GS_PAUSED: i64 = 0 - 97
88const GS_NOADMIT: i64 = 0 - 96
91const GS_K_MAX: i64 = 0
92const GS_K_SKIP: i64 = 1
93const GS_K_TIMEOUT: i64 = 2
94const GS_K_JFD: i64 = 3
95const GS_KN: i64 = 4

functions

97func gs_atoi(s: *u8) -> i64
called by 1: main
112func gs_exists(path: *u8) -> i64
120func gs_is_gate_src(nm: *u8, n: i64) -> i64
called by 1: gs_scan
133func gs_enter_buildroot() -> i64
called by 1: main calls 2: gs_existssys_chdir
147func gs_artifact(target: *u8, out: *u8) -> i64
called by 1: gs_have_artifact calls 1: gv_cat
155func gs_artifact_alt(target: *u8, out: *u8) -> i64
called by 1: gs_have_artifact calls 1: gv_cat
163func gs_have_artifact(target: *u8, out: *u8) -> i64
178func gs_promoted(target: *u8, out: *u8) -> i64
called by 1: gs_scan calls 2: gv_catgs_exists
186func gs_admit_path(out: *u8) -> i64
called by 1: gs_build calls 2: gv_catgs_exists
199func gs_admit_ok(p: *u8, out: *u8, ol: *i64) -> i64
209func gs_build(target: *u8, timeout_ms: i64, out: *u8, outlen: *i64, ctr: *i64) -> i64
244func gs_frame(jfd: i64, target: *u8, status: *u8, rc: i64) -> i64
262func gs_scan(dir: *u8, ctr: *i64, cfg: *i64) -> i64
359func main(argc: i64, argv: *i64) -> i64