nx_gatelaw_gate.nx
buildroot/runtime/nx_gatelaw_gate.nx
about
nx_gatelaw_gate.nx -- THE SESSION'S LAWS, MADE EXECUTABLE AND POINTED AT EVERY GATE IN THE ESTATE.
WHY THIS EXISTS. Every law below was paid for with a real failure, written into a record, and then
RE-DERIVED days later because a record is something you have to remember to read. ★★★★★★ A LAW
THAT LIVES ONLY IN PROSE IS ADVICE, AND ADVICE IS ADOPTED AT ADVICE RATES; THE SAME LAW PLACED IN
THE PATH IS ADOPTED AT 100%. The estate already proved that with nx_memnew (a pre-flight that only
INFORMS survives; one that refuses gets disabled).
So this is ADVISORY BY CONSTRUCTION: it names offenders, it does not block anyone. Its verdict is
bound to ITS OWN subject -- can it read the corpus -- and never to the fleet's condition, because a
permanent RED over thousands of legacy gates is noise, not a work order (the same call
nx_gatebuilt_gate made about stale_built).
THE LAWS, each traceable to a measured failure:
L1 EXIT-CARRIES-VERDICT -- a gate that prints RED and returns 0 makes /api/gate_run report GREEN.
MEASURED 2026-08-07 on nx_dwline_roundtrip_gate: "passed 5/11
verdict=RED" served as exit_code=0 verdict=GREEN.
L2 HAS-NEGATIVE-CONTROL -- a suite of only positive teeth passes on a subject that does nothing.
MEASURED: nx_dwline_e2e_gate's no-g control is the only tooth that
would catch debug info becoming unconditional.
L3 INHERITS-BASE -- hand-rolled counters drift from the teeth that execute, producing
red-by-construction (passed 22/20) or silently-skipped teeth.
gv_check increments both, so declared == executed BY CONSTRUCTION.
★ MEASURED ON CODE, NOT ON PROSE: comments are STRIPPED before matching. A scanner that does not
skip comments measures the documentation -- that defect once made the whole estate inherit
"writer" from a comment in nx_syscalls.nx.
---------------------------------------------------------------------------------------------
2026-08-07 CORRECTION -- L1 WAS MEASURING AN IDIOM AND CALLING IT A PROPERTY.
The old predicate was a substring test for "return gv_verdict(" / "return gv_". A gate ending
let rc: i64 = gv_verdict(name, ctr, note)
sys_exit(rc)
carries the verdict to the process exit status MORE strongly than `return` does (sys_exit sets the
status unconditionally, and does not depend on what the runtime does with main's return value) --
and the old test called it an L1-VIOLATION. Measured: it falsely accused 13 gates written that
same day, whose author then read the offender list and believed it.
dependencies 2 imports · 0 importers
imports: 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
| 62 | const GL_SRC_CAP: i64 = 1048576 |
| 63 | const GL_MAXFILES: i64 = 4096 |
| 64 | const GL_NAMEBUF: i64 = 1048576 |
| 65 | const GL_MAXNAME: i64 = 256 |
| 66 | const GL_TMP: i64 = 4096 |
functions
| 68 | func gl_read(path: *u8, buf: *u8, cap: i64) -> i64 called by 1: main |
| 86 | func gl_strip(src: *u8, n: i64, dst: *u8) -> i64 called by 1: main |
| 102 | func gl_slen(p: *u8) -> i64 |
| 108 | func gl_has(buf: *u8, n: i64, pat: *u8) -> i64 |
| 122 | func gl_find(buf: *u8, n: i64, pat: *u8, from: i64) -> i64 |
| 143 | func gl_has_call(buf: *u8, n: i64, pat: *u8) -> i64 |
| 155 | func gl_is_ident(c: u8) -> i64 called by 1: gl_carries_verdict |
| 165 | func gl_bskip(code: *u8, k0: i64) -> i64 called by 1: gl_carries_verdict |
| 188 | func gl_carries_verdict(code: *u8, cn: i64, tmp: *u8) -> i64 |
| 253 | func gl_join2(dst: *u8, a: *u8, b: *u8) -> *u8 called by 1: main |
| 263 | func gl_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p } called by 1: main |
| 270 | func gl_l5(code: *u8, cn: i64, np1: *u8, np2: *u8, np3: *u8, np4: *u8, nsx: *u8) -> i64 |
| 279 | func gl_ends_gate_nx(nm: *u8, nl: i64) -> i64 called by 1: main |
| 288 | func main(argc: i64, argv: *i64) -> i64 |