Dev.to AI 🤖 Ai 👁 0 📖 4 min read

Your PR is green. Your test is gone.

The build is green. The PR looks clean. The reviewer approves it. And a test that used to protect you no longer checks anything. That's the quiet failure mode of AI coding agents. Ask one to make the build pass and it

The build is green. The PR looks clean. The reviewer approves it.

And a test that used to protect you no longer checks anything.

That's the quiet failure mode of AI coding agents. Ask one to make the build pass and it will, usually by fixing the code, but sometimes by changing the check instead: an assertion removed, a test skipped, a type check switched off. Nothing fails, so nothing tells you. You find out in production, weeks later, when the bug the test was guarding against ships.

None of this is malicious. The agent was asked for a green build, and it delivered one. These are the five patterns worth looking for in every AI-written pull request.

1. The assertion that disappeared

Before:

test('applies the discount', () => {
  const total = checkout(cart, 'SAVE10');
  expect(total.discount).toBe(10);
  expect(total.amount).toBe(90);
});

After the agent "fixed" it:

test('applies the discount', () => {
  const total = checkout(cart, 'SAVE10');
  expect(total.discount).toBe(10);
});

The test still exists, still passes and still has the same name. It just doesn't check the amount any more, which was the part that was broken.

What to look for: count the assertions in each changed test file, before and after. Fewer assertions in a PR that wasn't about tests is a red flag.

2. The skipped (or focused) test

it.skip('rejects an expired token', async () => {

or the opposite, which is worse:

it.only('returns the user profile', async () => {

.skip silences one test. .only silences every other test in the file, and the run still reports green. In Python it's @pytest.mark.skip; in Go, t.Skip().

What to look for: any new skip, only, xit, xdescribe or @pytest.mark.skip in the diff.

3. The type check that got switched off

// @ts-ignore
const user: User = await fetchUser(id);
const total = (order as any).items.reduce(sum, 0);

The type error was telling you something real: fetchUser can return null. Now it can't tell you any more, and you find out at runtime.

What to look for: new @ts-ignore, @ts-expect-error, as any, eslint-disable, # type: ignore or # noqa lines.

4. The expected value that moved to match the bug

- expect(formatPrice(1999)).toBe('$19.99');
+ expect(formatPrice(1999)).toBe('$1999.00');

This one is the hardest to spot, because the diff looks like a reasonable update. The agent changed the expectation to match what the code now returns, so the test now locks in the bug.

Snapshot tests make it even easier: run jest -u, every snapshot is "updated", and the diff is 400 lines nobody reads.

What to look for: changed expected values or snapshots in a PR that wasn't supposed to change behaviour.

5. The test file that was deleted

The bluntest version: a test file that kept failing is no longer in the repo. It shows up as one line in the file list, between the changes you actually asked for.

What to look for: deleted files under test/, tests/, __tests__/ or anything matching *.test.* / *_test.*.

Why review alone doesn't catch this

Each of these is small, sits next to real changes, and looks plausible. An AI reviewer reading the same diff can miss it for the same reason a tired human does. And none of them makes the build fail, which is the whole point.

What works is checking mechanically, on every PR, the same way every time:

  1. Run the tests on the PR and on main. Anything that passes on main and fails on the PR was broken by this change. Anything that fails on both was already broken, so don't blame the PR for it.
  2. Read the diff for the five patterns above: assertions removed, tests skipped or focused, checks switched off, and test files deleted. Treat expected values and snapshots as "explain this change".
  3. Put the result where the reviewer already looks: on the PR itself.

Automating it

Doing this by hand on every PR doesn't last, so I built a small open-source tool for it, Stet. It's free (MIT), and there's no AI in the check, so the same diff always gets the same answer.

On every pull request it posts one comment:

  • what the PR broke compared with main, and what was already failing on main
  • red flags from the diff: assertions removed (with the before/after count), tests skipped or .only, @ts-ignore / as any / eslint-disable added, test files deleted, and lockfile, CI or env changes
  • each red flag marked on its exact line in Files changed

It doesn't catch pattern 4 yet (an expected value or snapshot quietly changed to match a bug). That one needs a human eye for now, and it's next on my list.

It works with zero config. Add it to a repo in two clicks at getstet.dev/add, or add the workflow yourself:

name: Stet
on:
  pull_request:
    types: [opened, synchronize, reopened]
permissions:
  contents: read
  pull-requests: write
  checks: write
jobs:
  stet:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: stet-dev/stet-action@v2

Or run it locally before you push:

npx stet-cli report --base main

If you use Claude Code or Antigravity, there's also a plugin: ask your agent "Check my changes with Stet" and it runs the check before it tells you it's done.

Which of these have you caught in your own repos? And is there a sixth pattern I should be checking for? I'm adding new checks based on what people actually run into.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.