interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

GitHub aien-dev/omega-mv#204 (code only)

closed derived ba2b0cc115fcbd3e #204

Imported from GitHub aien-dev/omega-mv#204 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 2dc9dd8d964095c4dadeeb806cf6ec69a0061be3 · Head 7c0702c4123447eaad8c399fb658c291239a9d8b

Apply it

git checkout -b patch-ba2b0cc115fcbd3e 2dc9dd8d964095c4dadeeb806cf6ec69a0061be3
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/ba2b0cc115fcbd3e.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omega-mv
204
7c0702c4123447eaad8c399fb658c291239a9d8b
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":204,"url":"https://github.com/aien-dev/omega-mv/pull/204","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:46Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/tests/fixtures/mutation_runner/expected.json b/tests/fixtures/mutation_runner/expected.json
new file mode 100644
index 000000000..02b35ff57
--- /dev/null
+++ b/tests/fixtures/mutation_runner/expected.json
@@ -0,0 +1,9 @@
+{
+  "mutants": [
+    {"id": "K1", "file": "add.c", "checks": "addition is computed", "status": "KILLED", "note": "1 failing case(s), first: add"},
+    {"id": "S1", "file": "add.c", "checks": "clamp upper bound", "status": "SURVIVED", "note": "harness still PASS, no justification recorded"},
+    {"id": "S2", "file": "add.c", "checks": "clamp upper bound again", "status": "SURVIVED_REDUNDANT", "note": "redundant: covered by the caller, UNVERIFIED"},
+    {"id": "L1", "file": "add.c", "checks": "legacy gap row", "status": "SURVIVED_GAP", "note": "gap: legacy prose with quotes and back"},
+    {"id": "E1", "file": "add.c", "checks": "no-op edit", "status": "ERROR", "note": "edit did not apply"}
+  ]
+}
diff --git a/tests/test_mutation_runner.sh b/tests/test_mutation_runner.sh
new file mode 100755
index 000000000..4be5b81a1
--- /dev/null
+++ b/tests/test_mutation_runner.sh
@@ -0,0 +1,130 @@
+#!/bin/sh
+# Self-test of tools/mutation_runner.sh. Host only, CPU only, light. Builds a
+# tiny C project in a temp dir, runs the runner over fake mutants and checks
+# every verdict, the exit code and the JSON bytes. Each check can fail: the
+# always-passing test run and the corrupted expected file prove the self-test
+# notices a runner that reports the wrong thing.
+set -u
+root=$(cd "$(dirname "$0")/.." && pwd)
+runner=$root/tools/mutation_runner.sh
+expected=$root/tests/fixtures/mutation_runner/expected.json
+tmp=$(mktemp -d "${TMPDIR:-/tmp}/mutrun-selftest.XXXXXX") || exit 2
+trap 'rm -rf "$tmp"' EXIT INT TERM
+proj=$tmp/proj
+mkdir -p "$proj"
+cat > "$proj/add.c" <<'CEOF'
+int add(int a, int b) { return a + b; } /* MUT:ADD_PLUS */
+int clamp(int x) { return x>100?100:x; }
+int twice(int x) { return x; }
+CEOF
+cat > "$proj/check.c" <<'CEOF'
+#include <stdio.h>
+int add(int a, int b);
+int main(void) {
+    if (add(2, 3) != 5) { puts("FAIL add"); return 1; }
+    puts("PASS");
+    return 0;
+}
+CEOF
+BUILD='cc -o check check.c add.c'
+TEST=./check
+fails=0; checks=0
+ok() { checks=$((checks + 1)); if [ "$2" = 0 ]; then echo "ok   $1"; else echo "FAIL $1"; fails=$((fails + 1)); fi; }
+has() { grep -q -- "$2" "$1"; }   # file pattern
+
+# run <rowsfile-content> <extra args...>: sets rc, $tmp/err, $tmp/outp, $tmp/j.json
+run() {
+    rows=$1; shift
+    printf '%s\n' "$rows" > "$tmp/rows"
+    rm -f "$tmp/j.json"
+    "$runner" -m "$tmp/rows" -d "$proj" -o "$tmp/j.json" "$@" > "$tmp/outp" 2> "$tmp/err"
+    rc=$?
+}
+before=$(find "$proj" -type f | sort | xargs sha256sum | sha256sum)
+
+# (1) a mutant that breaks the code is KILLED, exit 0
+run 'K~add.c~s/a + b/a - b/~addition' -k table -t "$TEST" -b "$BUILD"
+[ $rc -eq 0 ] && has "$tmp/err" '^K KILLED'; ok "1 breaking mutant is KILLED, exit 0" $?
+
+# (2) a mutant the test cannot see SURVIVES, exit nonzero
+run 'S~add.c~s/x>100/x>101/~clamp' -k table -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^S SURVIVED ' && ! has "$tmp/err" 'SURVIVED_'; ok "2 unseen mutant is SURVIVED, exit nonzero" $?
+
+# (3) same mutant marked redundant (new column form and legacy prose form)
+run 'S~add.c~s/x>100/x>101/~clamp~redundant~covered elsewhere' -k table -t "$TEST" -b "$BUILD"
+[ $rc -eq 0 ] && has "$tmp/err" '^S SURVIVED_REDUNDANT' && has "$tmp/j.json" '"note": "redundant: covered elsewhere"'; ok "3a redundant (class column) is SURVIVED_REDUNDANT, exit 0" $?
+run 'S~add.c~s/x>100/x>101/~clamp~redundant: covered elsewhere' -k table -t "$TEST" -b "$BUILD"
+[ $rc -eq 0 ] && has "$tmp/err" '^S SURVIVED_REDUNDANT' && has "$tmp/j.json" '"note": "redundant: covered elsewhere"'; ok "3b redundant (legacy prose) is SURVIVED_REDUNDANT, exit 0" $?
+run 'S~add.c~s/x>100/x>101/~clamp~gap~no test reaches it' -k table -t "$TEST" -b "$BUILD"
+[ $rc -eq 0 ] && has "$tmp/err" '^S SURVIVED_GAP'; ok "3c gap is SURVIVED_GAP, exit 0" $?
+run 'S~add.c~s/x>100/x>101/~clamp~none~' -k table -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^S SURVIVED '; ok "3d class none is a plain SURVIVED, exit nonzero" $?
+
+# (4) a no-op edit is ERROR
+run 'N~add.c~s/NO_SUCH_TEXT/y/~noop' -k table -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^N ERROR' && has "$tmp/j.json" '"note": "edit did not apply"'; ok "4a unmatched sed is ERROR edit did not apply" $?
+run 'N~add.c~R:return a + b;@>@return a + b;~noop replace' -k table -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^N ERROR' && has "$tmp/j.json" '"note": "edit did not apply"'; ok "4b replace with identical text is ERROR" $?
+run 'N~missing.c~s/a/b/~no file' -k table -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^N ERROR'; ok "4c missing file is ERROR" $?
+run 'B~add.c~s/int add/int add_/~breaks the build' -k table -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^B ERROR' && has "$tmp/j.json" 'build failed'; ok "4d build failure is ERROR" $?
+
+# (5) replace edit: exactly once works, twice is ERROR, @NL@ is a newline
+run 'R1~add.c~R:return a + b;@>@return a - b;~replace once' -k table -t "$TEST" -b "$BUILD"
+[ $rc -eq 0 ] && has "$tmp/err" '^R1 KILLED'; ok "5a replace matching once is applied (KILLED)" $?
+run 'R2~add.c~R:return@>@return 0 +~replace twice' -k table -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^R2 ERROR' && has "$tmp/j.json" 'not found exactly once'; ok "5b replace matching twice is ERROR" $?
+run 'R3~add.c~R:return a + b;@>@return a - b;@NL@int zzz(void) { return 1; }~newline escape' -k table -t "$TEST" -b "$BUILD"
+[ $rc -eq 0 ] && has "$tmp/err" '^R3 KILLED'; ok "5c replace with @NL@ builds and is KILLED" $?
+
+# (6) marker reader
+run 'ADD_PLUS|add.c|s/a + b/a * b/' -k marker -t "$TEST" -b "$BUILD"
+[ $rc -eq 0 ] && has "$tmp/err" '^ADD_PLUS KILLED'; ok "6a marker row is KILLED" $?
+run 'NO_MARKER|add.c|s/a + b/a * b/' -k marker -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^NO_MARKER ERROR'; ok "6b marker not on any line is ERROR (edit does not apply)" $?
+run 'ADD_PLUS|add.c|s/a + b/a * b/' -k marker -t "$TEST" -b "$BUILD" -B
+[ $rc -eq 0 ]; ok "6c marker baseline passing is accepted" $?
+run 'ADD_PLUS|add.c|s/a + b/a * b/' -k marker -t 'exit 1' -b "$BUILD" -B
+[ $rc -eq 1 ] && has "$tmp/outp" 'baseline does not pass'; ok "6d failing baseline FAILS the sweep" $?
+
+# (7) sed-table row with two files and @@ separated expressions
+cp "$proj/add.c" "$proj/other.c"
+run 'T~add.c,other.c~s/a + b/a - b/@@s/return x;/return x + 1;/~two files' -k table -t "$TEST" -b "$BUILD" -f FAIL
+[ $rc -eq 0 ] && has "$tmp/err" '^T KILLED' && has "$tmp/j.json" '"file": "add.c,other.c"' && has "$tmp/j.json" 'first: add'; ok "7 two-file sed row is applied per file and KILLED" $?
+rm -f "$proj/other.c"
+
+# (8) JSON byte-compare against the committed expected receipt
+cat > "$tmp/rows8" <<'REOF'
+K1~add.c~s/a + b/a - b/~addition is computed
+S1~add.c~s/x>100/x>101/~clamp upper bound
+S2~add.c~s/x>100/x>101/~clamp upper bound again~redundant~covered by the caller, UNVERIFIED
+L1~add.c~s/x>100/x>101/~legacy gap row~gap: legacy prose with "quotes" and \back
+E1~add.c~s/NO_SUCH_TEXT/y/~no-op edit
+REOF
+"$runner" -k table -m "$tmp/rows8" -d "$proj" -o "$tmp/j8.json" -t "$TEST" -b "$BUILD" -f FAIL >/dev/null 2>"$tmp/err8"
+rc8=$?
+[ $rc8 -ne 0 ]; ok "8a sweep with a plain SURVIVED and an ERROR exits nonzero" $?
+cmp -s "$tmp/j8.json" "$expected"; ok "8b JSON is byte-identical to tests/fixtures/mutation_runner/expected.json" $?
+sed 's/KILLED/SURVIVED/' "$expected" > "$tmp/bad.json"
+! cmp -s "$tmp/j8.json" "$tmp/bad.json"; ok "8c the byte compare notices a wrong receipt" $?
+ONLY='K1 S2' "$runner" -k table -m "$tmp/rows8" -d "$proj" -o "$tmp/j9.json" -t "$TEST" -b "$BUILD" >/dev/null 2>&1
+[ "$(grep -c '"id"' "$tmp/j9.json")" -eq 2 ]; ok "8d ONLY restricts the sweep" $?
+
+# (9) deliberately wrong run: a test that always passes must make the breaking
+# mutant SURVIVE, never KILLED, and the sweep must fail.
+run 'K~add.c~s/a + b/a - b/~addition' -k table -t true -b "$BUILD"
+[ $rc -ne 0 ] && has "$tmp/err" '^K SURVIVED' && ! has "$tmp/err" '^K KILLED'; ok "9a always-passing test reports SURVIVED, not KILLED" $?
+run 'K~add.c~s/a + b/a - b/~addition' -k table -t false -b "$BUILD"
+[ $rc -eq 0 ] && has "$tmp/err" '^K KILLED'; ok "9b always-failing test reports KILLED (the runner trusts the exit code)" $?
+run '' -k table -t "$TEST" -b "$BUILD"
+[ $rc -ne 0 ]; ok "9c an empty sweep fails instead of passing vacuously" $?
+
+# (10) the source tree is never edited
+after=$(find "$proj" -type f | sort | xargs sha256sum | sha256sum)
+[ "$before" = "$after" ]; ok "10 source tree unchanged (no build artifacts, no edits)" $?
+
+"$runner" >/dev/null 2>&1; [ $? -eq 2 ]; ok "11 missing arguments exit 2" $?
+
+if [ $fails -ne 0 ]; then echo "mutation runner self-test: FAIL ($fails of $checks)"; exit 1; fi
+echo "mutation runner self-test: PASS ($checks checks)"
diff --git a/tools/mutation_runner.sh b/tools/mutation_runner.sh
new file mode 100755
index 000000000..b7fb5ca0d
--- /dev/null
+++ b/tools/mutation_runner.sh
@@ -0,0 +1,198 @@
+#!/bin/sh
+# One mutation runner (POSIX sh, no Python). Deep module, small interface.
+#
+# A MUTATION is one record:
+#   { name, file(s), edit, test command, what the check guards, equivalence }
+# The runner copies the source tree to a scratch directory (the source tree is
+# never edited), applies the edit there, checks that the files really changed
+# (otherwise ERROR "edit did not apply"), runs the optional build command
+# (failure => ERROR), then runs the test command inside the scratch tree:
+#   exit nonzero => KILLED      exit 0 => SURVIVED
+# EQUIVALENCE is a data column: class none|redundant|gap plus rationale text.
+# A SURVIVED mutant with class redundant or gap is reported SURVIVED_REDUNDANT
+# or SURVIVED_GAP and the JSON note is "<class>: <rationale>" (the same note
+# tools/c4_requal_mutants.sh writes today). Class none (or no class) leaves it
+# SURVIVED, which fails the sweep.
+#
+# EDIT KINDS
+#   sed         files comma-separated, expressions separated by @@ (one per
+#               file, in order), as tools/c4_requal_mutants.sh does today.
+#   marker-sed  one file, one sed expression applied only to lines containing
+#               MUT:<name>, as tensor/autodiff/m20 mutation sweeps do today.
+#   replace     edit text "R:<from>@>@<to>[@@<from>@>@<to>...]": <from> must be
+#               found exactly once in its file (else ERROR), @NL@ in <to> is a
+#               newline, as numeric_oracle_mutations.sh does today.
+#
+# READERS (two; the older sweeps become adapters over them)
+#   table   rows  id~files~edit~guards[~class~rationale]    (kinds sed, replace)
+#           Legacy rows are accepted: 4 columns (no equivalence), or 5 columns
+#           whose last column is prose starting "redundant:" or "gap:".
+#           Lines that are empty or start with # are skipped.
+#   marker  rows  name|file|sed-expr   (kind marker-sed; the expression may
+#           contain |). Marker rows have no equivalence column: a survivor is
+#           always a failure.
+#
+# USAGE
+#   tools/mutation_runner.sh -k table|marker -m ROWS|- -t TESTCMD
+#        [-d SRCDIR] [-b BUILDCMD] [-c "PATH ..."] [-o out.json] [-f PREFIX] [-B]
+#   -k reader kind. -m rows file, or - for stdin. -t test command (sh -c, run
+#   in the scratch tree). -d source tree (default .). -b build command run in
+#   the scratch tree before the test. -c paths (relative to SRCDIR) to copy
+#   (default: whole tree). -o JSON receipt path. -f line prefix that marks a
+#   failing case in test output, used only for the KILLED note. -B run build
+#   and test on the unmutated tree first; if that fails the sweep FAILS.
+#   Env ONLY="id id" restricts the sweep to those ids.
+#
+# OUTPUT
+#   stderr: one line per mutant "<id> <STATUS>  <guards> (<note>)", STATUS is
+#           KILLED, SURVIVED, SURVIVED_REDUNDANT, SURVIVED_GAP or ERROR.
+#   stdout: one summary line.
+#   JSON (-o), exactly the c4 receipt layout, same whitespace, key order and
+#   escaping (note has double quotes and backslashes removed with tr -d):
+#     {"mutants":[{"id","file","checks","status","note"}, ...]}
+#   Exit 0 only if at least one mutant ran and every mutant is KILLED or
+#   justified-survived; 2 on bad usage.
+set -u
+
+kind=; rows=; test_cmd=; src=.; build_cmd=; copy=.; out=; fprefix=; baseline=0
+while getopts k:m:t:d:b:c:o:f:B opt; do
+    case $opt in
+        k) kind=$OPTARG;; m) rows=$OPTARG;; t) test_cmd=$OPTARG;; d) src=$OPTARG;;
+        b) build_cmd=$OPTARG;; c) copy=$OPTARG;; o) out=$OPTARG;; f) fprefix=$OPTARG;;
+        B) baseline=1;; *) kind=;;
+    esac
+done
+case $kind in table|marker) ;; *) kind=;; esac
+if [ -z "$kind" ] || [ -z "$rows" ] || [ -z "$test_cmd" ]; then
+    echo "usage: mutation_runner.sh -k table|marker -m ROWS|- -t TESTCMD [-d SRCDIR] [-b BUILDCMD] [-c PATHS] [-o out.json] [-f PREFIX] [-B]" >&2
+    exit 2
+fi
+src=$(cd "$src" 2>/dev/null && pwd) || { echo "mutation_runner: no such source dir" >&2; exit 2; }
+work=$(mktemp -d "${TMPDIR:-/tmp}/mutrun.XXXXXX") || exit 2
+trap 'rm -rf "$work"' EXIT INT TERM
+if [ "$rows" = - ]; then cat > "$work/rows"; rows=$work/rows; fi
+[ -r "$rows" ] || { echo "mutation_runner: cannot read rows" >&2; exit 2; }
+[ -n "$out" ] || out=$work/out.json
+
+# Fresh scratch copy of the tree in $1.
+copy_tree() {
+    mkdir -p "$1"
+    for p in $copy; do
+        if [ "$p" = . ]; then cp -R "$src/." "$1/"
+        else
+            mkdir -p "$1/$(dirname "$p")"
+            cp -R "$src/$p" "$1/$p" 2>/dev/null
+        fi
+    done
+}
+
+if [ $baseline -eq 1 ]; then
+    copy_tree "$work/base"
+    if { [ -z "$build_cmd" ] || (cd "$work/base" && sh -c "$build_cmd") </dev/null >"$work/base.log" 2>&1; } \
+        && (cd "$work/base" && sh -c "$test_cmd") </dev/null >>"$work/base.log" 2>&1; then :
+    else
+        head -5 "$work/base.log" >&2
+        echo "mutation runner: FAIL (unmutated baseline does not pass)"
+        exit 1
+    fi
+    rm -rf "$work/base"
+fi
+
+# Edit step. Sets $note on failure and returns nonzero.
+apply_edit() { # dir files ekind edit id
+    a_dir=$1; a_files=$(echo "$2" | tr ',' ' '); a_kind=$3; a_edit=$4; a_id=$5
+    for f in $a_files; do
+        [ -f "$a_dir/$f" ] || { note="edit did not apply (no such file $f)"; return 1; }
+    done
+    a_before=$(for f in $a_files; do sha256sum "$a_dir/$f"; done | sha256sum)
+    i=1
+    for f in $a_files; do
+        e=$(printf '%s\n' "$a_edit" | awk -F'@@' -v n=$i '{print $n}')
+        case $a_kind in
+            sed) sed -i "$e" "$a_dir/$f" ;;
+            marker-sed) sed -i "/MUT:$a_id/ $e" "$a_dir/$f" ;;
+            replace)
+                e=${e#R:}
+                FROM=${e%%@>@*} TO=${e#*@>@} perl -0pi -e '$n += s/\Q$ENV{FROM}\E/$ENV{TO} =~ s{\@NL\@}{\n}gr/ge; END { $? = $n == 1 ? 0 : 3 }' "$a_dir/$f" \
+                    || { note="replace text not found exactly once in $f"; return 1; }
+                ;;
+        esac
+        i=$((i + 1))
+    done
+    a_after=$(for f in $a_files; do sha256sum "$a_dir/$f"; done | sha256sum)
+    [ "$a_before" != "$a_after" ] || { note="edit did not apply"; return 1; }
+}
+
+n=0 k=0 r=0 g=0
+first=1
+printf '{\n  "mutants": [\n' > "$out"
+
+# run_one id files ekind edit guards justification   (justification is the
+# prose "redundant: ..." / "gap: ..." or empty)
+run_one() {
+    id=$1; files=$2; ekind=$3; edit=$4; what=$5; just=$6
+    if [ -n "${ONLY:-}" ]; then case " $ONLY " in *" $id "*) ;; *) return 0;; esac; fi
+    dir=$work/m.$id
+    copy_tree "$dir"
+    note=
+    if ! apply_edit "$dir" "$files" "$ekind" "$edit" "$id"; then status=ERROR
+    else
+        log=$work/$id.log
+        if [ -n "$build_cmd" ] && ! (cd "$dir" && sh -c "$build_cmd") </dev/null >"$log" 2>&1; then
+            status=ERROR; note="build failed: $(grep -m1 -E "error:|Error " "$log" | cut -c1-120)"
+        else
+            (cd "$dir" && sh -c "$test_cmd") </dev/null >"$log.run" 2>&1
+            rc=$?
+            nf=0
+            [ -z "$fprefix" ] || nf=$(grep -c "^$fprefix" "$log.run")
+            if [ $rc -ne 0 ] && [ "$nf" -gt 0 ]; then
+                cut_from=$((${#fprefix} + 2))
+                status=KILLED; note="$nf failing case(s), first: $(grep -m1 "^$fprefix" "$log.run" | cut -c"$cut_from"-$((cut_from + 64)))"
+            elif [ $rc -ne 0 ]; then status=KILLED; note="harness exit $rc (crash or abort)"
+            else
+                case "$just" in
+                    redundant:*) status=SURVIVED_REDUNDANT; note="$just" ;;
+                    gap:*) status=SURVIVED_GAP; note="$just" ;;
+                    *) status=SURVIVED; note="harness still PASS, no justification recorded" ;;
+                esac
+            fi
+        fi
+    fi
+    echo "$id $status  $what ($note)" >&2
+    [ $first -eq 1 ] || printf ',\n' >> "$out"
+    first=0
+    printf '    {"id": "%s", "file": "%s", "checks": "%s", "status": "%s", "note": "%s"}' "$id" "$files" "$what" "$status" "$(printf '%s\n' "$note" | tr -d '"\\')" >> "$out"
+    n=$((n + 1))
+    case $status in KILLED) k=$((k + 1));; SURVIVED_REDUNDANT) r=$((r + 1));; SURVIVED_GAP) g=$((g + 1));; esac
+    rm -rf "$dir"
+}
+
+# Reader 1: id~files~edit~guards[~class~rationale]
+read_table() {
+    while IFS='~' read -r t_id t_files t_edit t_guards t_c5 t_c6; do
+        case $t_id in ''|'#'*) continue;; esac
+        t_kind=sed
+        case $t_edit in R:*) t_kind=replace;; esac
+        case $t_c5 in
+            none|redundant|gap)
+                if [ "$t_c5" = none ]; then t_just=; else t_just="$t_c5: $t_c6"; fi ;;
+            *) t_just=$t_c5; [ -z "$t_c6" ] || t_just="$t_c5~$t_c6" ;;
+        esac
+        run_one "$t_id" "$t_files" "$t_kind" "$t_edit" "$t_guards" "$t_just"
+    done < "$rows"
+}
+
+# Reader 2: name|file|sed-expr (expr may contain |)
+read_marker() {
+    while IFS='|' read -r m_name m_file m_expr; do
+        case $m_name in ''|'#'*) continue;; esac
+        run_one "$m_name" "$m_file" marker-sed "$m_expr" "MUT:$m_name" ""
+    done < "$rows"
+}
+
+read_$kind
+
+printf '\n  ]\n}\n' >> "$out"
+echo "mutants: $n total, $k killed, $r survived as redundant, $g survived as test gaps (receipt $out)"
+# Fail on any unjustified survivor or build/edit error, and on an empty sweep.
+[ "$n" -gt 0 ] && [ $((k + r + g)) -eq "$n" ]