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

9854 B246 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic gate
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_gate_verdict.nx nx_gate_dry_ratchet_gate.nx

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

main gv_ctr sys_mmap gv_head gv_puts sys_write rt_enter_buildroot rt_exists sys_openat_rd sys_close sys_chdir sys_mmap ↻ gv_puts ↻ gv_check gv_puts ↻ gv_verdict gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real gv_cat sys_write ↻ sys_close ↻ sys_munmap ↻ rt_count_dir sys_openat_rd ↻ sys_mmap ↻ sys_getdents64 rt_is_gate_src rt_cat

structs

none

consts

32const RT_DIRBUF: i64 = 262144
33const RT_PATH: i64 = 512
34const RT_SRC: i64 = 262144
35const RT_RECLEN_OFF: i64 = 16
36const RT_NAME_OFF: i64 = 19
37const RT_MODE: i64 = 420
38const RT_NUM: i64 = 32
39const RT_ZERO: i64 = 48
40const RT_B10: i64 = 10
41const RT_BASELINE: *u8 = "knowledge/status/gate_dry_ratchet.conf"

functions

43func rt_exists(path: *u8) -> i64
50func rt_enter_buildroot() -> i64
called by 1: main calls 2: rt_existssys_chdir
58func rt_cat(dst: *u8, o: i64, s: *u8) -> i64
called by 1: rt_count_dir
66func rt_slurp(path: *u8, buf: *u8, cap: i64) -> i64
81func rt_contains(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: rt_count_dir
97func rt_is_gate_src(nm: *u8, n: i64) -> i64
called by 1: rt_count_dir
111func rt_count_dir(dir: *u8) -> i64
149func rt_atoi(s: *u8, n: i64) -> i64
called by 1: main
164func rt_write_baseline(v: i64) -> i64
181func main(argc: i64, argv: *i64) -> i64