code wiki / _hdl_build / nx_domain_admit_lib.nx

nx_domain_admit_lib.nx

buildroot/runtime/_hdl_build/nx_domain_admit_lib.nx

43192 B770 linesdepth 10pulls 14 transitivereach 2 importersview sourcekind librarytopic domain
docsdependenciesstructsconstsfunctions

about

nx_domain_admit_lib.nx -- THE PURE DECISION CORE OF nx_domain_admit, THE /compare ADMISSION GATE. WHY THIS FILE EXISTS AT ALL. nx_domain_admit decides whether a /compare domain may publish, and on 2026-08-25 the ship loop reported for it: "PROVE NO-GATE-FOUND -- a NAMED absence, NOT a pass: NOTHING about this target has been proven." The organ that refuses on everyone else's behalf had nothing proven about itself, on a day it shipped TWO changes (C3 both-tree gates resolution, C4 fresh-kill from the bite records). A GATE COULD NOT HAVE BEEN WRITTEN AGAINST THE ORGAN AS IT STOOD. nx_domain_admit is a top-level programme, so nothing can import it; and a gate that fork/execs the deployed elf is NOT mutation-provable -- the harness rebuilds the TEST and not the SUBJECT, so every mutant returns NOT-REACHED and the resulting GREEN reads exactly like a proof while proving nothing. Extracting the decision core into a library that sits INSIDE the gate's build closure is what makes the proof possible at all. THIS IS A MOVE, NOT A COPY. Every function below was CUT from nx_domain_admit.nx, which now imports this file. There is still exactly ONE word-boundary ruler, ONE row classifier, ONE bite-record reader and ONE gates-map resolver in the estate. A second copy would be the duplicate-ruler defect wearing a test's clothes, and the two would drift the moment either was fixed. WHY THIS FILE LIVES IN _hdl_build/ AND NOT IN runtime/ BESIDE THE OTHER LIBS -- MEASURED, NOT CHOSEN. The first draft was written to buildroot/runtime/ and the build FAILED with twelve "there are two definitions of dp_read/dp_len/dep_run/..." errors. nx_deploy_lib.nx exists TWICE in this estate -- buildroot/runtime/nx_deploy_lib.nx and buildroot/runtime/_hdl_build/nx_deploy_lib.nx (5,655 B) -- and imports resolve RELATIVE TO THE IMPORTING FILE, so the organ in _hdl_build/ and a library in runtime/ each pulled in a DIFFERENT nx_deploy_lib and the compiler saw every dp_* symbol twice. A SHARED DEPENDENCY THAT EXISTS AS TWO TWINS IS DEDUPED BY PATH, NOT BY NAME: a library and its consumer must sit in the same tree or their common import is textually included twice. The compiler refused loudly, which is the good failure -- had it silently picked one, the organ would have changed which dp_read it runs without a single line of its own code moving. TWO THINGS WERE EXTRACTED RATHER THAN MOVED, and each removes a real duplicate: da_read_2dir / da_gates_read -- C3 (in main) and C4 (in da_c4) EACH built the <domain>.gates path and EACH tried the two trees. That second copy is precisely how the 2026-08-25 defect survived: the 2026-08-20 repoint moved the MATRIX read to the publishing tree and did not move its sibling, so has_gates read 0 for every domain in the estate. ONE resolver, called twice, cannot half-move. da_c4_partition -- the bucket arithmetic, separated from path resolution so it can be measured against a fixture instead of against the live gate fleet. A gate that shares a fixture with a production beat measures the beat and not the code. 100 percent sovereign. No hardware writes (Rule 26). license_tier: ORIGINAL

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_deploy_lib.nx nx_evattest.nx nx_domain_admit_lib.nx nx_domain_admit.nx nx_domain_admit_gate.nx

imports: nx_syscalls.nxnx_deploy_lib.nxnx_evattest.nx

imported by: nx_domain_admit.nxnx_domain_admit_gate.nx

structs

none

consts

