Search Sreeni's Insights

Filter by content type
ai crafting August 18, 2026 5 min read

All Green. All Wrong.

The AI wrote the code and the tests, CI went green, and a customer found the bug the tests were designed to miss. That gap between 'tests pass' and 'it works' is verification debt, the fourth of seven AI debts.

Share:

All Green. All Wrong.


TL;DR: The AI wrote the code. The AI wrote the tests. The tests passed. We shipped. A week later, a customer found the bug the tests were designed to miss. That gap between “tests pass” and “it actually works” is verification debt — and AI makes it dangerously easy to accumulate.


The PR was a thing of beauty.

42 tests. All green. Coverage report glowing. Edge cases enumerated like a checklist: null inputs, empty arrays, negative numbers, unicode, timezone boundaries. The works.

I prompted the implementation. Then I prompted the tests. Both came back fast. Both looked thorough. I read them, nodded, merged.

A week later, support escalated a bug: customers in one specific timezone were seeing the wrong daily summary — off by one day, but only on the day after a DST shift.

I opened the test file. Sure enough — there was a test called handles DST transition.

It passed.

The bug was real. The test was green. Both at the same time.

The Test Was Asking the Wrong Question

I read the test carefully.

It asserted that the function returned a value during a DST transition. It did not assert what that value should be.

Technically, the test passed. Practically, the test was useless. The AI had generated a test that matched the shape of “DST handling test” without actually verifying DST behaviour.

And here’s the thing — I reviewed that test. I saw the name, saw the assertion, saw the green tick, and my brain filled in the rest. “DST handled” became something I believed, not something I verified.

The Trap

When you write the tests, you write them because something scared you. You’re encoding a fear: “I’m worried this breaks when X happens.” The assertion is sharp because the fear was specific.

When the AI writes the tests, it writes them because tests are what comes next in the file. It’s pattern-matching on “what a test file looks like” — not on “what could actually go wrong in this code, in this domain, for these users.”

The result:

  • Tests that exercise the happy path beautifully.
  • Tests with impressive-sounding names.
  • Tests that hit every branch (great coverage!).
  • Tests that wouldn’t catch the actual bugs because the assertions are vague.

Coverage goes up. Confidence goes up. Actual verification stays flat.

Tests Pass ≠ It Works

This is the lie at the heart of verification debt:

A green CI is evidence of “the code does what the tests say.” It is not evidence of “the tests say the right thing.”

In a pre-AI world, that gap was small. Humans wrote tests because they were worried about something specific. The assertion encoded the worry.

In an AI-assisted world, that gap is huge. The AI has no worries. It has patterns. And a test generated from a pattern is a test that protects you against patterns of bugs, not your actual bugs.

Worse: AI-generated tests against AI-generated code are a closed loop. The same model that has a blind spot in the implementation has the same blind spot in the test. The bug and the test agree with each other. Green forever.

What “Paying It Down” Looks Like

Verification debt isn’t fixed by more tests. It’s fixed by sharper tests.

  • Write the assertion first, by hand. Let the AI fill in the scaffolding. But the what should be true statement comes from a human who knows the domain.
  • Adversarial testing. Ask a different AI (or a different person) to break the code. Generator and tester should not be the same brain.
  • Mutation testing on AI-generated code. Tools like Stryker / mutmut deliberately break your code and check if the tests notice. If they don’t, the tests are theatre.
  • Test the bug, not the fix. When a bug ships, the regression test must reproduce the original failure first — then pass after the fix. AI-generated regression tests routinely skip the “reproduce” step.
  • Treat 100% coverage as a smell, not a goal. Especially with AI-generated tests. It usually means the tests are matching shape, not behaviour.

The Real Lesson

The CI was green. The coverage was 94%. The PR was approved by two humans.

And the code was wrong in exactly the place a test claimed to be guarding.

Verification debt is the most dangerous of the seven because it doesn’t look like debt. It looks like safety. Green dashboards are the disguise it wears.

Every passing test you didn’t write — and didn’t interrogate — is a small loan against your future confidence.

That’s debt number four of seven.

Related Posts