code wiki / (root) / nx_regdup.nx

nx_regdup.nx

buildroot/runtime/nx_regdup.nx

10810 B292 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_regdup.nx -- DUPLICATE-KEY DETECTOR FOR ANY TSV REGISTRY. Fail-closed, additive, general. WHY. On 2026-08-07 the papers registry carried the identifier RT-012 TWICE, on two different manuscripts, and `nx_papers_index` rendered both sections without complaint -- so the live page published a collision as authority. That is this estate's own banked law: ★★★★★★ A GENERATED INDEX INHERITS ITS REGISTRY'S ERRORS AND LAUNDERS THEM AS AUTHORITY. The generator was not wrong; nothing was CHECKING. And the same session added a THIRD collision, because its author declared an id free after reading WINDOWS of the registry instead of enumerating it ⇒ ★★★★★★ A SAMPLE OF A FILE CANNOT ESTABLISH THAT A KEY IS FREE. ONLY AN ENUMERATION CAN. WHY A SEPARATE ORGAN AND NOT AN EDIT TO nx_papers_index. Measured the same day: the LOCAL and NAS copies of that organ have FORKED -- the local source emits a different page design than the one actually served. Editing the local copy and promoting it would have silently regressed the live page's design while "fixing" a duplicate. So this is additive: it adds an invariant nothing checked before, touches no serving organ, and can regress nothing by construction. ⚠It is NOT a second ruler for an existing invariant (that would be the duplicate-ruler defect) -- no organ in this estate checked registry key uniqueness at all. GENERAL ON PURPOSE. Every plane here is key-first TSV, and at least one other is known defective: the clockjobs plane is recorded at 67 rows over 50 distinct names, i.e. 17 surplus, where the LIVE row is the OLDEST because the registrar is idempotent-by-name. One ruler, every registry. nx_regdup check <registry.tsv> [keycol] exit 0 UNIQUE · 1 DUPLICATES · 3 unreadable nx_regdup selftest license_tier: ORIGINAL No hardware writes (Rule 26).

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_regdup.nx

imports: nx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main rd_err sys_write sys_exit rd_streq rd_selftest 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 ↻ rd_fx_dup rd_len rd_fx_clean rd_scan sys_mmap ↻ rd_eol rd_field rd_puts sys_write ↻ rd_range_eq sys_write ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

29const RD_CAP: i64 = 1048576
30const RD_MAXROWS: i64 = 8192
31const RD_EXIT_USAGE: i64 = 2
32const RD_EXIT_UNREADABLE: i64 = 3
33const RD_TAB: i64 = 9
34const RD_NL: i64 = 10

functions

36func rd_err(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 }
called by 1: main calls 1: sys_write
37func rd_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: rd_scanrd_check calls 1: sys_write
38func rd_streq(a: *u8, b: *u8) -> i64
called by 1: main
44func rd_atoi(s: *u8) -> i64
called by 1: main
54func rd_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: rd_selftest
55func rd_read(path: *u8, buf: *u8, cap: i64) -> i64
69func rd_eol(buf: *u8, n: i64, i: i64) -> i64
called by 1: rd_scan
78func rd_field(buf: *u8, ls: i64, le: i64, k: i64, out: *i64) -> i64
called by 1: rd_scan
98func rd_range_eq(buf: *u8, a: *i64, b: *i64) -> i64
called by 1: rd_scan
110func rd_scan(buf: *u8, n: i64, keycol: i64, res: *i64, verbose: i64) -> i64
176func rd_check(path: *u8, keycol: i64) -> i64
207func rd_fx_dup() -> *u8
called by 1: rd_selftest
210func rd_fx_clean() -> *u8
called by 1: rd_selftest
214func rd_selftest() -> i64
269func main(argc: i64, argv: *i64) -> i64