Skip to content
EffortlessSteven
All terms

Guardrail

Mutation on diff

Run mutation testing only against changed code to prove tests would fail if the new logic were wrong—high signal without full-suite cost.

Also known as: diff-mutation-testing

Definition

Mutation on diff is running mutation testing (or mutation-style checks) only against the code that changed in a PR, to prove your tests would fail if that logic were wrong.

It’s “high-signal testing, scoped to what you touched.”

Why it exists

Full mutation testing is powerful but expensive. Diff-scoping gives you most of the benefit:

What counts as “mutation”

A mutation is a small change that should break a good test suite:

If tests still pass, the tests aren’t protecting the behavior.

How to implement

  1. Determine the diff surface (files/functions touched).
  2. Run a mutation tool (or a custom mutator) only on that surface.
  3. Fail the gate if mutants survive above a threshold.
  4. Emit results into the build receipt.

Where it fits

Mutation-on-diff is a strong gate late in a gated multi-agent flow:

Practical rule

Related Terms