code wiki / _hdl_build / nx_gate_mutation_probe.nx

nx_gate_mutation_probe.nx

buildroot/runtime/_hdl_build/nx_gate_mutation_probe.nx

22444 B540 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind probetopic gate
docsdependenciesstructsconstsfunctions

about

nx_gate_mutation_probe.nx -- SOVEREIGN MUTATION TESTING of gate sensor power (the SOTA ruler). Grounding (fetched live 2026-07-14 via nx_https_get, en.wikipedia.org/wiki/Mutation_testing): "the mutation score is the number of mutants killed / total number of mutants"; goal #1 = "identify weakly tested pieces of code (mutants not killed)". Lineage: Lipton 1971, DeMillo/Lipton/Sayward 1978, Budd 1980. RULER = industry-standard; TOOL = GREENFIELD on NishiLang (PIT=JVM, mutmut=Py, Mull=LLVM -- none run here) => sovereign-built, guarded by internal liar-killers per [[feedback-3rd-party-proving-for-nonnovel]]. TWO MODES: (no args) CURATED v1: fixed pair (runtime/nx_handoff_gate.nx x its proof gate), 6 hand-designed killable mutants -> GREEN iff 6/6 killed. This is the REGRESSION GATE on the sensor stack's power (baseline-wrapped). <subject> <gate> [budget] GENERIC v2: ANY lib x gate pair (naming law nx_X / nx_X_gate). Auto-generates mutants with classic operators (ROR: < > <= >= == != ; AOR: + -) at sites OUTSIDE comments/strings (region mask -- mutating a comment is a guaranteed FALSE survivor), evenly spread over the file. Survivors are reported as FINDINGS (op + line) = the liar-killer worklist; score is DATA (verdict = pipeline soundness, not score). ⚠kills assume the gate is idempotent (re-run-stable). LIAR-KILLERS ON THE PROBE ITSELF (both modes): * IDENTITY CONTROL -- an unmutated copy MUST stay GREEN (pipeline introduces no fault; models the equivalent-mutant honesty case). Identity RED => all results VOID. * NEEDLE/SITE-NOT-FOUND = RED -- never silently skip. * import needle is BUILT AT RUNTIME as `import "<subject>.nx"` (quote bytes composed) so a comment mentioning the filename can never eat the splice (the v1 trap, killed generally). * signal-aware rc decode (128+sig). NEVER-BRICK: originals READ-ONLY; only __mutprobe_* copies written, then ARCHIVED to knowledge/mutprobe/. Sovereign nx_cc->nxasm; CWD=nxc2 root. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

syscalls.nx runtime.nx nx_syscalls.nx nx_gate_mutation_probe.nx

imports: syscalls.nxruntime.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main run_generic print strlen print_i64 itoa sys_mmap mp_cat mp_read sys_openat_rd sys_read sys_close sys_exit mp_splice mp_find mp_slen mp_slen ↻ mp_write sys_openat_wr sys_write sys_close ↻ mp_mask mp_scan mp_tok_at mp_slen ↻ mp_slen ↻ mp_archive sys_mkdir sys_renameat mp_run_lane sys_openat_wr ↻ sys_mmap ↻ sys_fork nx_setsid nx_prlimit sys_dup3 sys_execve sys_exit ↻ sys_wait4 nx_kill

structs

none

consts

37const MP_MUTANT_DEADLINE_MS: i64 = 180000 // wall-clock ceiling per mutant run
38const MP_POLL_MS: i64 = 250 // liveness poll interval (WNOHANG)
39const MP_MUTANT_CPU_S: i64 = 240 // RLIMIT_CPU: a spinner dies even if wall-clock is generous
40const MP_MUTANT_AS_BYTES: i64 = 4294967296 // RLIMIT_AS 4GiB: a mutated size allocates, then FAILS -- not the host
41const K_MAGIC_1048576: i64 = 1048576

functions

43func mp_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
45func mp_cat(dst: *u8, off: i64, s: *u8) -> i64
called by 1: run_generic
51func mp_read(path: *u8, buf: *u8, cap: i64) -> i64
66func mp_write(path: *u8, buf: *u8, len: i64) -> i64
74func mp_find(hay: *u8, hlen: i64, needle: *u8) -> i64
called by 1: mp_splice calls 1: mp_slen
90func mp_splice(hay: *u8, hlen: i64, needle: *u8, repl: *u8, out: *u8) -> i64
called by 2: run_genericmain calls 2: mp_findmp_slen
105func mp_line_of(src: *u8, off: i64) -> i64
called by 1: run_generic
116func mp_mask(src: *u8, len: i64, mark: *u8) -> i64
called by 1: run_generic
146func mp_tok_at(src: *u8, len: i64, mark: *u8, i: i64, tok: *u8) -> i64
called by 1: mp_scan calls 1: mp_slen
159func mp_scan(src: *u8, len: i64, mark: *u8, toks: *i64, nops: i64, sites: *i64, ops: *i64, maxs: i64) -> i64
called by 1: run_generic calls 2: mp_tok_atmp_slen
182func mp_run_lane(envp: *i64) -> i64
252func mp_archive() -> i64
260func run_generic(subject: *u8, gatename: *u8, budget: i64) -> i64
417func main(argc: i64, argv: *i64) -> i64