code wiki / (root) / nx_confdup.nx

nx_confdup.nx

buildroot/runtime/nx_confdup.nx

21091 B531 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_confdup.nx -- find CONFIG FILES THAT DECLARE THE SAME CONCERN TWICE. WHY THIS EXISTS (measured 2026-07-30, media-vault lane): /api/promote reads `knowledge/organ_kinds.conf` (PLURAL, values hyphenated `one-shot`) while nx_organkind reads `knowledge/status/organ_kind.conf` (SINGULAR, values unhyphenated `oneshot`). I added a row to the singular file, promote kept working, and I concluded the row was the fix -- it was INERT. Undeclared names fall through to a name-substring heuristic, so the wrong file "worked" by luck until a name that failed the heuristic (nx_mvault_walk) became unshippable by any sanctioned route. ★★★LAW: A SILENTLY-INERT CONFIG ROW IS WORSE THAN A MISSING ONE -- it manufactures false confidence. The failure is invisible precisely because the other source of truth keeps answering. This is a RECURRING class in this ecosystem, not a one-off: * organ_kind.conf vs organ_kinds.conf (this session) * nx_fs root=nishihost vs /api/build buildroot/runtime -- TWO ROOTS ONE NAME * the ruler reading the wrong evidence root (rollup saw 181 of 1164 logs) So it gets a DETECTOR rather than another banked warning. WHAT IT FLAGS -- two independent signals, reported separately because they have different remedies: COLLIDE-STEM two config files whose names normalize to the SAME stem (plural/singular, hyphen/underscore, trailing digits). Remedy: one file, or make one provably derived. COLLIDE-BASE the SAME basename living under two different directories. Remedy: name the roots apart, or collapse them. Normalization is deliberately AGGRESSIVE (drop ext, lowercase, '-'->'_', strip trailing digits/underscores, strip ONE trailing plural 's') because a false positive costs a glance while a false negative costs a session. nx_confdup scan [root] (default root: knowledge) Read-only. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_confdup.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main 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 ↻ sys_openat_rd sys_getdents64 dirent_reclen dirent_type dirent_name cd_join cd_cat cd_ch cd_is_conf cd_len cd_norm cd_len ↻ sys_close cd_cat ↻ cd_udec sys_mmap ↻ sys_munmap cd_ch ↻ cd_streq cd_basename cd_len ↻ cd_rowdups cd_read sys_openat_rd ↻

structs

none

consts

39const CD_MAGIC_2048: i64 = 2048
41const CD_QCAP: i64 = 1048576 // dir-queue arena
42const CD_DIRBUF: i64 = 262144 // getdents buffer
43const CD_ARENA: i64 = 1048576 // path + stem text arena
44const CD_MAXFILES: i64 = 8192 // bounded, and the cap is REPORTED not silent
45const CD_PATH: i64 = 4096
46const CD_STEM: i64 = 256
47const CD_OUT: i64 = 1048576
48const CD_FBUF: i64 = 1048576 // per-file read buffer for the COLLIDE-ROW pass
49const CD_MAXROWS: i64 = 16384 // bounded, and the cap is REPORTED not silent
50const CD_KEY: i64 = 160
51const CD_UNIQPCT: i64 = 90 // a file is "unique-key shaped" when >=90% of its rows carry a distinct key

functions

53func cd_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
55func cd_cat(dst: *u8, off: i64, s: *u8) -> i64
62func cd_ch(dst: *u8, off: i64, c: i64) -> i64 { dst[off] = c as u8; return off + 1 }
64func cd_udec(dst: *u8, off: i64, v: i64) -> i64
called by 2: cd_rowdupsmain calls 2: sys_mmapsys_munmap
78func cd_join(dst: *u8, dir: *u8, name: *u8) -> i64
called by 1: main calls 2: cd_catcd_ch
87func cd_basename(p: *u8) -> *u8
called by 1: main calls 1: cd_len
99func cd_is_conf(name: *u8) -> i64
called by 1: main calls 1: cd_len
113func cd_norm(dst: *u8, name: *u8) -> i64
called by 1: main calls 1: cd_len
154func cd_streq(a: *u8, b: *u8) -> i64
called by 2: cd_rowdupsmain
178func cd_read(path: *u8, buf: *u8, cap: i64) -> i64
194func cd_rowdups(path: *u8, fbuf: *u8, keyoff: *i64, keyline: *i64, keytaken: *i64,
340func main(argc: i64, argv: *i64) -> i64