code wiki / _hdl_build / nx_memfix.nx

nx_memfix.nx

buildroot/runtime/_hdl_build/nx_memfix.nx

10969 B244 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_memfix.nx -- repair PROVABLY-SAFE dangling links in the laptop-local memory corpus. CONVERTED TO nx_memplane_lib 2026-08-06. It now owns only what is specific to it: the normalised name index and the two repair classes. The scanner, name table, walk and dump list come from the lib, because six hand-copies of those drifted and the drift was the bug. SEPARATE ORGAN FROM nx_memhealth ON PURPOSE: the instrument stays read-only, so a repair bug can never corrupt the measurement that would reveal it. ★★★★★★ A WRONG LINK IS WORSE THAN A DEAD ONE -- A DEAD LINK FAILS LOUDLY WHEN FOLLOWED, A WRONG LINK SILENTLY DELIVERS A DIFFERENT MEMORY. So repair is restricted to the classes where the answer is unique and mechanical, and everything else is reported, never guessed: A DOUBLE-EXTENSION -- target ends ".md.md" and stripping one ".md" names an existing file (5) B NORMALISED-EXACT -- differs from exactly ONE file by case/punctuation/WHITESPACE (19/26 occ) ★ class B is not renames: it is LINKS WRAPPED ACROSS TWO LINES, where the author's markdown wrapped and the newline landed inside the target. The intent is unambiguous and the file is right there; only the whitespace is wrong. C unique-substring (29/53) · D ambiguous (14/26) · E absent (121/292) -- ALL REPORT-ONLY. Class E cannot be repaired at all: those files were DELETED, not renamed (only 2 of 37 legacy names resolve), so "repairing" them would fabricate the doctrine they cite. ⚠ DUMPS ARE SKIPPED (added at conversion). The derived artefacts are regenerated wholly on each run, so rewriting links inside them is churn that the next regeneration discards -- and it would count toward the repair total, inflating a number that is supposed to mean "authored corpus fixed". SAFETY: dry-run by default; a .bak-memfix copy written BEFORE each file is touched; atomic tmp+renameat install; refuses any target whose normalised form matches more than one file; the replacement is always the literal name of a file that exists right now. usage: nx_memfix [--dir <memdir>] [--apply] [--list] exit: 0 = clean or repaired; 1 = a write failed Sovereign: imports nx_memplane_lib. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_memplane_lib.nx nx_memfix.nx

imports: nx_memplane_lib.nx

imported by: nobody (leaf or entry point)

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

main mp_streq mp_scan sys_openat_rd 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 ↻ mp_is_md mp_len mp_nameptr sys_close mp_put mp_nameptr ↻ mp_hashr mp_len ↻ mp_cat mp_say mp_write_all sys_write ↻ mp_nameptr ↻ mf_nput mf_hashnorm mp_len ↻ mp_is_dump mp_streq ↻ mp_join mp_readf sys_openat_rd ↻

structs

none

consts

35const MF_DIR: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder/memory"
36const MF_FBUF: i64 = 1048576
37const MF_OBUF: i64 = 2097152
38const MF_MSG: i64 = 8192

functions

42func mf_hashnorm(p: *u8, n: i64) -> i64
called by 1: main
63func mf_nput(nk: *i64, nv: *i64, h: i64, idx: i64) -> i64
called by 1: main
74func mf_nget(nk: *i64, nv: *i64, h: i64) -> i64
called by 1: main
87func main(argc: i64, argv: *i64) -> i64