code wiki / _hdl_build / nx_gate_fixture_ratchet_gate.nx
nx_gate_fixture_ratchet_gate.nx
buildroot/runtime/_hdl_build/nx_gate_fixture_ratchet_gate.nx
about
nx_gate_fixture_ratchet_gate.nx -- A GATE MUST NOT SHARE ITS FIXTURE WITH A PRODUCTION BEAT.
2026-08-07, ws=segstore. SIBLING OF nx_gate_dry_ratchet_gate, deliberately built to the same shape:
same corpus, same baseline-file convention, same first-run honesty, same gv_bite non-vacuity cell.
Only the TOOTH differs. Matching the known good was the point -- a second ratchet that behaved
differently would be a second thing to remember, and the whole value of a ratchet is that nobody
has to remember it.
WHAT IT RATCHETS. A gate that keeps its scratch planes under knowledge/store/ is sharing a
directory with the nx_segguard beat, which sweeps every 600s and folds any plane at or above its
threshold. MEASURED 2026-08-07T10:01:56: segguard folded `segracegate-real 23 -> 1` WHILE
nx_segrace_gate was mid-run, and the gate then reported "COMPACTION STILL ERASES COMMITTED
SEGMENTS -- lost 1". A controlled comparison settled it: the SAME code on a /tmp fixture went
GREEN 24/24, the pre-change baseline on the knowledge/store fixture went RED. The RED tracked the
FIXTURE, not the code.
★★★★★★A GATE THAT SHARES ITS FIXTURE WITH A PRODUCTION BEAT IS MEASURING THE BEAT.
★A RED THAT A THIRD PARTY CAN CAUSE IS NOT A MEASUREMENT OF THE CODE UNDER TEST.
WHY A RATCHET AND NOT A LINT-AND-FIX PASS: fixing the 9 gates that carry this today is O(LEAVES)
and does nothing about the tenth someone writes tomorrow. The sibling gate says it best -- "a rule
nothing must remember beats a list". This fails if they forget.
SCOPE -- CORRECTED 2026-08-07, AND THE CORRECTION IS THE POINT. This header first claimed the
defect was LATENT: "segguard has folded ZERO of them". That was measured over NINE planes I
happened to have to hand, and all nine came back clean. Re-measured over the FULL population of
thirty, the sweeper has touched TEN of them -- 57 logged COMPACT/FAIL/DEFER events, `ledgergate`
alone 17 and `citatorgate` 9. So the defect is ACTIVE for a third of the population, not latent.
★★★★★★A SAMPLE THAT RETURNS ZERO IS THE EASIEST KIND TO BELIEVE AND THE MOST LIKELY TO BE
UNREPRESENTATIVE -- 0/9 read as "no problem", the true rate was 33%.
★★★★★A LATENT DEFECT AND AN ACTIVE ONE ARE DIFFERENT FACTS -- AND YOU DO NOT KNOW WHICH YOU HAVE
UNTIL YOU HAVE ASKED THE WHOLE POPULATION.
THE TOOTH: count *_gate.nx sources that name a TEST-FIXTURE plane under knowledge/store/.
current > baseline -> RED. Someone added a gate whose fixture the sweeper can rewrite.
current < baseline -> GREEN, baseline TIGHTENS. The ratchet only ever closes.
current == baseline -> GREEN, no change.
DETECTOR, and why it is narrow ON PURPOSE: it fires only when the plane NAME following
knowledge/store/ contains gate|test|probe|scratch|fixture. A gate that READS a real production
plane is legitimate and must not be flagged; a raw "does the source mention knowledge/store/"
check counts 124 gate files, of which only 9 are fixtures. The narrow form is the difference
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
| 50 | const FX_DIRBUF: i64 = 262144 |
| 51 | const FX_PATH: i64 = 512 |
| 52 | const FX_SRC: i64 = 262144 |
| 53 | const FX_NAME: i64 = 128 |
| 54 | const FX_RECLEN_OFF: i64 = 16 |
| 55 | const FX_NAME_OFF: i64 = 19 |
| 56 | const FX_MODE: i64 = 420 |
| 57 | const FX_NUM: i64 = 32 |
| 58 | const FX_ZERO: i64 = 48 |
| 59 | const FX_B10: i64 = 10 |
| 60 | const FX_LC_A: i64 = 97 |
| 61 | const FX_LC_Z: i64 = 122 |
| 62 | const FX_D0: i64 = 48 |
| 63 | const FX_D9: i64 = 57 |
| 64 | const FX_DASH: i64 = 45 |
| 65 | const FX_USCORE: i64 = 95 |
| 66 | const FX_BASELINE: *u8 = "knowledge/status/gate_fixture_ratchet.conf" |
functions
| 68 | func fx_exists(path: *u8) -> i64 |
| 75 | func fx_enter_buildroot() -> i64 |
| 83 | func fx_cat(dst: *u8, o: i64, s: *u8) -> i64 |
| 91 | func fx_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 107 | func fx_has(hay: *u8, hn: i64, needle: *u8) -> i64 called by 1: fx_marks_fixture |
| 126 | func fx_marks_fixture(nm: *u8, n: i64) -> i64 |
| 136 | func fx_fixture_in_store(buf: *u8, n: i64, nm: *u8) -> i64 |
| 173 | func fx_is_gate_src(nm: *u8, n: i64) -> i64 called by 1: fx_count_dir |
| 187 | func fx_count_dir(dir: *u8) -> i64 |
| 240 | func fx_atoi(s: *u8, n: i64) -> i64 |
| 255 | func fx_write_baseline(v: i64) -> i64 |
| 272 | func main(argc: i64, argv: *i64) -> i64 |