code wiki / (root) / nx_nxeconform_gate.nx

nx_nxeconform_gate.nx

buildroot/runtime/nx_nxeconform_gate.nx

33664 B672 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_gate_verdict.nx nx_sha256.nx nx_nxeconform_gate.nx

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

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 ↻ sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close gv_need gv_puts ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

41const NXC_CONF_DEFAULT: *u8 = "knowledge/registry/nxe_layouts.conf" as *u8
42const NXC_HASH: i64 = 35 // hash sign -- built as a value: the nx_cc lexer rejects it inside a literal
43const NXC_PIPE: i64 = 124 // pipe
44const NXC_NL: i64 = 10 // newline
45const NXC_SLASH: i64 = 47 // slash
46const NXC_MAGIC_BYTES: i64 = 4 // an NXE magic is 4 bytes: the format says so, not a tuning knob
47const NXC_DIGIT_LO: i64 = 48 // ASCII zero -- the magic's 4th byte is a VERSION DIGIT
48const NXC_DIGIT_HI: i64 = 57 // ASCII nine
49const NXC_FIELD_MAX: i64 = 10 // widest row grammar (LAYOUT) has 10 fields
52const NXC_K_SHA256: i64 = 1
53const NXC_K_DJB2: i64 = 2
54const NXC_K_SUM64: i64 = 3
55const NXC_SHA256_BYTES: i64 = 32
56const NXC_DJB2_SEED: i64 = 5381 // the djb2 constants are the ALGORITHM, not tunables
57const NXC_DJB2_SHIFT: i64 = 5
58const NXC_WORD: i64 = 8 // text_off / text_size are 8-byte little-endian in EVERY layout
61const NXC_DIR_FRONTIER_MAX: i64 = 4096
62const NXC_PATH_ARENA_BYTES: i64 = 4194304
63const NXC_SCRATCH: i64 = 512

functions

66func nxc_cp(src: *u8, o: i64, n: i64, dst: *u8, cap: i64) -> i64
called by 1: main
76func nxc_streq(a: *u8, b: *u8) -> i64
called by 1: main
90func nxc_num(src: *u8, o: i64, n: i64) -> i64
called by 1: main
106func nxc_m32(m: *u8, o: i64) -> i64
called by 2: nxc_classifymain
110func nxc_r64(m: *u8, o: i64) -> i64
123func nxc_head(path: *u8, buf: *u8, want: i64, szp: *i64) -> i64
152func nxc_djb2(m: *u8, off: i64, n: i64) -> i64
called by 1: nxc_integ_ok
159func nxc_sum64(m: *u8, off: i64, n: i64) -> i64
called by 1: nxc_integ_ok calls 1: nxc_r64
166func nxc_integ_ok(ab: *u8, asz: i64, toff: i64, tsz: i64, kind: i64, hoff: i64, hlen: i64) -> i64
188func nxc_fields(buf: *u8, pos: i64, e: i64, fo: *i64, fl: *i64) -> i64
called by 1: main
208func nxc_classify(m: *u8, mav: i64, msz: i64, nlay: i64, lmag: *i64, lhdr: *i64, loft: *i64, lofs: *i64, midx: *i64) -> i64
called by 1: main calls 2: nxc_m32nxc_r64
235func nxc_join(dst: *u8, dir: *u8, name: *u8) -> i64
called by 1: main
246func nxc_is_dot(n: *u8) -> i64
called by 1: main
253func main(argc: i64, argv: *i64) -> i64