nx_compare_refs_gate.nx
buildroot/runtime/nx_compare_refs_gate.nx
about
nx_compare_refs_gate.nx -- THE CITATIONS REGISTER GATE: /compare's research-paper references are
MEASURED, never trusted. Subject: every knowledge/compare/<dom>.refs row (schema width, key
uniqueness, url shape, mirror EXISTENCE on disk, content-pin agreement via the promoted nx_filehash
ruler) plus every inline [@key] cite in the sibling .matrix and .plan resolving to a declared key.
Born from a real catch (2026-08-17): a venue-name collision put Walter's EGSR paper on the Ray
Tracing symposium page -- a plausible mirror claim only verification killed. This gate makes that
class mechanical where it can be (existence, pins, dead cites). DECLARED IMPRECISION: whether a
mirror page's TOPIC matches the citation stays a human read; the gate cannot see venue semantics.
Composition: nx_atlas_cite is the atlas lane's precheck over the atlas blueprint schema; this
register has its own 9-field schema, so the gate shares the LAW, not the parser -- and it composes
the estate's hash ruler (fork ./nx_filehash.elf) for pins rather than rolling a second one.
dependencies 3 imports · 0 importers
imports: nx_gate_verdict.nxnx_tool_run.nxnx_mirrorintegrity_lib.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 18 | const CRG_CAP: i64 = 262144 |
| 19 | const CRG_KMAX: i64 = 64 |
| 20 | const CRG_KLEN: i64 = 64 |
| 23 | const CRG_REF_MINROW: i64 = 12 |
| 24 | const CRG_DIRBUF: i64 = 65536 |
| 25 | const CRG_PATH: i64 = 600 |
| 26 | const CRG_TMO_MS: i64 = 30000 |
| 27 | const CRG_HASHCAP: i64 = 4096 |
| 41 | const CRG_PROV_PATH: *u8 = "knowledge/status/fetch_provenance.jrnl" |
| 42 | const CRG_PROV_RATCHET: *u8 = "knowledge/status/refs_provenance_ratchet.conf" |
| 43 | const CRG_PROV_WORKLIST: *u8 = "knowledge/status/refs_provenance_unproven.txt" |
| 44 | const CRG_PROV_UFIELD: i64 = 2 |
| 45 | const CRG_PROV_MFIELD: i64 = 3 |
| 46 | const CRG_PROV_MINROW: i64 = 8 |
| 50 | const CRG_REDIR_WORKLIST: *u8 = "knowledge/status/refs_redirected.txt" |
| 51 | const CRG_REDIR_RATCHET: *u8 = "knowledge/status/refs_redirected_ratchet.conf" |
| 52 | const CRG_REDIR_SNAP: *u8 = "knowledge/status/refs_redirected.at_baseline.txt" |
| 59 | const CRG_OPEN_WORKLIST: *u8 = "knowledge/status/refs_redirect_open.txt" |
| 60 | const CRG_OPEN_RATCHET: *u8 = "knowledge/status/refs_redirect_open_ratchet.conf" |
| 61 | const CRG_OPEN_SNAP: *u8 = "knowledge/status/refs_redirect_open.at_baseline.txt" |
| 72 | const CRG_MIR_RATCHET: *u8 = "knowledge/status/refs_mirror_ratchet.conf" |
| 73 | const CRG_MIR_WORKLIST: *u8 = "knowledge/status/refs_mirror_incomplete.txt" |
| 387 | const CRG_PROV_HFIELD: i64 = 6 |
| 455 | const CRG_CANON_HEAD: i64 = 16384 |
| 456 | const CRG_CANON_TAGSPAN: i64 = 512 |
| 457 | const CRG_CANON_URLCAP: i64 = 2048 |
| 458 | const CRG_MOVED_WORKLIST: *u8 = "knowledge/status/refs_moved.txt" |
| 459 | const CRG_MOVED_RATCHET: *u8 = "knowledge/status/refs_moved_ratchet.conf" |
| 460 | const CRG_MOVED_SNAP: *u8 = "knowledge/status/refs_moved.at_baseline.txt" |
| 462 | const CRG_CANON_RC_TRUNC: i64 = 2 |
| 466 | const CRG_CANON_RC_OGONLY: i64 = 3 |
| 468 | const CRG_NUL_SLACK: i64 = 16 |
| 470 | const CRG_CANON_BITE_LEAD: i64 = 1024 |
| 472 | const CRG_CANON_BITE_SLACK: i64 = 4096 |
| 474 | const CRG_BITE_FILL_BYTE: i64 = 120 |
| 477 | const CRG_REBASELINE_BYTE: i64 = 114 |
| 780 | const CRG_PROV_SNAP: *u8 = "knowledge/status/refs_provenance_unproven.at_baseline.txt" |
| 781 | const CRG_MIR_SNAP: *u8 = "knowledge/status/refs_mirror_incomplete.at_baseline.txt" |
functions
| 75 | func crg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 76 | func crg_read(path: *u8, buf: *u8, cap: i64) -> i64 { |
| 104 | func crg_split(s: *u8, fld: *i64, maxf: i64) -> i64 { |
| 115 | func crg_streq(a: *u8, b: *u8) -> i64 { |
| 121 | func crg_has(hay: *u8, hn: i64, needle: *u8) -> i64 { |
| 135 | func crg_pin_ok(mirror: *u8, pinhex: *u8) -> i64 { |
| 153 | func crg_mir_row(wfd: i64, refs: *u8, key: *u8, mir: *u8, rc: i64, size: i64, decl: i64) -> i64 { |
| 176 | func crg_scan(path: *u8, _cbuf: *u8, cap: i64, keys: *u8, kmax: i64, st: *i64) -> i64 { |
| 285 | func crg_keychar(c: i64) -> i64 |
| 294 | func crg_marks(path: *u8, _cbuf: *u8, cap: i64, keys: *u8, nk: i64, mst: *i64, cited: *u8) -> i64 { |
| 340 | func rp_domname(p: *u8) -> *u8 { |
| 350 | func crg_prov_index(buf: *u8, n: i64, uoff: *i64, moff: *i64) -> i64 { |
| 388 | func crg_prov_hops(buf: *u8, moff: *i64, rows: i64, mirror: *u8) -> i64 |
| 408 | func crg_prov_state(buf: *u8, uoff: *i64, moff: *i64, rows: i64, url: *u8, mirror: *u8) -> i64 { |
| 423 | func crg_num_parse(s: *u8) -> i64 { |
| 435 | func crg_num_fmt(dst: *u8, v: i64) -> i64 { |
| 478 | func crg_bfind(buf: *u8, n: i64, from: i64, needle: *u8) -> i64 |
| 492 | func crg_tag_attr(buf: *u8, s: i64, e: i64, attr: *u8, out: *u8, cap: i64) -> i64 |
| 515 | func crg_tag_span_attr(hbuf: *u8, n: i64, c: i64, attr: *u8, out: *u8) -> i64 |
| 546 | func crg_read_head(path: *u8, buf: *u8, cap: i64) -> i64 |
| 562 | func crg_canon_of_mirror(mirror: *u8, hbuf: *u8, out: *u8) -> i64 |
| 583 | func crg_url_skip(u: *u8) -> i64 |
| 592 | func crg_url_canon(u: *u8, p: i64, l: i64, out: *u8) -> i64 |
| 606 | func crg_url_norm_eq(a: *u8, b: *u8) -> i64 |
| 617 | func crg_prov_pass(path: *u8, _cbuf: *u8, cap: i64, pv: *i64) -> i64 { |
| 758 | func crg_w(path: *u8, s: *u8) -> i64 { |
| 783 | func crg_snap(src: *u8, dst: *u8) -> i64 { |
| 798 | func crg_nlines(b: *u8, n: i64) -> i64 { |
| 809 | func crg_nlcount_file(path: *u8) -> i64 |
| 815 | func crg_attrib(cur: *u8, snap: *u8, tag: *u8, bar: i64) -> i64 { |
| 882 | func cr_canonical_moved(cl: i64, canon: *u8, url: *u8) -> i64 |
| 888 | func main() -> i64 { |