code wiki / _hdl_build / nx_envelope_audit.nx

nx_envelope_audit.nx

buildroot/runtime/_hdl_build/nx_envelope_audit.nx

21076 B330 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_envelope_audit.nx -- F227 THE SCALE-ENVELOPE SWEEP (operator scale-law: "every tool DECLARES its envelope IN ITS OUTPUT -- silent capping is forbidden BY CONSTRUCTION"; editcover row 3 silent-truncation). A bounded read that never says it was bounded is how a seat (any model) silently believes a partial answer is the whole answer -- the ark v1 lesson and the nx_debt 64KB blind spot were both this class. This organ MEASURES the law across the fleet a seat can actually CALL (the registered tool_allowlist rows -- not all ~15k .nx, that is the honest scope: an unregistered organ cannot mislead an agent). PER ROW: resolve the source from the elf basename -> probe buildroot/runtime/_hdl_build/<base>.nx then buildroot/runtime/<base>.nx -> classify: DECLARING = source carries an envelope-declaration marker (envelope | caps: | window_bytes) SILENT-CAP-CAND = has bounded-read consts (_CAP / _MAX) but NO declaration <- the actionable set UNBOUNDED-OR-NA = no bounded-read consts found (nothing to declare, or reads are unbounded) NAME-PROBE-MISS = no <elfbase>.nx in either probe dir. NOT proof of missing source: a tool's elf and source names can DIVERGE (verified 07-20: nx_fs_write.elf builds from nx_fsops_write.nx). Treat as 'not found BY NAME PROBE' and verify by content before ever claiming a source is lost. LIAR-KILLED: this is a CANDIDATE detector over source text, never an absolute verdict -- the output says so, and it reports counts + the candidate list so a human/referee adjudicates. Measurement first; a ratchet floor comes only AFTER a measured baseline (never a gate on an unmeasured fleet). 2026-08-20 (lane K, failure-detector census) -- THE SILENT-CAP DETECTOR HAD A SILENT CAP. A row-cap gate wrapped the whole per-row body and the row counter only incremented INSIDE it, so every allowlist row past the cap was dropped with no counter, no flag and no marker -- and the dogfood line then printed the cap as a HAND-TYPED literal, which read as a population. MEASURED: the served binary reported rows=512 against a tool_allowlist.conf of 81243 bytes whose line 906 exists, i.e. it published a distribution over the HEAD of a sorted file and called it the fleet. ***THE ENFORCER COMMITTED THE DEFECT IT ENFORCES, AND ITS OWN OUTPUT WAS THE ALIBI.*** FIXED HERE: (1) the row gate is REMOVED -- nothing was indexed by the row counter, so the cap bounded only wall time and bought nothing; (2) every remaining bound is now DERIVED from its own const and printed, never re-typed in prose (a hand-typed copy of a cap is a second copy of that cap's shape and the two drift silently); (3) each capped LIST says it is a prefix of its own count; (4) the partition is printed and reconciled; (5) an incomplete audit exits EA_EXIT_PARTIAL instead of publishing a confident distribution -- the nx_undefscan rule that a zero from an incomplete scan must still exit non-zero. DOGFOOD: declares its OWN envelope in its own output, every field derived from the constant it bounds. nx_envelope_audit [allowlist] [outpath] license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_envelope_audit.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main 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 ↻ ea_read sys_openat_rd sys_read sys_close ea_werr sys_write ↻ ea_slen sys_exit ↻ ea_puts ea_has_code ea_slen ↻ ea_puti sys_mmap ↻ sys_write ↻ sys_openat_wr sys_close ↻ sys_renameat

structs

none

consts

37const EA_ALLOW: *u8 = "tool_allowlist.conf" as *u8
38const EA_OUT: *u8 = "knowledge/status/envelope_audit.log" as *u8
39const EA_D1: *u8 = "buildroot/runtime/_hdl_build/" as *u8
40const EA_D2: *u8 = "buildroot/runtime/" as *u8
41const EA_ALLOWCAP: i64 = 262144
42const EA_SRCCAP: i64 = 262144
43const EA_REPCAP: i64 = 131072
44const EA_MAXLIST: i64 = 64
48const EA_TAILRESERVE: i64 = 1024
51const EA_EXIT_PARTIAL: i64 = 5
52const EA_NL: i64 = 10
53const EA_TAB: i64 = 9
54const EA_HASH: i64 = 35
55const EA_SLASH: i64 = 47
56const EA_DOT: i64 = 46
57const EA_MODE: i64 = 0x1a4
58const EA_STDOUT: i64 = 1
59const EA_STDERR: i64 = 2
60const EA_PATHCAP: i64 = 512
61const EA_NAMECAP: i64 = 256

functions

63func ea_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
64func ea_werr(s: *u8) -> i64 { sys_write(EA_STDERR, s, ea_slen(s)); return 0 }
called by 1: main calls 2: sys_writeea_slen
65func ea_puts(b: *u8, off: i64, s: *u8) -> i64 { var o: i64 = off; var j: i64 = 0; while s[j] != (0 as u8) { if o < EA_REPCAP - 8 { b[o] = s[j]; o = o + 1 } j = j + 1 } return o }
called by 1: main
66func ea_puti(b: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
78func ea_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
87func ea_has(buf: *u8, n: i64, needle: *u8) -> i64
calls 1: ea_slen
116func ea_has_code(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: ea_slen
139func main(argc: i64, argv: *i64) -> i64