code wiki / _hdl_build / nx_domain_admit_lib.nx
nx_domain_admit_lib.nx
buildroot/runtime/_hdl_build/nx_domain_admit_lib.nx
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
imports: nx_syscalls.nxnx_deploy_lib.nxnx_evattest.nx
imported by: nx_domain_admit.nxnx_domain_admit_gate.nx
structs
| none |
consts
| 56 | const DA_SCAP: i64 = 8388608 |
| 57 | const DA_PATH: i64 = 512 |
| 58 | const DA_NL: i64 = 10 |
| 59 | const DA_PIPE: i64 = 124 |
| 60 | const DA_HASH: i64 = 35 |
| 66 | const DA_CDIRS: *u8 = "buildroot/knowledge/compare/" |
| 73 | const DA_GATESDIR: *u8 = "knowledge/compare/" |
| 74 | const DA_GATESSUF: *u8 = ".gates" |
| 77 | const DA_BITEPFX: *u8 = "knowledge/status/bite_" |
| 78 | const DA_BITESUF: *u8 = ".verdict" |
| 79 | const DA_ELFSUF: *u8 = ".elf" |
| 80 | const DA_EQ: i64 = 61 |
| 81 | const DA_D0: i64 = 48 |
| 82 | const DA_D9: i64 = 57 |
| 83 | const DA_DOT: i64 = 46 |
| 84 | const DA_VCAP: i64 = 4096 |
| 454 | const DA_EVPFX: *u8 = "knowledge/status/evclass_" |
| 455 | const DA_EVSUF: *u8 = ".conf" |
| 456 | const DA_EVCAND: *u8 = ".conf.UNSIGNED-CANDIDATE" |
| 457 | const DA_KEYREG: *u8 = "knowledge/attest_keys.conf" |
| 458 | const DA_KEYCAP: i64 = 65536 |
| 459 | const DA_C5_ABSENT: i64 = 0 |
| 460 | const DA_C5_UNSIGNED: i64 = 1 |
| 461 | const DA_C5_SIGNED: i64 = 2 |
| 462 | const DA_C5_REFUSED: i64 = 3 |
| 466 | const DA_C5_PUBTAG: *u8 = " pub=" |
| 467 | const DA_C5_SIGTAG: *u8 = " sig=" |
| 468 | const DA_C5_PUBHEX: i64 = 64 |
| 469 | const DA_C5_SIGHEX: i64 = 128 |
| 638 | const DA_STAMPPFX: *u8 = "knowledge/status/evstamp_" |
| 639 | const DA_STAMPSUF: *u8 = ".verdict" |
| 644 | const DA_BOARDDIR: *u8 = "knowledge/compare/" |
| 655 | const DA_BOARDDIR2: *u8 = "buildroot/knowledge/compare/" |
| 656 | const DA_BOARDMAT: *u8 = ".matrix" |
| 657 | const DA_BOARDAXES: *u8 = ".axes" |
| 658 | const DA_STAMPCAP: i64 = 4096 |
| 659 | const DA_SLASH: i64 = 47 |
| 660 | const DA_C6A_ABSENT: i64 = 0 |
| 661 | const DA_C6A_HONEST: i64 = 1 |
| 662 | const DA_C6A_RED: i64 = 2 |
| 663 | const DA_C6A_BLIND: i64 = 3 |
| 664 | const DA_C6B_NOT_IN_SET: i64 = 0 |
| 665 | const DA_C6B_IN_SET: i64 = 1 |
functions
| 86 | func da_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 87 | func da_w(s: *u8) -> i64 { sys_write(1, s, da_slen(s)); return 0 } |
| 88 | func da_wn(base: *u8, off: i64, len: i64) -> i64 { sys_write(1, ((base as i64)+off) as *u8, len); return 0 } |
| 89 | func da_n(v: i64) -> i64 |
| 102 | func da_cat(dst: *u8, pos: i64, s: *u8) -> i64 |
| 111 | func da_isword(c: i64) -> i64 |
| 122 | func da_wfind(buf: *u8, n: i64, ned: *u8, na: i64, nl: i64) -> i64 |
| 141 | func da_eol(buf: *u8, n: i64, i: i64) -> i64 |
| 147 | func da_sl_eq(buf: *u8, a: i64, b: i64, lit: *u8) -> i64 |
| 156 | func da_symstart(mb: *u8, sa: i64, p3: i64) -> i64 |
| 163 | func da_try(org: *u8, oa: i64, ob: i64, sb: *u8, pfx: i64) -> i64 |
| 180 | func da_read_organ(org: *u8, oa: i64, ob: i64, sb: *u8) -> i64 |
| 209 | func da_classify_row(mb: *u8, p1: i64, p2: i64, p3: i64, sb: *u8) -> i64 |
| 233 | func da_count_lines(b: *u8, n: i64) -> i64 |
| 241 | func da_hasline(hay: *u8, hn: i64, ned: *u8, off: i64, len: i64) -> i64 |
| 263 | func da_tenths(s: *u8, a: i64, b: i64) -> i64 |
| 285 | func da_kv(buf: *u8, n: i64, key: *u8) -> i64 |
| 315 | func da_read_at(d: *u8, dom: *u8, suf: *u8, sb: *u8, cap: i64) -> i64 |
| 323 | func da_read_2dir(d1: *u8, d2: *u8, dom: *u8, suf: *u8, sb: *u8, cap: i64) -> i64 |
| 328 | func da_gates_read(dom: *u8, sb: *u8) -> i64 { return da_read_2dir(DA_GATESDIR, DA_CDIRS, dom, DA_GATESSUF, sb, DA_SCAP - 4) } |
| 340 | func da_c4_partition(gb: *u8, gn: i64, bitepfx: *u8, out: *i64) -> i64 |
| 405 | func da_c4(dom: *u8, sb: *u8) -> i64 |
| 472 | func da_row_has(b: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 481 | func da_row_class(b: *u8, s: i64, e: i64) -> i64 |
| 492 | func da_row_signed_shape(b: *u8, s: i64, e: i64) -> i64 |
| 511 | func da_c5_classify(b: *u8, n: i64, keys: *u8, kn: i64, loadable: i64, out: *i64) -> i64 |
| 567 | func da_c5(dom: *u8, sb: *u8) -> i64 |
| 670 | func da_kv_den(buf: *u8, n: i64, key: *u8) -> i64 |
| 711 | func da_c6a_classify(sbuf: *u8, sn: i64, matrix_rows: i64, out: *i64) -> i64 |
| 730 | func da_boardset_in(d: *u8, dom: *u8, sb: *u8) -> i64 |
| 735 | func da_c6b_boardset(dom: *u8, sb: *u8) -> i64 |
| 741 | func da_c6(dom: *u8, sb: *u8, matrix_rows: i64) -> i64 |