56const DA_SCAP: i64 = 8388608
57const DA_PATH: i64 = 512
58const DA_NL: i64 = 10
59const DA_PIPE: i64 = 124
60const DA_HASH: i64 = 35
66const DA_CDIRS: *u8 = "buildroot/knowledge/compare/"
73const DA_GATESDIR: *u8 = "knowledge/compare/"
74const DA_GATESSUF: *u8 = ".gates"
77const DA_BITEPFX: *u8 = "knowledge/status/bite_"
78const DA_BITESUF: *u8 = ".verdict"
79const DA_ELFSUF: *u8 = ".elf"
80const DA_EQ: i64 = 61
81const DA_D0: i64 = 48
82const DA_D9: i64 = 57
83const DA_DOT: i64 = 46
84const DA_VCAP: i64 = 4096
454const DA_EVPFX: *u8 = "knowledge/status/evclass_"
455const DA_EVSUF: *u8 = ".conf"
456const DA_EVCAND: *u8 = ".conf.UNSIGNED-CANDIDATE"
457const DA_KEYREG: *u8 = "knowledge/attest_keys.conf"
458const DA_KEYCAP: i64 = 65536
459const DA_C5_ABSENT: i64 = 0
460const DA_C5_UNSIGNED: i64 = 1
461const DA_C5_SIGNED: i64 = 2
462const DA_C5_REFUSED: i64 = 3
466const DA_C5_PUBTAG: *u8 = " pub="
467const DA_C5_SIGTAG: *u8 = " sig="
468const DA_C5_PUBHEX: i64 = 64
469const DA_C5_SIGHEX: i64 = 128
638const DA_STAMPPFX: *u8 = "knowledge/status/evstamp_"
639const DA_STAMPSUF: *u8 = ".verdict"
644const DA_BOARDDIR: *u8 = "knowledge/compare/"
655const DA_BOARDDIR2: *u8 = "buildroot/knowledge/compare/"
656const DA_BOARDMAT: *u8 = ".matrix"
657const DA_BOARDAXES: *u8 = ".axes"
658const DA_STAMPCAP: i64 = 4096
659const DA_SLASH: i64 = 47
660const DA_C6A_ABSENT: i64 = 0
661const DA_C6A_HONEST: i64 = 1
662const DA_C6A_RED: i64 = 2
663const DA_C6A_BLIND: i64 = 3
664const DA_C6B_NOT_IN_SET: i64 = 0
665const DA_C6B_IN_SET: i64 = 1

functions

86func da_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
87func da_w(s: *u8) -> i64 { sys_write(1, s, da_slen(s)); return 0 }
88func da_wn(base: *u8, off: i64, len: i64) -> i64 { sys_write(1, ((base as i64)+off) as *u8, len); return 0 }
called by 4: da_c1da_c7da_ratchetmain calls 1: sys_write
89func da_n(v: i64) -> i64
102func da_cat(dst: *u8, pos: i64, s: *u8) -> i64
111func da_isword(c: i64) -> i64
called by 2: mainda_wfind
122func da_wfind(buf: *u8, n: i64, ned: *u8, na: i64, nl: i64) -> i64
141func da_eol(buf: *u8, n: i64, i: i64) -> i64
147func da_sl_eq(buf: *u8, a: i64, b: i64, lit: *u8) -> i64
156func da_symstart(mb: *u8, sa: i64, p3: i64) -> i64
called by 4: da_c1da_c7_walkmainmain calls 1: da_sl_eq
163func da_try(org: *u8, oa: i64, ob: i64, sb: *u8, pfx: i64) -> i64
called by 1: da_read_organ calls 3: sys_mmapda_catdp_read
180func da_read_organ(org: *u8, oa: i64, ob: i64, sb: *u8) -> i64
called by 1: da_classify_row calls 1: da_try
209func da_classify_row(mb: *u8, p1: i64, p2: i64, p3: i64, sb: *u8) -> i64
233func da_count_lines(b: *u8, n: i64) -> i64
241func da_hasline(hay: *u8, hn: i64, ned: *u8, off: i64, len: i64) -> i64
called by 4: da_c7da_ratchetdg_hasmain calls 1: da_eol
263func da_tenths(s: *u8, a: i64, b: i64) -> i64
called by 3: da_c7dg_tenthsmain
285func da_kv(buf: *u8, n: i64, key: *u8) -> i64
315func da_read_at(d: *u8, dom: *u8, suf: *u8, sb: *u8, cap: i64) -> i64
323func da_read_2dir(d1: *u8, d2: *u8, dom: *u8, suf: *u8, sb: *u8, cap: i64) -> i64
called by 2: mainda_gates_read calls 1: da_read_at
328func da_gates_read(dom: *u8, sb: *u8) -> i64 { return da_read_2dir(DA_GATESDIR, DA_CDIRS, dom, DA_GATESSUF, sb, DA_SCAP - 4) }
called by 3: mainmainda_c4 calls 1: da_read_2dir
340func da_c4_partition(gb: *u8, gn: i64, bitepfx: *u8, out: *i64) -> i64
405func da_c4(dom: *u8, sb: *u8) -> i64
472func da_row_has(b: *u8, s: i64, e: i64, lit: *u8) -> i64
481func da_row_class(b: *u8, s: i64, e: i64) -> i64
492func da_row_signed_shape(b: *u8, s: i64, e: i64) -> i64
511func da_c5_classify(b: *u8, n: i64, keys: *u8, kn: i64, loadable: i64, out: *i64) -> i64
567func da_c5(dom: *u8, sb: *u8) -> i64
670func da_kv_den(buf: *u8, n: i64, key: *u8) -> i64
711func da_c6a_classify(sbuf: *u8, sn: i64, matrix_rows: i64, out: *i64) -> i64
called by 2: mainda_c6 calls 2: da_kvda_kv_den
730func da_boardset_in(d: *u8, dom: *u8, sb: *u8) -> i64
called by 2: mainda_c6b_boardset calls 1: da_read_at
735func da_c6b_boardset(dom: *u8, sb: *u8) -> i64
called by 1: da_c6 calls 1: da_boardset_in
741func da_c6(dom: *u8, sb: *u8, matrix_rows: i64) -> i64