# Why 100% Line Coverage is Lying to You in AI-Generated Code (And How We Catch It)

> Source: <https://dev.to/svspraveen/why-100-line-coverage-is-lying-to-you-in-ai-generated-code-and-how-we-catch-it-4dka>
> Published: 2026-08-29 14:15:45+00:00

If you have spent the last few months building projects with AI coding assistants (Antigravity, Claude Code, Cursor, Copilot), you have likely experienced this specific frustration:

You prompt an agent to build a feature or fix a bug. The agent writes tests. You run `pytest`

, and all green checkmarks appear with **100% line coverage**. You feel confident and push to production — only to discover after deployment that the tests were completely hollow and missed critical edge-case logic.

Line coverage measures whether a line of code was **executed**, not whether its logic was actually **asserted**.

To solve this, I built and open-sourced **DeployProof** — a deterministic pre-push verification tool for Python that catches hollow test suites, hallucinated dependencies, and security traps in seconds before code leaves your local machine.

To illustrate the problem clearly, consider this simple discount calculator with a 50% threshold cap:

``` php
# calculator.py
def calculate_discount(price: float, rate: float) -> float:
    if rate > 0.5:
        return price * 0.5
    return price * (1.0 - rate)
```

When asked to write unit tests, an LLM might generate this:

``` python
# test_calculator.py
from calculator import calculate_discount

def test_calculate_discount_standard():
    assert calculate_discount(100.0, 0.2) == 80.0
```

This single test hits every branch of the standard discount and yields **100% line coverage**.

However, if you mutate the logic:

`rate > 0.5`

to `rate > 1.5`

`return price * 0.5`

to `return price * 1.5`

`*`

to `/`

**The test suite still passes 100% green.** The test never asserted the threshold cap or boundary conditions.

Traditional mutation testing tools (like `mutmut`

or `cosmic-ray`

) are powerful, but they typically run against the entire codebase. On a project with hundreds of tests, running a full mutation suite can take 5 to 20 minutes — far too slow to run on every `git commit`

or `pre-push`

hook.

**DeployProof solves this with Diff-Scoped AST Mutation:**

Instead of mutating the entire repository, DeployProof inspects your active `git diff`

(or uncommitted session files) and targets AST mutations strictly to the lines you just wrote or modified.

This drops verification time from minutes down to **2 to 4 seconds**.

``` bash
$ deployproof check

DeployProof - LOCAL PRE-CHECK
====================================================================
Target Scope (1 file evaluated):
  * calculator.py

Local Pre-Check Mutation Verification:
  Score:  57.1% (4/7 mutants killed)
  Status: FAILED (score 57.1% below 80.0%) (threshold: 80.0%)
  Time:   2.27s

Surviving Mutants (3 unverified changes):
  [1] calculator.py:2
      Mutation: Replace numeric constant '0.5' with '1.5'
      Original: if rate > 0.5:
      Mutated:  if rate > 1.5:

  [2] calculator.py:3
      Mutation: Replace numeric constant '0.5' with '1.5'
      Original: return price * 0.5
      Mutated:  return price * 1.5

  [3] calculator.py:3
      Mutation: Replace binary operator '*' with '/'
      Original: return price * 0.5
      Mutated:  return price / 0.5
====================================================================
Pre-check FAILED: Score 57.1% is below threshold 80.0% (3 surviving mutants).
```

Once you add tests for the threshold cap (`rate = 0.8`

) and exact boundary (`rate = 0.5`

), all mutants are killed and the pre-push gate passes at **100.0%**.

Beyond hollow tests, AI codebases frequently introduce adjacent failure modes. DeployProof runs 5 additional static verification passes against your active diff:

`except Exception: pass`

blocks and dead code generated to silence errors.`@patch`

and `unittest.mock`

usage that masks broken business logic.`.env`

secrets and hardcoded API keys (OpenAI, Anthropic, AWS, Stripe).DeployProof is free, open source (MIT), and installs via pip:

```
pip install deployproof
```

Initialize it in your repository (creates `.deployproof.json`

and sets up the `.git/hooks/pre-push`

gate to block pushes when checks fail):

```
deployproof init
```

Run on-demand verification anytime:

```
deployproof check
```

For CI/CD pipelines (GitHub Actions, GitLab CI), it provides structured JSON output:

```
deployproof check --json
```

I built DeployProof as an independent solo developer after repeatedly hitting subtle AI test regressions across my own projects.

If you are using AI coding agents in your daily workflow, I would love for you to try it out, file issues, star the repository, or contribute:

*What subtle failure modes or hollow test patterns have you noticed in your AI coding workflows? Let me know in the comments below!*
