code wiki / _hdl_build / nx_gate_build_sweep.nx
nx_gate_build_sweep.nx
buildroot/runtime/_hdl_build/nx_gate_build_sweep.nx
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
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
structs
| none |
consts
| 41 | const GS_DIRBUF: i64 = 262144 |
| 42 | const GS_PATH: i64 = 512 |
| 43 | const GS_CAP: i64 = 262144 |
| 44 | const GS_SLOT: i64 = 16 |
| 45 | const GS_LINE: i64 = 1024 |
| 46 | const GS_MODE: i64 = 420 |
| 47 | const GS_RECLEN_OFF: i64 = 16 |
| 48 | const GS_NAME_OFF: i64 = 19 |
| 49 | const GS_TAB: i64 = 9 |
| 50 | const GS_NL: i64 = 10 |
| 51 | const GS_ZERO: i64 = 48 |
| 52 | const GS_B10: i64 = 10 |
| 53 | const GS_DEF_TIMEOUT: i64 = 180000 |
| 54 | const GS_NOBUILDER: i64 = 0 - 99 |
| 58 | const GS_C_SEEN: i64 = 0 |
| 59 | const GS_C_SKIPPED: i64 = 1 |
| 60 | const GS_C_EXISTS: i64 = 2 |
| 61 | const GS_C_BUILT: i64 = 3 |
| 62 | const GS_C_FAILED: i64 = 4 |
| 63 | const GS_C_TIMEOUT: i64 = 5 |
| 64 | const GS_C_ANOMALY: i64 = 6 |
| 65 | const GS_C_ATTEMPT: i64 = 7 |
| 66 | const GS_C_WAITED: i64 = 8 |
| 67 | const GS_C_PAUSED: i64 = 9 |
| 68 | const GS_C_PROMOTED: i64 = 10 |
| 69 | const GS_C_COMPILED_ONLY: i64 = 11 |
| 70 | const GS_C_NEVER: i64 = 12 |
| 71 | const GS_CN: i64 = 13 |
| 83 | const GS_ADMIT_EVERY: i64 = 8 |
| 84 | const GS_ADMIT_WAIT_MS: i64 = 30000 |
| 85 | const GS_ADMIT_MAX_WAITS: i64 = 20 |
| 86 | const GS_ADMIT_TIMEOUT: i64 = 20000 |
| 87 | const GS_PAUSED: i64 = 0 - 97 |
| 88 | const GS_NOADMIT: i64 = 0 - 96 |
| 91 | const GS_K_MAX: i64 = 0 |
| 92 | const GS_K_SKIP: i64 = 1 |
| 93 | const GS_K_TIMEOUT: i64 = 2 |
| 94 | const GS_K_JFD: i64 = 3 |
| 95 | const GS_KN: i64 = 4 |
functions
| 97 | func gs_atoi(s: *u8) -> i64 called by 1: main |
| 112 | func gs_exists(path: *u8) -> i64 called by 5: gs_enter_buildrootgs_have_artifactgs_promotedgs_admit_pathgs_build calls 2: sys_openat_rdsys_close |
| 120 | func gs_is_gate_src(nm: *u8, n: i64) -> i64 called by 1: gs_scan |
| 133 | func gs_enter_buildroot() -> i64 |
| 147 | func gs_artifact(target: *u8, out: *u8) -> i64 |
| 155 | func gs_artifact_alt(target: *u8, out: *u8) -> i64 |
| 163 | func gs_have_artifact(target: *u8, out: *u8) -> i64 |
| 178 | func gs_promoted(target: *u8, out: *u8) -> i64 |
| 186 | func gs_admit_path(out: *u8) -> i64 |
| 199 | func gs_admit_ok(p: *u8, out: *u8, ol: *i64) -> i64 |
| 209 | func gs_build(target: *u8, timeout_ms: i64, out: *u8, outlen: *i64, ctr: *i64) -> i64 called by 1: gs_scan calls 6: sys_mmapgs_admit_pathgs_admit_oksys_sleep_msgs_existstr_run_capture_to |
| 244 | func gs_frame(jfd: i64, target: *u8, status: *u8, rc: i64) -> i64 |
| 262 | func gs_scan(dir: *u8, ctr: *i64, cfg: *i64) -> i64 called by 1: main calls 9: sys_openat_rdsys_mmapsys_getdents64gs_is_gate_srcgs_promotedgs_have_artifact+3 |
| 359 | func main(argc: i64, argv: *i64) -> i64 |