code wiki / (root) / nx_gatelaw_gate.nx

nx_gatelaw_gate.nx

buildroot/runtime/nx_gatelaw_gate.nx

32921 B595 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

syscalls.nx nx_gate_verdict.nx nx_gatelaw_gate.nx

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ gl_ends_gate_nx gl_join2 gl_read gl_strip gl_has gl_slen gl_carries_verdict gl_has ↻ gl_find gl_slen ↻ gl_bskip gl_is_ident gl_has_call gl_find ↻ gl_l5 gl_has_call ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

62const GL_SRC_CAP: i64 = 1048576
63const GL_MAXFILES: i64 = 4096
64const GL_NAMEBUF: i64 = 1048576
65const GL_MAXNAME: i64 = 256
66const GL_TMP: i64 = 4096

functions

68func gl_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main
86func gl_strip(src: *u8, n: i64, dst: *u8) -> i64
called by 1: main
102func gl_slen(p: *u8) -> i64
called by 3: gl_hasgl_findmain
108func gl_has(buf: *u8, n: i64, pat: *u8) -> i64
called by 2: gl_carries_verdictmain calls 1: gl_slen
122func gl_find(buf: *u8, n: i64, pat: *u8, from: i64) -> i64
143func gl_has_call(buf: *u8, n: i64, pat: *u8) -> i64
called by 2: gl_l5main calls 1: gl_find
155func gl_is_ident(c: u8) -> i64
called by 1: gl_carries_verdict
165func gl_bskip(code: *u8, k0: i64) -> i64
called by 1: gl_carries_verdict
188func gl_carries_verdict(code: *u8, cn: i64, tmp: *u8) -> i64
253func gl_join2(dst: *u8, a: *u8, b: *u8) -> *u8
called by 1: main
263func 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
270func gl_l5(code: *u8, cn: i64, np1: *u8, np2: *u8, np3: *u8, np4: *u8, nsx: *u8) -> i64
called by 1: main calls 1: gl_has_call
279func gl_ends_gate_nx(nm: *u8, nl: i64) -> i64
called by 1: main
288func main(argc: i64, argv: *i64) -> i64