Menu

Our tests passed and the AI said "Safe to Merge". A deliberate one-character change still passed. Here is how we catch that.
📰

Our tests passed and the AI said "Safe to Merge". A deliberate one-character change still passed. Here is how we catch that.

DEV Community: java·JavaCoder7·3 days ago
#syvqXIPe
#devtojava#devto#dev#tests#codeguard
Long article (525 words) — no AI summary yet.
Reading 0:00
15s threshold

We build CodeGuard AI at IsabiTech: a self-hosted pull-request reviewer for Java and Spring Boot that runs your tests and says UNVERIFIED when it cannot prove something. This week we used reader feedback to add three checks and ran each on a test repository.

Tests pass, but nobody tests the boundary

A PR adds this:

java

public double fee(double orderTotal) {

if (orderTotal > 500) {

return 0.0;

}

return 49.0;

}

with two tests, for 1000 and for 100. All 8 tests in the project passed and the AI wrote "tests cover the new functionality, Safe to Merge."

CodeGuard's optional mutation check changed > to >= on the added line and re-ran the tests that reference the class. They still passed. The review reported:

Tests did not detect a deliberate change at ShippingService.java:7 (original if (orderTotal > 500), mutant if (orderTotal >= 500))

It is a Medium finding, verified, and it warns without blocking, because a surviving mutant is evidence about the tests, not proof of a bug.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.