Repository navigation
chore: add mutants-review agent skill - #4375
jarhodes314 wants to merge 4 commits into
Conversation
a86104e to
6b7e092
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
6b7e092 to
3b3b743
Compare
Robot Results
|
Runs cargo-mutants on a PR's diff, writes a test for each missed mutant, verifies with cargo-mutants that the test catches it, and adds the tests as pending GitHub review comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ed9625f to
fede877
Compare
There was a problem hiding this comment.
[AI] question: Why not keep the skill in .agents/skills/ with a wrapper here, like pr-review?
from me: The PR description says:
Adds
/mutants-review [PR], a user-invoked agent skill in.agents/skills/
So it seems this file is mislocated?
There was a problem hiding this comment.
Moved back to .agents/skills/mutants-review/SKILL.md, with a wrapper in .claude/commands/ like pr-review.
|
|
||
| Show the user a summary table (mutant, verdict, verified?) and the comment bodies. Under it, name the changed logic no mutant touched: cargo-mutants leaves macro arguments (e.g. the arms of a `matches!`) and most `if` conditions unmutated, so "all caught" says nothing about them. Posting is outward-facing: post only after the user approves. | ||
|
|
||
| Each untested behaviour becomes one comment, anchored on a mutated line (always inside the diff, since `--in-diff` produced it), `side: RIGHT`. Mutants killed by the same test share one comment. |
There was a problem hiding this comment.
[AI] issue: A mutant's line in missed.txt can be outside the diff, so posting the review can fail.
--in-diff keeps every mutant whose replaced code overlaps a changed line. But missed.txt gives the line where the replaced code starts. For a "replace function body" mutant, that is the first line of the body. If the PR changed only the end of a long function, that line is outside the diff hunks. GitHub rejects a review comment on such a line, so the REST call that creates the new review fails as a whole.
| Each untested behaviour becomes one comment, anchored on a mutated line (always inside the diff, since `--in-diff` produced it), `side: RIGHT`. Mutants killed by the same test share one comment. | |
| Each untested behaviour becomes one comment, anchored on a changed line of `pr.diff` that lies inside the mutated function, `side: RIGHT`. Mutants killed by the same test share one comment. |
There was a problem hiding this comment.
Applied, thanks. The old wording wrongly claimed the mutated line is always inside the diff.
Proposed changes
Adds
/mutants-review [PR], a user-invoked agent skill in.agents/skills/, that runs cargo-mutants on a PR's diff and drafts tests for the mutants that survive.The user's checkout is never touched, and nothing is visible to the PR author until the user submits the review.
Tried on #4373:
cargo mutants --in-difffound 8 mutants (5 caught, 2 missed, 1 unviable). For the missedreplace is_connection_closed -> bool with true, the skill wroteconnection_refused_is_not_treated_as_a_closed_connection. The verify run reported that mutant caught and the unmutated baseline passed, and the test was added as a pending review comment.Types of changes
Paste Link to the issue
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments
The change is a single Markdown file that only runs when someone types
/mutants-review; it touches no code, build or CI.Every comment the skill posts is prefixed with
[AI], so readers can tell which review comments were generated.🤖 Generated with Claude Code