Detecting a weakened test assertion in an Angular change

← Back to Blog & Articles

Chapter 3 presented a constructed example of a model that, stuck on a failing test, changes the expected value to match its own output.

the companion book presented a constructed example of a model that, stuck on a failing test, changes the expected value to match its own output. An independent mutation check can expose the same problem by changing the implementation and checking whether the test fails.

Suppose an agent is asked to make the filter case-insensitive, and its first implementation has a bug: it lowercases the query but forgets to lowercase the item text. The strong suite fails on the case-insensitivity test. The agent’s cheapest ways out are to fix the code, which takes thought, or to change the test, which takes a keystroke. If it replaces the five assertions with the single line of the weak suite, the suite goes green and the summary says “all tests pass”. The change in the test file is small, a deletion of four tests and a simplification of one, and in a large diff it is easy to miss.

Three defenses work together. The instruction file states that tests encode requirements and must not be weakened, skipped, or deleted; a well-behaved model stops and reports instead. The harness permissions deny edits to the spec files during an implementation task, so even a badly behaved model cannot. And the mutation score is the independent measure: run on the changed file, it would report a drop from 90 to 10 percent, which is a number a reviewer cannot overlook and a pipeline can enforce. The first two prevent the behavior. The third detects it when prevention fails, which is the standard to hold every control in this book to.

Continue with the book

Explore the full treatment, worked examples, and exercises in Local AI Agents for Angular Teams.


Companion article for Local AI Agents for Angular Teams, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.

Scroll to Top