code wiki / _hdl_build / nx_gate_dry_ratchet_gate.nx
nx_gate_dry_ratchet_gate.nx
buildroot/runtime/_hdl_build/nx_gate_dry_ratchet_gate.nx
about
nx_gate_dry_ratchet_gate.nx -- THE PERMANENT HALF OF D001 (2026-07-31, ws=gate-dry-d001).
WHY THIS EXISTS AND THE 385 MIGRATIONS DO NOT REPLACE IT: migrating leaves is O(LEAVES) FOREVER. It
remediates gates that already exist and does NOTHING about the next gate someone hand-writes with its
own printf tomorrow. The corpus is a LINEAGE, not a flat file of thousands, and the fix belongs at the
generation everything passes through -- not in 2800 descendants. nx_compose_builder was already fixed
to emit inheriting gates; that was the real hoist. This is the other half: a RATCHET that makes the
debt MONOTONICALLY NON-INCREASING BY CONSTRUCTION, so the campaign can never be silently undone.
THE TOOTH: count non-inheriting *_gate.nx sources. Compare against a stored baseline.
current > baseline -> RED. Someone added a gate that rolls its own verdict, or reverted a migration.
current < baseline -> GREEN, and the baseline TIGHTENS to current. The ratchet only ever closes.
current == baseline -> GREEN, no change.
A rule nothing must remember beats a list. Nobody has to remember D001 exists; this fails if they forget.
FIRST-RUN HONESTY: with no baseline on disk this INITIALISES and says so loudly rather than silently
blessing whatever it found. An initialising run is NOT evidence of health -- it has nothing to compare
against, and a gate that cannot compare must say so instead of printing GREEN as if it had.
NON-VACUITY: the tooth is proven able to FAIL, not merely observed passing. gv_bite is fed a crafted
regression (baseline+1 non-inheriting gates) and a crafted good state, so a run where the detector
could not fire is visible as VACUOUS rather than counted as a pass.
ENVELOPE, declared in-band: FLAT scan of runtime + runtime/_hdl_build under the discovered buildroot,
same corpus as nx_gate_vocab_census and nx_gatebuilt_gate so all three numbers compose. Inheritance is
detected by the SOURCE containing nx_gate_verdict -- a source-literal proxy, which is the right check
here because the thing being ratcheted IS a source property.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.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
| 32 | const RT_DIRBUF: i64 = 262144 |
| 33 | const RT_PATH: i64 = 512 |
| 34 | const RT_SRC: i64 = 262144 |
| 35 | const RT_RECLEN_OFF: i64 = 16 |
| 36 | const RT_NAME_OFF: i64 = 19 |
| 37 | const RT_MODE: i64 = 420 |
| 38 | const RT_NUM: i64 = 32 |
| 39 | const RT_ZERO: i64 = 48 |
| 40 | const RT_B10: i64 = 10 |
| 41 | const RT_BASELINE: *u8 = "knowledge/status/gate_dry_ratchet.conf" |
functions
| 43 | func rt_exists(path: *u8) -> i64 |
| 50 | func rt_enter_buildroot() -> i64 |
| 58 | func rt_cat(dst: *u8, o: i64, s: *u8) -> i64 called by 1: rt_count_dir |
| 66 | func rt_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 81 | func rt_contains(buf: *u8, n: i64, needle: *u8) -> i64 called by 1: rt_count_dir |
| 97 | func rt_is_gate_src(nm: *u8, n: i64) -> i64 called by 1: rt_count_dir |
| 111 | func rt_count_dir(dir: *u8) -> i64 |
| 149 | func rt_atoi(s: *u8, n: i64) -> i64 called by 1: main |
| 164 | func rt_write_baseline(v: i64) -> i64 |
| 181 | func main(argc: i64, argv: *i64) -> i64 |