nx_nxeconform_gate.nx
buildroot/runtime/nx_nxeconform_gate.nx
about
nx_nxeconform_gate.nx -- NXE FORMAT CONFORMANCE (constitution A2: NXE, NOT ELF).
THE DEFECT THIS EXISTS TO MAKE UNSHIPPABLE (measured 2026-08-15, full population, 23,181 files):
NXE had forked into THREE on-disk layouts across TWO magics -- NXE1@80 (the prototype the rule-15 DRY
extraction left behind), NXE1@96 (the live lane, and F103a's own witness for C01/C02/C11), and
NXE0@64 with a WRAPPING SUM for the kernel image. Nobody was counting, because no instrument counted.
* A FORKED FORMAT OUTLIVES THE CODE THAT FORKED IT, BECAUSE THE ARTIFACTS PERSIST.
* A LAW THAT MUST BE RECALLED AT THE MOMENT OF TEMPTATION IS NOT A CONTROL; ONLY A MECHANISM IN
THE PATH IS -- so this is a gate, not another paragraph.
SUBJECT: every NXE artifact ON DISK under the declared roots, classified against the declared layouts.
It reads BYTES, never source prose -- a scanner that reads comments measures the documentation.
NO HARDCODED NUMBERS: every offset, header size, magic and baseline is a row in
knowledge/registry/nxe_layouts.conf (rule 11). The layout/root tables are sized from the conf's OWN
line count, so even the table capacity is derived rather than guessed.
NO SAMPLING: the roots are swept RECURSIVELY and IN FULL; getdents64 is looped until it returns 0
(one call is not a directory listing), and the single genuine bound -- the directory frontier --
REFUSES at its cap instead of silently truncating (a cap reached in silence becomes a measurement
nobody knows is partial).
HONEST THIRD STATE: absent conf, zero declared layouts or zero artifacts end the run SKIP via gv_need,
never GREEN and never RED -- "I could not look" is not "I looked and it is fine".
RATCHET, NOT PERFECTION: three layouts exist TODAY, so a gate demanding one would be permanently RED
and everyone would learn to ignore it. The declared-layout count and the weak-integrity count are
ratchets that may only FALL. Convergence = delete a LAYOUT row and lower its RATCHET in one edit.
THE IMPRECISION I CHOSE TO LIVE WITH, stated so the next reader does not mistake this for exact:
(1) A ratchet baseline is DECLARED, so adding a LAYOUT row and raising its RATCHET in the same edit
passes. That is deliberate -- the gate's job is to make a widening VISIBLE in the diff and
impossible to do by accident, not to prevent a considered decision.
(2) The population is artifacts ON DISK under the declared roots. An NXE emitted somewhere no ROOT
row covers is outside the claim; that is why the roots are data and the sweep is exhaustive
within them. "0 undeclared" always means "0 undeclared, in what was swept".
argv[1] optionally overrides the conf path (pinned at registration). Exit 0 GREEN / 1 RED.
license_tier: ORIGINAL No hw writes (Rule 26): reads a conf + artifact bytes, writes stdout only.
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_sha256.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
| 41 | const NXC_CONF_DEFAULT: *u8 = "knowledge/registry/nxe_layouts.conf" as *u8 |
| 42 | const NXC_HASH: i64 = 35 // hash sign -- built as a value: the nx_cc lexer rejects it inside a literal |
| 43 | const NXC_PIPE: i64 = 124 // pipe |
| 44 | const NXC_NL: i64 = 10 // newline |
| 45 | const NXC_SLASH: i64 = 47 // slash |
| 46 | const NXC_MAGIC_BYTES: i64 = 4 // an NXE magic is 4 bytes: the format says so, not a tuning knob |
| 47 | const NXC_DIGIT_LO: i64 = 48 // ASCII zero -- the magic's 4th byte is a VERSION DIGIT |
| 48 | const NXC_DIGIT_HI: i64 = 57 // ASCII nine |
| 49 | const NXC_FIELD_MAX: i64 = 10 // widest row grammar (LAYOUT) has 10 fields |
| 52 | const NXC_K_SHA256: i64 = 1 |
| 53 | const NXC_K_DJB2: i64 = 2 |
| 54 | const NXC_K_SUM64: i64 = 3 |
| 55 | const NXC_SHA256_BYTES: i64 = 32 |
| 56 | const NXC_DJB2_SEED: i64 = 5381 // the djb2 constants are the ALGORITHM, not tunables |
| 57 | const NXC_DJB2_SHIFT: i64 = 5 |
| 58 | const NXC_WORD: i64 = 8 // text_off / text_size are 8-byte little-endian in EVERY layout |
| 61 | const NXC_DIR_FRONTIER_MAX: i64 = 4096 |
| 62 | const NXC_PATH_ARENA_BYTES: i64 = 4194304 |
| 63 | const NXC_SCRATCH: i64 = 512 |
functions
| 66 | func nxc_cp(src: *u8, o: i64, n: i64, dst: *u8, cap: i64) -> i64 called by 1: main |
| 76 | func nxc_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 90 | func nxc_num(src: *u8, o: i64, n: i64) -> i64 called by 1: main |
| 106 | func nxc_m32(m: *u8, o: i64) -> i64 |
| 110 | func nxc_r64(m: *u8, o: i64) -> i64 |
| 123 | func nxc_head(path: *u8, buf: *u8, want: i64, szp: *i64) -> i64 |
| 152 | func nxc_djb2(m: *u8, off: i64, n: i64) -> i64 called by 1: nxc_integ_ok |
| 159 | func nxc_sum64(m: *u8, off: i64, n: i64) -> i64 |
| 166 | func nxc_integ_ok(ab: *u8, asz: i64, toff: i64, tsz: i64, kind: i64, hoff: i64, hlen: i64) -> i64 |
| 188 | func nxc_fields(buf: *u8, pos: i64, e: i64, fo: *i64, fl: *i64) -> i64 called by 1: main |
| 208 | func nxc_classify(m: *u8, mav: i64, msz: i64, nlay: i64, lmag: *i64, lhdr: *i64, loft: *i64, lofs: *i64, midx: *i64) -> i64 |
| 235 | func nxc_join(dst: *u8, dir: *u8, name: *u8) -> i64 called by 1: main |
| 246 | func nxc_is_dot(n: *u8) -> i64 called by 1: main |
| 253 | func main(argc: i64, argv: *i64) -> i64 |