chore(cli): mutate only the lines a branch changed - #848
Merged
Conversation
Checking a change with mutation meant running a whole scope, or turning `git diff -U0` into `--mutate file:start-end` ranges by hand. That was done five times in one session. `node scripts/run-mutation.mjs --changed [<base>]` diffs the working tree against its merge base with `<base>` (default `origin/next`), mutates only the lines added or changed under `src/`, and names each survivor with its file and line. It holds no floor and passes no incremental file, so it never moves a scope's gate or its cached results. Fixes #842 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb AIDD-Session-Id: 4acc9a1c-19bc-4468-b8b6-e86644bcba60
blafourcade
force-pushed
the
chore/mutate-only-changed-lines
branch
from
September 11, 2026 05:28
d996068 to
a173094
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 What & why
Mutation-testing a change before pushing meant running a whole scope. The alternative was turning
git diff -U0into--mutate file:start-endranges by hand, which was done five times in one session (#842).🛠️ How it works
node scripts/run-mutation.mjs --changed [<base>]:<base>(defaultorigin/next). Uncommitted edits count.src/, asfile:start-endranges. A pure deletion adds no line, and a file outsidesrc/belongs to no scope.It holds no floor and passes no
--incrementalfile, so it never moves a scope's gate or its cached results. Its reports go toreports/mutation/changed/.Three pure functions carry the logic, and each has a test in
mutation-covers-source.arch.test.ts's "the guard itself":changedRanges(diff);changedArgs(ranges);survivorsOf(report).The report filing both modes share moved into
fileReports.cli/aidd_docs/memory/testing.mdhas one line for the new mode.🧪 How to verify
changedRanges is not a functionandsurvivorsOf is not a function.HOME:--changed HEADNo line under src/ changed since HEAD: nothing to mutate.--changed origin/next~1(#836, a rename and one import)no mutant on those lines, 1 changed range(s)--changed origin/next~2(adds #835)score 97.6, 16 changed range(s); one survivor named:marketplace-sync-settings-use-case.ts:577 StringLiteral(the equivalent mutant #835 documents)incremental.jsonwrittenLocal gates: typecheck, lint, knip, architecture 17/17 in the touched file.
mutation-covers-source.arch.test.tsrequires everytest:mutation:*script to be a declared scope, and--changedis not one.git diff, so--changeddoes not see them until they are added.🔗 Linked issue
Fixes #842
✅ I certify
🤖 Generated with Claude Code
https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb