code wiki / _hdl_build / nx_gate_mutation_probe.nx
nx_gate_mutation_probe.nx
buildroot/runtime/_hdl_build/nx_gate_mutation_probe.nx
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
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
structs
| none |
consts
| 37 | const MP_MUTANT_DEADLINE_MS: i64 = 180000 // wall-clock ceiling per mutant run |
| 38 | const MP_POLL_MS: i64 = 250 // liveness poll interval (WNOHANG) |
| 39 | const MP_MUTANT_CPU_S: i64 = 240 // RLIMIT_CPU: a spinner dies even if wall-clock is generous |
| 40 | const MP_MUTANT_AS_BYTES: i64 = 4294967296 // RLIMIT_AS 4GiB: a mutated size allocates, then FAILS -- not the host |
| 41 | const K_MAGIC_1048576: i64 = 1048576 |
functions
| 43 | func mp_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 45 | func mp_cat(dst: *u8, off: i64, s: *u8) -> i64 called by 1: run_generic |
| 51 | func mp_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 66 | func mp_write(path: *u8, buf: *u8, len: i64) -> i64 |
| 74 | func mp_find(hay: *u8, hlen: i64, needle: *u8) -> i64 |
| 90 | func mp_splice(hay: *u8, hlen: i64, needle: *u8, repl: *u8, out: *u8) -> i64 |
| 105 | func mp_line_of(src: *u8, off: i64) -> i64 called by 1: run_generic |
| 116 | func mp_mask(src: *u8, len: i64, mark: *u8) -> i64 called by 1: run_generic |
| 146 | func mp_tok_at(src: *u8, len: i64, mark: *u8, i: i64, tok: *u8) -> i64 |
| 159 | func mp_scan(src: *u8, len: i64, mark: *u8, toks: *i64, nops: i64, sites: *i64, ops: *i64, maxs: i64) -> i64 |
| 182 | func mp_run_lane(envp: *i64) -> i64 |
| 252 | func mp_archive() -> i64 |
| 260 | func run_generic(subject: *u8, gatename: *u8, budget: i64) -> i64 |
| 417 | func main(argc: i64, argv: *i64) -> i64 |