carlos / platform Public

Separate model-only HA mutations from production catches

Label nine self-reporting mutations and map them to production unit witnesses. Keep those checks out of the caught total and test the reporting path. The controller B5 report now records 26 invariant or executable catches and nine model-only checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 45a989735aa7afbb33233a84044f547571279c33 parent e6f0edc
2 files changed, +65 −3
  • internal/sim/regionha/mutate.sh +26 −3
  • internal/sim/regionha/mutation_evidence_test.go +39 −0
diff --git a/internal/sim/regionha/mutate.sh b/internal/sim/regionha/mutate.sh
index d7da53589..31d061d88 100755
--- a/internal/sim/regionha/mutate.sh
+++ b/internal/sim/regionha/mutate.sh
@@ -25,6 +25,7 @@
#
# CAUGHT the sweep reported at least one violating seed (replay it with
# RHASIM_SEED), OR a witness of the rule violated its invariant;
+# MODEL-ONLY self-reporting model check; unit= names separate production coverage;
# MISSED every seed passed and every witness held (or there is none);
# ERROR anything else: an unknown rule, a stale binary, a panic, a
# timeout, output the harness cannot parse, or a witness run
@@ -81,6 +82,22 @@ if [ $brc -ne 0 ] || [ "$(grep -c "^ sim_test.go:[0-9]*: $SEEDS seeds, 0 fail
fi
echo "BASELINE unmutated: sweep 0 of $SEEDS"
+# Self-reporting model checks are excluded from the production catch count.
+model_witness() {
+ case "$1" in
+ delete-before-import) echo "internal/host:TestDepartureNoEarlyDelete" ;;
+ ack-before-import) echo "internal/host:TestDepartureCompletionRescan" ;;
+ ack-with-dead-releaser) echo "internal/host:TestDepartureCompletionRescan" ;;
+ proof-wrong-lifetime) echo "internal/termfence:TestTerminationProofBinding;internal/lease:TestTerminationProofAcquireOnly" ;;
+ finalizer-counts-as-visitor) echo "internal/activator:TestDepartureFinalizeTelemetry" ;;
+ delete-denied-is-complete) echo "internal/host:TestDepartureDeleteDenied" ;;
+ reuse-staged-rows-without-manifest-digest) echo "internal/activator:TestHAAdoptManifestBoundary" ;;
+ null-is-home) echo "internal/host:TestDepartureIdentityWithoutEdges;internal/host:TestDepartureCoverageIsolation" ;;
+ started-waits-for-inventory) echo "internal/hadeparture:TestTerminationConsumerStartupBound" ;;
+ esac
+}
+export -f model_witness
+
one() {
r=$1
tag=$(echo "$r" | tr ',' '+')
@@ -145,7 +162,10 @@ one() {
caught=1
fi
if [ $caught -eq 1 ]; then
- if [ "$expect" = "missed" ]; then
+ model=$(model_witness "$r")
+ if [ -n "$model" ]; then
+ echo "MODEL-ONLY $r: $sweep; witness $wit; unit=$model" | tee "$verdict"
+ elif [ "$expect" = "missed" ]; then
echo "STALE $r: $sweep; witness $wit; but expected-outcomes.txt says missed" | tee "$verdict"
else
echo "CAUGHT $r: $sweep; witness $wit" | tee "$verdict"
@@ -175,7 +195,7 @@ if [ "$have" -ne "$want" ]; then
fi
for r in $RULES; do
v="$SCRATCH/verdicts/$(echo "$r" | tr ',' '+')"
- if ! grep -qE '^(CAUGHT|MISSED|EXPECTED-MISS|STALE|ERROR) ' "$v" 2>/dev/null; then
+ if ! grep -qE '^(CAUGHT|MODEL-ONLY|MISSED|EXPECTED-MISS|STALE|ERROR) ' "$v" 2>/dev/null; then
echo "sweep: no well-formed verdict for $r" >&2
exit 2
fi
@@ -185,4 +205,7 @@ if [ "$bad" -gt 0 ]; then
echo "sweep: $bad rule(s) ERROR, MISSED or STALE" >&2
exit 1
fi
-echo "sweep: all $want rule(s) CAUGHT or expected"
+caught=$(cat "$SCRATCH"/verdicts/* | grep -c "^CAUGHT ")
+model=$(cat "$SCRATCH"/verdicts/* | grep -c "^MODEL-ONLY ")
+expected=$(cat "$SCRATCH"/verdicts/* | grep -c "^EXPECTED-MISS ")
+echo "sweep: $caught CAUGHT, $model MODEL-ONLY, $expected expected"
diff --git a/internal/sim/regionha/mutation_evidence_test.go b/internal/sim/regionha/mutation_evidence_test.go
new file mode 100644
index 000000000..ffb4875c8
--- /dev/null
+++ b/internal/sim/regionha/mutation_evidence_test.go
@@ -0,0 +1,39 @@
+package regionha
+
+import (
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+func TestMutationEvidenceLabels(t *testing.T) {
+ rules := []string{"delete-before-import", "ack-before-import", "ack-with-dead-releaser", "proof-wrong-lifetime", "finalizer-counts-as-visitor", "delete-denied-is-complete", "reuse-staged-rows-without-manifest-digest", "null-is-home", "started-waits-for-inventory", "duty-ignores-owner"}
+ dir := t.TempDir()
+ bin := filepath.Join(dir, "fixture")
+ body := `#!/bin/bash
+if [ -n "${RHASIM_LIST:-}" ]; then printf '%s\n' ` + strings.Join(rules, " ") + `; exit; fi
+if [[ "$*" == *TestWitnesses* ]]; then echo ' witness_test.go:1: witness fixture: violated'; exit; fi
+if [ -z "${RHASIM_MUTATE:-}" ]; then echo " sim_test.go:1: $RHASIM_SEEDS seeds, 0 failed; mutated=\"\""; exit; fi
+echo "1 of $RHASIM_SEEDS seeds violated an invariant; first seed 1"
+exit 1
+`
+ if err := os.WriteFile(bin, []byte(body), 0700); err != nil {
+ t.Fatal(err)
+ }
+ cmd := exec.Command("bash", "mutate.sh", bin, "1")
+ cmd.Env = append(os.Environ(), "RHASIM_LIST=", "RHASIM_PAR=1", "RHASIM_SCRATCH="+filepath.Join(dir, "scratch"))
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatalf("%v: %s", err, out)
+ }
+ for _, r := range rules[:9] {
+ if !strings.Contains(string(out), "MODEL-ONLY "+r+":") {
+ t.Errorf("missing model-only label for %s: %s", r, out)
+ }
+ }
+ if !strings.Contains(string(out), "sweep: 1 CAUGHT, 9 MODEL-ONLY, 0 expected") {
+ t.Errorf("inflated summary: %s", out)
+ }
+}