code wiki / (root) / nx_toolreg_reap.nx

nx_toolreg_reap.nx

buildroot/runtime/nx_toolreg_reap.nx

7782 B168 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic toolreg
docsdependenciesstructsconstsfunctions

about

nx_toolreg_reap.nx -- REMOVE named scaffold rows from tool_allowlist.conf. The counterpart the registry never had: nx_toolreg_reconcile only ever ADDS (rows=830 registered=0 already=815), /api has a tools/register route and NO unregister, and nx_fs_write refuses the allowlist by construction -- correctly, since a tool that can EDIT the capability allowlist can GRANT ITSELF ANYTHING. So scaffold registrations accumulated forever with no sanctioned way to clear them (debt 1785976684). WHY THIS IS SAFE TO EXIST AT ALL, and why it is a separate organ rather than a verb on the registrar: this organ can ONLY REMOVE, never add and never rewrite a target. Removal is strictly DE-privileging -- the worst case is a tool stops being callable, which is a recoverable annoyance, whereas an organ that could add or repoint a row would be a privilege-granting oracle. Single responsibility is the security property here, not a style preference. FAIL-CLOSED PREDICATE: a row is reapable ONLY if its elf path ends in ".new" -- the staged-artifact shape that scaffold aliases have. A row pointing at a promoted ".elf" is REFUSED and reported, so a fat-fingered name can never unregister a live tool. Names are EXPLICIT: there is no wildcard sweep, because rows like nx_meshmerge_staged and nx_ccingest_r7 also point at .new and other seats depend on them. nx_toolreg_reap <name> [<name>...] | nx_toolreg_reap --list (show reapable rows, change nothing) license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_toolreg_reap.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 tr_w sys_write sys_mmap sys_openat_rd sys_exit sys_read sys_close tr_row_staged sys_write ↻ tr_name_is tr_slen tr_emit_field1 sys_write ↻ tr_wn sys_mmap ↻ sys_write ↻ sys_openat_wr sys_renameat

structs

none

consts

21const TR_CONF: *u8 = "tool_allowlist.conf"
22const TR_TMP: *u8 = "tool_allowlist.conf.reaptmp"
23const TR_CAP: i64 = 1048576
24const TR_MODE: i64 = 0x1a4
25const TR_MAXNAME: i64 = 128

functions

27func tr_w(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 1: main calls 1: sys_write
28func tr_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: tr_name_is
29func tr_wn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
37func tr_name_is(buf: *u8, ls: i64, le: i64, nm: *u8) -> i64
called by 1: main calls 1: tr_slen
47func tr_row_staged(buf: *u8, ls: i64, le: i64) -> i64
called by 1: main
64func tr_emit_field1(buf: *u8, ls: i64, le: i64) -> i64
called by 1: main calls 1: sys_write
76func main(argc: i64, argv: *i64) -> i64