prioritize_survivors
Prioritize surviving mutants by materiality, filtering log-only changes and ranking by potential impact to identify critical test gaps.
Instructions
Prioritize surviving mutants by likely materiality, filtering out log/debug-only changes and ranking by potential impact. Returns a sorted list of survivors with reasons for prioritization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| venv_path | No |
Implementation Reference
- mutmut_mcp.py:154-178 (handler)The handler function for 'prioritize_survivors' tool, which processes survivor information and returns a prioritized list based on a simple heuristic.
def prioritize_survivors(venv_path: Optional[str] = None) -> dict: """ Prioritize surviving mutants by likely materiality, filtering out log/debug-only changes and ranking by potential impact. Returns a sorted list of survivors with reasons for prioritization. """ survivors_output = show_survivors(venv_path) if not survivors_output or "no surviving mutants" in survivors_output.lower(): return {"prioritized": [], "message": "No surviving mutants found."} prioritized = [] for line in survivors_output.splitlines(): if not line.strip() or line.startswith("SURVIVED:") is False: continue # Example line: SURVIVED: mypackage.module.function_name:42 (some description) mutant_id = line.split(":", 1)[-1].strip() # Heuristic: deprioritize if log/debug, prioritize if in core logic if any(kw in line.lower() for kw in ["log", "debug", "print", "logger", "logging"]): reason = "Likely log/debug only, deprioritized." score = 0 else: reason = "Potentially material logic, prioritize." score = 1 prioritized.append({"mutant_id": mutant_id, "score": score, "reason": reason, "raw": line}) # Sort by score descending (material first) prioritized.sort(key=lambda x: x["score"], reverse=True) return {"prioritized": prioritized, "message": "Survivors prioritized by likely materiality."} - mutmut_mcp.py:188-188 (registration)Tool registration for 'prioritize_survivors' using the MCP decorator.
mcp.tool()(prioritize_survivors)