code wiki / _hdl_build / nx_envelope_audit_gate.nx
nx_envelope_audit_gate.nx
buildroot/runtime/_hdl_build/nx_envelope_audit_gate.nx
about
nx_envelope_audit_gate.nx -- TEETH FOR THE SILENT-CAP DETECTOR, because on 2026-08-20 it HAD ONE.
WHY THIS GATE EXISTS. nx_envelope_audit is the estate's enforcer of the scale-law ("every tool DECLARES
its envelope IN ITS OUTPUT -- silent capping is forbidden BY CONSTRUCTION"). It shipped for weeks with a
row-cap gate wrapping its whole per-row body and a row counter that only incremented INSIDE that gate, so
every allowlist row past the cap was dropped with no counter and no marker -- and its dogfood line then
printed the cap as a HAND-TYPED literal, which reads as a population. Measured: it reported rows=512
against a tool_allowlist.conf whose true data-row count is over a thousand.
***THE ENFORCER COMMITTED THE DEFECT IT ENFORCES, AND ITS OWN OUTPUT WAS THE ALIBI.***
A green that never had a corresponding red is unverified, so every tooth below is paired with the input
that must make it fail.
HERMETIC BY CONSTRUCTION. The subject resolves its probe dirs (buildroot/runtime/_hdl_build, then
buildroot/runtime) RELATIVE TO CWD, so this gate builds a complete throwaway probe tree under
/tmp/nx_envelope_audit_gate/ and chdirs into it. Nothing here touches a production path, nothing shares a
fixture with a beat, and the fixtures are rebuilt every run so the gate is idempotent -- a gate that is
not idempotent reports on its first run and lies about every run after.
The fixture SOURCES are assembled at RUNTIME, never stored as files in the tree, because a detector that
scans source will otherwise find its own test fixture -- and writing the pattern in a comment re-arms
that trap, since prose is source bytes too.
SUBJECT: the DEPLOYED nx_envelope_audit elf (serving root, then _offc, then a local _build). If none
resolves the gate SKIPs via gv_need -- "I could not look" is not "it is broken".
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_gatekit_lib.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
| 29 | const EG_DIR: *u8 = "/tmp/nx_envelope_audit_gate" |
| 30 | const EG_BR: *u8 = "/tmp/nx_envelope_audit_gate/buildroot" |
| 31 | const EG_RT: *u8 = "/tmp/nx_envelope_audit_gate/buildroot/runtime" |
| 32 | const EG_HDL: *u8 = "/tmp/nx_envelope_audit_gate/buildroot/runtime/_hdl_build" |
| 33 | const EG_CONF: *u8 = "/tmp/nx_envelope_audit_gate/f.conf" |
| 34 | const EG_SMALL: *u8 = "/tmp/nx_envelope_audit_gate/small.conf" |
| 35 | const EG_HUGE: *u8 = "/tmp/nx_envelope_audit_gate/huge.conf" |
| 36 | const EG_O1: *u8 = "/tmp/nx_envelope_audit_gate/o1.log" |
| 37 | const EG_O2: *u8 = "/tmp/nx_envelope_audit_gate/o2.log" |
| 38 | const EG_O3: *u8 = "/tmp/nx_envelope_audit_gate/o3.log" |
| 40 | const EG_S1: *u8 = "/tmp/nx_envelope_audit_gate/buildroot/runtime/_hdl_build/egsilent.nx" |
| 41 | const EG_S2: *u8 = "/tmp/nx_envelope_audit_gate/buildroot/runtime/_hdl_build/egdecl.nx" |
| 42 | const EG_S3: *u8 = "/tmp/nx_envelope_audit_gate/buildroot/runtime/_hdl_build/egcmt.nx" |
| 43 | const EG_S4: *u8 = "/tmp/nx_envelope_audit_gate/buildroot/runtime/_hdl_build/egplain.nx" |
| 45 | const EG_SUBJ1: *u8 = "/volume1/homes/elderwesto/nishihost/nx_envelope_audit.elf" |
| 46 | const EG_SUBJ2: *u8 = "/volume1/homes/elderwesto/nishihost/_offc/nx_envelope_audit.elf" |
| 47 | const EG_SUBJ3: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/_build/nx_envelope_audit.sov.elf" |
| 59 | const EG_N_SILENT: i64 = 1200 |
| 60 | const EG_N_DECL: i64 = 7 |
| 61 | const EG_N_CMT: i64 = 5 |
| 62 | const EG_N_PLAIN: i64 = 3 |
| 63 | const EG_N_MISS: i64 = 2 |
| 66 | const EG_N_SMALL: i64 = 2 |
| 68 | const EG_N_HUGE: i64 = 14000 |
| 70 | const EG_CAPBUF: i64 = 1048576 |
| 71 | const EG_CONFBUF: i64 = 2097152 |
| 72 | const EG_PATHB: i64 = 512 |
| 73 | const EG_TAB: i64 = 9 |
| 74 | const EG_NL: i64 = 10 |
| 75 | const EG_HASH: i64 = 35 |
functions
| 77 | func eg_wr(path: *u8, buf: *u8, n: i64) -> i64 |
| 87 | func eg_row(b: *u8, o: i64, nm: *u8, idx: i64, base: *u8) -> i64 |
| 99 | func eg_rows(b: *u8, o: i64, nm: *u8, base: *u8, cnt: i64) -> i64 calls 1: eg_row |
| 106 | func eg_hashrow(b: *u8, o: i64) -> i64 calls 1: gk_cat |
| 116 | func eg_num_after(buf: *u8, n: i64, needle: *u8) -> i64 |
| 133 | func eg_last_line_is(buf: *u8, n: i64, want: *u8) -> i64 calls 1: gk_len |
| 152 | func main(argc: i64, argv: *i64) -> i64 |