code wiki / _hdl_build / nx_magicratchet.nx

nx_magicratchet.nx

buildroot/runtime/_hdl_build/nx_magicratchet.nx

7353 B174 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_magicratchet.nx -- F881 MAGIC-NUMBER RATCHET (the enforcement the operator demanded 2026-07-21: catch me at submission, not by re-sweeping). A build must NOT INCREASE an organ's inline-magic-number count vs its stored baseline. First build self-baselines (grandfathers existing violations); a build that ADDS a magic number is REFUSED. Non-breaking (existing organs build), unbypassable (wired into /api/build), fail-OPEN on any count/read uncertainty (a false refusal would be worse than a miss). Counting is DELEGATED to `nx_law_warden countfile` -- ONE canonical L001 counter, no divergent reimplementation. Rule-11 CLEAN itself (named consts, no inline magic). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_estr.nx nx_tool_run.nx nx_magicratchet.nx

imports: nx_syscalls.nxnx_estr.nxnx_tool_run.nx

imported by: nobody (leaf or entry point)

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

main es_puts sys_write es_len sys_exit sys_mmap es_cat tr_run_capture sys_mmap ↻ sys_pipe2 sys_fork sys_close sys_dup3 sys_execve_clean sys_close ↻ sys_execve sys_exit ↻ sys_read sys_wait4 wait_exit_code mr_parse_magic sys_mkdir mr_read_int sys_openat_rd sys_mmap ↻ sys_read ↻ sys_close ↻ es_catn sys_mmap ↻ mr_write_int sys_mmap ↻ es_catn ↻ sys_openat_wr sys_write ↻ sys_close ↻

structs

none

consts

12const MR_CAPBUF: i64 = 4096
13const MR_SMALLBUF: i64 = 64
14const MR_ARGVN: i64 = 64
15const MR_MODE: i64 = 0x1a4
16const MR_DIRMODE: i64 = 0x1ed
17const MR_REFUSE: i64 = 3
18const MR_FEEDBUF: i64 = 8192
19const MR_MAPCAP: i64 = 1600 // bounded embed of nx_magic map output (keeps the refusal under the mgmt read cap)

functions

22func mr_parse_magic(buf: *u8, n: i64) -> i64
called by 1: main
48func mr_read_int(path: *u8) -> i64
64func mr_write_int(path: *u8, v: i64) -> i64
76func main(argc: i64, argv: *i64) -> i64