code wiki / _hdl_build / nx_assure.nx
nx_assure.nx
buildroot/runtime/_hdl_build/nx_assure.nx
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
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
structs
| none |
consts
| 28 | const AS_FCAP: i64 = 262144 |
| 29 | const AS_DCAP: i64 = 65536 |
| 30 | const AS_TCAP: i64 = 65536 // one extracted function (organs have big fns) |
| 31 | const AS_PATHCAP: i64 = 256 |
| 32 | const AS_MAXLEN: i64 = 75 // P10-R4 line budget |
| 33 | const AS_ZERO: i64 = 48 |
| 34 | const AS_NAMES: i64 = 4096 // main-organ base-name table |
| 35 | const AS_NAMEBUF: i64 = 131072 |
functions
| 37 | func w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 38 | func wn(v: i64) -> i64 |
| 51 | func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 52 | func sfind(hay: *u8, hn: i64, needle: *u8, from: i64) -> i64 |
| 65 | func scontains(h: *u8, hn: i64, n: *u8) -> i64 { if sfind(h, hn, n, 0) >= 0 { return 1 } return 0 } |
| 66 | func as_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 81 | func as_fnend(b: *u8, n: i64, at: i64) -> i64 called by 1: as_audit |
| 101 | func as_fnname(t: *u8, tn: i64, nb: *u8) -> i64 |
| 111 | func as_bodystart(t: *u8, tn: i64) -> i64 { return sfind(t, tn, "{" as *u8, 0) } |
| 114 | func as_recurses(t: *u8, tn: i64, name: *u8, nl: i64) -> i64 |
| 141 | func as_unbounded(t: *u8, tn: i64) -> i64 |
| 151 | func as_mmap_in_loop(t: *u8, tn: i64) -> i64 |
| 191 | func as_lines(t: *u8, tn: i64) -> i64 called by 1: as_audit |
| 208 | func as_pack(dst: *u8, o: i64, s: *u8, n: i64) -> i64 called by 1: as_audit |
| 214 | func as_inpack(pk: *u8, pn: i64, s: *u8, sn: i64) -> i64 called by 1: as_audit |
| 225 | func as_base(nm: *u8, nl: i64, nb: *u8) -> i64 |
| 236 | func as_name_ok(nm: *u8, nl: i64) -> i64 |
| 246 | func as_audit(dir: *u8) -> i64 |
| 384 | func as_selftest() -> i64 |
| 416 | func main(argc: i64, argv: *i64) -> i64 |