code wiki / _hdl_build / nx_debt_audit.nx

nx_debt_audit.nx

buildroot/runtime/_hdl_build/nx_debt_audit.nx

6471 B133 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic debt
docsdependenciesstructsconstsfunctions

about

nx_debt_audit.nx -- the ANTI-SILENT-DEBT auditor (operator: audit from the hardware layer up as part of security/racing/triage -- catch hacking, working-around, silent technical debt; S-class-exceed discipline everywhere). SOVEREIGN organ replacing the borrowed bench/nx_debt_audit.sh (the audit retires its OWN shell debt = dogfood). Two mechanical checks, hardware-up: 1. LEDGER DISCIPLINE: every QUAL/QUANT row in NISHI_DEBT_LEDGER.tsv must carry a tracked plan (a non-empty later column) -- a debt row with no plan = SILENT debt. 2. MARKER SCAN: scan a source for the silent-debt signal words (HACK, WORKAROUND, FIXME, XXX, "for now", TODO without a row ref) -- a marker is fine IF the file is named in the ledger (tracked) -- an UNTRACKED marker = a workaround nobody logged. A workaround is ALLOWED (landmines exist) -- a workaround that is NOT TRACKED is the violation. Durable: DEBTAUDIT rows + verdict -> knowledge/status/debt_audit.log. Exit 0 = no silent debt. argv[1]=ledger override argv[2]=source-to-scan (optional). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_debt_audit.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 _p sys_write sys_openat_append sys_exit sys_mmap da_read sys_openat_rd sys_read sys_close _fp sys_write ↻ da_ledger da_slice_has da_len _fp ↻ _fn sys_mmap ↻ sys_write ↻ da_markers sys_mmap ↻ da_slice_has ↻ _fp ↻ _fn ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_close ↻

structs

none

consts

16const K_MAGIC_1048576: i64 = 1048576
17const K_MAGIC_1048560: i64 = 1048560
18const K_MAGIC_2097152: i64 = 2097152
19const K_MAGIC_2097136: i64 = 2097136

functions

20func _p(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
21func _fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 3: da_ledgerda_markersmain calls 1: sys_write
22func _fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 2: da_ledgermain calls 2: sys_mmapsys_write
23func da_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: da_slice_has
24func da_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
33func da_slice_has(hay: *u8, a: i64, b: i64, pat: *u8) -> i64
called by 2: da_ledgerda_markers calls 1: da_len
47func da_ledger(buf: *u8, n: i64, lfd: i64) -> i64
called by 1: main calls 3: da_slice_has_fp_fn
82func da_markers(buf: *u8, n: i64, name: *u8, lfd: i64) -> i64
called by 1: main calls 3: sys_mmapda_slice_has_fp
102func main(argc: i64, argv: *i64) -> i64