원클릭으로
mutation-testing
Trail-of-Bits two-phase mutmut campaign — targeted first, survivors get full suite, skeptical-agent rule on survivor killing.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Trail-of-Bits two-phase mutmut campaign — targeted first, survivors get full suite, skeptical-agent rule on survivor killing.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Beads work ledger — hash-ID tasks, atomic bd update --claim, dependency-aware bd ready, intent memory bd remember/prime. PAUL emits beads instead of markdown phases.
Gate 3 verification — permission-denied holdout scenarios, write-tool-less reviewers, evidence files over self-report, veto-rate logging.
Unified bi-temporal knowledge graph over GBrain (PostgreSQL/pgvector) and Graphify (NetworkX/tree-sitter). Treats both stores as a single citation-addressable graph. Query with `brain query --unified "topic"`.
Advanced Engram patterns — progressive disclosure index→timeline→full-fetch (~10x token savings), citation IDs, Seance (interrogate dead predecessors), temporal search.
Golden task eval harness — 20 deterministic tasks with checks.py, 5-run protocol, judge calibration, CI gate on >0.3 regression vs baseline. SWE-smith for auto-generation.
Two-mode loop system — in-session /goal evaluation and overnight fresh-context runner with dual exit gate, circuit breaker, error gate, and relay notes.
| name | mutation-testing |
| description | Trail-of-Bits two-phase mutmut campaign — targeted first, survivors get full suite, skeptical-agent rule on survivor killing. |
Trail-of-Bits two-phase mutmut campaign for Python projects. The goal is to expose tests that pass for the wrong reasons by injecting faults and checking that at least one test catches each fault.
Mutants are not equal. Work highest-impact first.
| Tier | Mutation type | Examples | Why first |
|---|---|---|---|
| 1 — Revert | return None → return X, raise → pass | Silencing exceptions, returning wrong sentinel | These kill the most business logic per mutation |
| 2 — Comment-out | Delete an entire logic block | Remove a guard clause, a validation branch | Catches absent-test coverage |
| 3 — Operator swap | + → -, > → >=, and → or | Off-by-one, boundary confusion | Broad but lower signal; run last |
Configure mutmut to apply tiers in order by controlling which operators are enabled per run (see config below).
Run only the tests that directly import or exercise the mutated file. This keeps Phase 1 fast enough to run on every PR.
# Run mutation testing on a single module, paired tests only
mutmut run \
--paths-to-mutate src/saa/engine/areas/fixed_assets/ \
--tests-dir tests/engine/areas/fixed_assets/ \
--use-coverage \
--no-progress
What "paired tests" means: mutmut discovers tests via --tests-dir. Pass only the directory whose test filenames mirror the mutated module. Do not point at the full test suite yet.
After Phase 1 finishes, inspect survivors:
mutmut results # summary: killed / survived / timeout
mutmut show <id> # view the exact diff of a surviving mutant
mutmut html # generate HTML report for triage
Any mutant that survived Phase 1 (i.e., no test killed it) gets the full suite:
# Re-run only surviving mutants against the full test suite
mutmut run \
--paths-to-mutate src/saa/engine/areas/fixed_assets/ \
--use-coverage \
--rerun-all
--rerun-all tells mutmut to re-execute every surviving mutant from the DB against all tests, not just the paired subset.
A mutant that also survives Phase 2 is a genuine gap: either the code path is untested or the existing tests do not assert the right postcondition.
mutmut stores state in .mutmut-cache (SQLite). This persists across runs and across branches, so you never re-run a mutant that was already killed.
# Show only survivors from the DB
mutmut results --survived
# Apply a surviving mutant to disk to inspect it manually
mutmut apply <id>
# Revert to clean source after inspection
mutmut revert <id>
Track the survival count as a metric — not a moral judgment. Survival does not always mean missing test; it sometimes means dead code. Triage before writing tests.
A surviving mutant MUST NOT be killed by writing a test that encodes the current (possibly wrong) behavior.
Before writing any killing test for a Phase 2 survivor:
This rule prevents the common failure mode where mutation testing crystallizes a latent bug into the test suite as a "correct" assertion.
[tool.mutmut]
paths_to_mutate = "src/"
backup = false
runner = "python -m pytest"
tests_dir = "tests/"
dict_synonyms = ""
# Limit to Tier 1 + 2 operators for the first campaign
# Tier 3 (arithmetic) enabled separately via CLI flag
Alternatively, setup.cfg:
[mutmut]
paths_to_mutate=src/
runner=python -m pytest
tests_dir=tests/
backup=False
#!/usr/bin/env bash
set -euo pipefail
MODULE="${1:?Usage: mutmut-campaign.sh <src/path/to/module>}"
TESTS="${2:?Usage: mutmut-campaign.sh <src/path> <tests/path>}"
echo "=== Phase 1: targeted run ==="
mutmut run \
--paths-to-mutate "$MODULE" \
--tests-dir "$TESTS" \
--use-coverage \
--no-progress
SURVIVED=$(mutmut results --survived 2>/dev/null | grep -c "^[0-9]" || true)
echo "Phase 1 survivors: $SURVIVED"
if [ "$SURVIVED" -eq 0 ]; then
echo "No survivors. Campaign complete."
exit 0
fi
echo "=== Phase 2: full suite against survivors ==="
mutmut run \
--paths-to-mutate "$MODULE" \
--use-coverage \
--rerun-all
FINAL=$(mutmut results --survived 2>/dev/null | grep -c "^[0-9]" || true)
echo "Phase 2 survivors: $FINAL"
# Fail CI if survival rate exceeds threshold
TOTAL=$(mutmut results 2>/dev/null | grep -oP 'Killed: \K[0-9]+' || echo 1)
RATE=$(echo "scale=2; $FINAL / ($TOTAL + $FINAL) * 100" | bc)
THRESHOLD=15
if (( $(echo "$RATE > $THRESHOLD" | bc -l) )); then
echo "FAIL: survival rate ${RATE}% exceeds ${THRESHOLD}% threshold on core module"
exit 1
fi
echo "PASS: survival rate ${RATE}%"
Add to your CI pipeline after the test suite passes:
# .github/workflows/mutation.yml (runs on PRs touching core modules)
- name: Mutation testing — fixed_assets
run: |
pip install mutmut
bash scripts/mutmut-campaign.sh \
src/saa/engine/areas/fixed_assets/ \
tests/engine/areas/fixed_assets/
Gate condition: fail the build if the Phase 2 survival rate on any src/saa/engine/ module exceeds 15%.
Do not gate non-core modules at 15% — set a looser threshold (40%) or skip mutation testing for adapter/glue code.