code wiki / _hdl_build / nx_assure.nx

nx_assure.nx

buildroot/runtime/_hdl_build/nx_assure.nx

20810 B431 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_assure.nx -- WORLD-CLASS ASSURANCE RULER (worldclass-assurance lane, 2026-07-24). Operator: "we need to get to the point our system is world class -- DARPA/NASA/Linux-level and above." That is not a vibe, it is a CHECKABLE STANDARD. This organ scores the real .nx corpus against a subset of the NASA/JPL "Power of Ten" rules for safety-critical code (Holzmann 2006) that are mechanically decidable on NishiLang, emits per-rule violation counts, every violation LOCATABLE (file:fn), and an honest corpus permille. CYNICAL BY CONSTRUCTION (the author-optimism law): a rule that cannot be mechanically decided is declared NOT-CHECKED and counts as NEITHER pass nor fail -- the headline can never inflate by claiming credit for what it did not measure. CHECKED (sound, non-gameable): R1 no self-recursion -- fn body calls its own name (P10 rule 1: no recursion) R2 bounded loops -- no `while true` / `while 1` (P10 rule 2) R3 no dynamic alloc inside a loop -- no sys_mmap lexically inside a `while` (P10 rule 3; THIS is the per-iteration-mmap OOM class banked across sessions -- the single highest-value mechanical check) R4 function length <= AS_MAXLEN lines -- (P10 rule 4: short functions) G gate coverage -- every organ-with-main has a _gate/_test sibling (Nishi assurance: fresh-compile-run is the only judge, so a shippable organ WITHOUT a gate is unproven) NOT-CHECKED (declared, never scored as pass): R5 assertion density, R6 minimal scope, R7 checked returns, R8 preprocessor (NishiLang has none -- N/A), R9 single-deref pointers, R10 zero warnings (nx_cc builds clean by construction -- reproducible-build ruler is a separate arc). verbs: audit [dir] (default runtime/_hdl_build) | selftest license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_assure.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 as_audit sys_mmap sys_openat_rd w sys_write sys_getdents64 slen as_name_ok scontains sfind slen ↻ as_base as_pack as_read sys_openat_rd ↻ sys_close sys_read scontains ↻ sfind ↻ as_fnend as_fnname sfind ↻ as_recurses as_bodystart sfind ↻ sys_mmap ↻ sfind ↻ as_unbounded scontains ↻ as_mmap_in_loop sys_mmap ↻ sfind ↻ as_lines wn w ↻ sys_mmap ↻ sys_write ↻ sys_close ↻ as_inpack

structs

none

consts

28const AS_FCAP: i64 = 262144
29const AS_DCAP: i64 = 65536
30const AS_TCAP: i64 = 65536 // one extracted function (organs have big fns)
31const AS_PATHCAP: i64 = 256
32const AS_MAXLEN: i64 = 75 // P10-R4 line budget
33const AS_ZERO: i64 = 48
34const AS_NAMES: i64 = 4096 // main-organ base-name table
35const AS_NAMEBUF: i64 = 131072

functions

37func 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 3: wnas_auditas_selftest calls 1: sys_write
38func wn(v: i64) -> i64
51func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
52func sfind(hay: *u8, hn: i64, needle: *u8, from: i64) -> i64
65func scontains(h: *u8, hn: i64, n: *u8) -> i64 { if sfind(h, hn, n, 0) >= 0 { return 1 } return 0 }
66func as_read(path: *u8, buf: *u8, cap: i64) -> i64
81func as_fnend(b: *u8, n: i64, at: i64) -> i64
called by 1: as_audit
101func as_fnname(t: *u8, tn: i64, nb: *u8) -> i64
called by 2: as_auditas_selftest calls 1: sfind
111func as_bodystart(t: *u8, tn: i64) -> i64 { return sfind(t, tn, "{" as *u8, 0) }
called by 1: as_recurses calls 1: sfind
114func as_recurses(t: *u8, tn: i64, name: *u8, nl: i64) -> i64
141func as_unbounded(t: *u8, tn: i64) -> i64
called by 2: as_auditas_selftest calls 1: scontains
151func as_mmap_in_loop(t: *u8, tn: i64) -> i64
called by 2: as_auditas_selftest calls 2: sys_mmapsfind
191func as_lines(t: *u8, tn: i64) -> i64
called by 1: as_audit
208func as_pack(dst: *u8, o: i64, s: *u8, n: i64) -> i64
called by 1: as_audit
214func as_inpack(pk: *u8, pn: i64, s: *u8, sn: i64) -> i64
called by 1: as_audit
225func as_base(nm: *u8, nl: i64, nb: *u8) -> i64
called by 2: as_auditas_selftest
236func as_name_ok(nm: *u8, nl: i64) -> i64
called by 1: as_audit calls 1: scontains
246func as_audit(dir: *u8) -> i64
384func as_selftest() -> i64
416func main(argc: i64, argv: *i64) -> i64