nx_regdup.nx
buildroot/runtime/nx_regdup.nx
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
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
structs
| none |
consts
| 29 | const RD_CAP: i64 = 1048576 |
| 30 | const RD_MAXROWS: i64 = 8192 |
| 31 | const RD_EXIT_USAGE: i64 = 2 |
| 32 | const RD_EXIT_UNREADABLE: i64 = 3 |
| 33 | const RD_TAB: i64 = 9 |
| 34 | const RD_NL: i64 = 10 |
functions
| 36 | func 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 } |
| 37 | func 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 } |
| 38 | func rd_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 44 | func rd_atoi(s: *u8) -> i64 called by 1: main |
| 54 | func 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 |
| 55 | func rd_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 69 | func rd_eol(buf: *u8, n: i64, i: i64) -> i64 called by 1: rd_scan |
| 78 | func rd_field(buf: *u8, ls: i64, le: i64, k: i64, out: *i64) -> i64 called by 1: rd_scan |
| 98 | func rd_range_eq(buf: *u8, a: *i64, b: *i64) -> i64 called by 1: rd_scan |
| 110 | func rd_scan(buf: *u8, n: i64, keycol: i64, res: *i64, verbose: i64) -> i64 |
| 176 | func rd_check(path: *u8, keycol: i64) -> i64 |
| 207 | func rd_fx_dup() -> *u8 called by 1: rd_selftest |
| 210 | func rd_fx_clean() -> *u8 called by 1: rd_selftest |
| 214 | func rd_selftest() -> i64 |
| 269 | func main(argc: i64, argv: *i64) -> i64 |