code wiki / (root) / nx_compare_refs_gate.nx

nx_compare_refs_gate.nx

buildroot/runtime/nx_compare_refs_gate.nx

85018 B1415 linesdepth 5pulls 10 transitivereach 0 importersview sourcekind gate/prooftopic compare
docsdependenciesstructsconstsfunctions

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

nx_gate_verdict.nx nx_tool_run.nx nx_mirrorintegrity_lib.nx nx_compare_refs_gate.nx

imports: nx_gate_verdict.nxnx_tool_run.nxnx_mirrorintegrity_lib.nx

imported by: nobody (leaf or entry point)

structs

none

consts

18const CRG_CAP: i64 = 262144
19const CRG_KMAX: i64 = 64
20const CRG_KLEN: i64 = 64
23const CRG_REF_MINROW: i64 = 12
24const CRG_DIRBUF: i64 = 65536
25const CRG_PATH: i64 = 600
26const CRG_TMO_MS: i64 = 30000
27const CRG_HASHCAP: i64 = 4096
41const CRG_PROV_PATH: *u8 = "knowledge/status/fetch_provenance.jrnl"
42const CRG_PROV_RATCHET: *u8 = "knowledge/status/refs_provenance_ratchet.conf"
43const CRG_PROV_WORKLIST: *u8 = "knowledge/status/refs_provenance_unproven.txt"
44const CRG_PROV_UFIELD: i64 = 2
45const CRG_PROV_MFIELD: i64 = 3
46const CRG_PROV_MINROW: i64 = 8
50const CRG_REDIR_WORKLIST: *u8 = "knowledge/status/refs_redirected.txt"
51const CRG_REDIR_RATCHET: *u8 = "knowledge/status/refs_redirected_ratchet.conf"
52const CRG_REDIR_SNAP: *u8 = "knowledge/status/refs_redirected.at_baseline.txt"
59const CRG_OPEN_WORKLIST: *u8 = "knowledge/status/refs_redirect_open.txt"
60const CRG_OPEN_RATCHET: *u8 = "knowledge/status/refs_redirect_open_ratchet.conf"
61const CRG_OPEN_SNAP: *u8 = "knowledge/status/refs_redirect_open.at_baseline.txt"
72const CRG_MIR_RATCHET: *u8 = "knowledge/status/refs_mirror_ratchet.conf"
73const CRG_MIR_WORKLIST: *u8 = "knowledge/status/refs_mirror_incomplete.txt"
387const CRG_PROV_HFIELD: i64 = 6
455const CRG_CANON_HEAD: i64 = 16384
456const CRG_CANON_TAGSPAN: i64 = 512
457const CRG_CANON_URLCAP: i64 = 2048
458const CRG_MOVED_WORKLIST: *u8 = "knowledge/status/refs_moved.txt"
459const CRG_MOVED_RATCHET: *u8 = "knowledge/status/refs_moved_ratchet.conf"
460const CRG_MOVED_SNAP: *u8 = "knowledge/status/refs_moved.at_baseline.txt"
462const CRG_CANON_RC_TRUNC: i64 = 2
466const CRG_CANON_RC_OGONLY: i64 = 3
468const CRG_NUL_SLACK: i64 = 16
470const CRG_CANON_BITE_LEAD: i64 = 1024
472const CRG_CANON_BITE_SLACK: i64 = 4096
474const CRG_BITE_FILL_BYTE: i64 = 120
477const CRG_REBASELINE_BYTE: i64 = 114
780const CRG_PROV_SNAP: *u8 = "knowledge/status/refs_provenance_unproven.at_baseline.txt"
781const CRG_MIR_SNAP: *u8 = "knowledge/status/refs_mirror_incomplete.at_baseline.txt"

functions

75func crg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
76func crg_read(path: *u8, buf: *u8, cap: i64) -> i64 {
called by 1: crg_url_skip calls 2: gv_putsgv_num
104func crg_split(s: *u8, fld: *i64, maxf: i64) -> i64 {
115func crg_streq(a: *u8, b: *u8) -> i64 {
121func crg_has(hay: *u8, hn: i64, needle: *u8) -> i64 {
135func crg_pin_ok(mirror: *u8, pinhex: *u8) -> i64 {
153func crg_mir_row(wfd: i64, refs: *u8, key: *u8, mir: *u8, rc: i64, size: i64, decl: i64) -> i64 {
176func crg_scan(path: *u8, _cbuf: *u8, cap: i64, keys: *u8, kmax: i64, st: *i64) -> i64 {
285func crg_keychar(c: i64) -> i64
294func crg_marks(path: *u8, _cbuf: *u8, cap: i64, keys: *u8, nk: i64, mst: *i64, cited: *u8) -> i64 {
340func rp_domname(p: *u8) -> *u8 {
350func crg_prov_index(buf: *u8, n: i64, uoff: *i64, moff: *i64) -> i64 {
388func crg_prov_hops(buf: *u8, moff: *i64, rows: i64, mirror: *u8) -> i64
408func crg_prov_state(buf: *u8, uoff: *i64, moff: *i64, rows: i64, url: *u8, mirror: *u8) -> i64 {
423func crg_num_parse(s: *u8) -> i64 {
435func crg_num_fmt(dst: *u8, v: i64) -> i64 {
478func crg_bfind(buf: *u8, n: i64, from: i64, needle: *u8) -> i64
492func crg_tag_attr(buf: *u8, s: i64, e: i64, attr: *u8, out: *u8, cap: i64) -> i64
515func crg_tag_span_attr(hbuf: *u8, n: i64, c: i64, attr: *u8, out: *u8) -> i64
546func crg_read_head(path: *u8, buf: *u8, cap: i64) -> i64
562func crg_canon_of_mirror(mirror: *u8, hbuf: *u8, out: *u8) -> i64
583func crg_url_skip(u: *u8) -> i64
592func crg_url_canon(u: *u8, p: i64, l: i64, out: *u8) -> i64
606func crg_url_norm_eq(a: *u8, b: *u8) -> i64
617func crg_prov_pass(path: *u8, _cbuf: *u8, cap: i64, pv: *i64) -> i64 {
758func crg_w(path: *u8, s: *u8) -> i64 {
783func crg_snap(src: *u8, dst: *u8) -> i64 {
798func crg_nlines(b: *u8, n: i64) -> i64 {
809func crg_nlcount_file(path: *u8) -> i64
815func crg_attrib(cur: *u8, snap: *u8, tag: *u8, bar: i64) -> i64 {
882func cr_canonical_moved(cl: i64, canon: *u8, url: *u8) -> i64
888func main() -> i64 {