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

I planted 3 bugs in 23 lines. The reviewer found all 3 — and corrected my own bug report.

I needed a quick smoke test. I had just swapped the model provider behind my AI code reviewer and wanted proof it still worked end to end, so I wrote a deliberately broken file, opened a PR, and let the bot review it. T

I needed a quick smoke test. I had just swapped the model provider behind my AI code reviewer and wanted proof it still worked end to end, so I wrote a deliberately broken file, opened a PR, and let the bot review it.

Twenty-three lines. Three bugs, planted on purpose. I even wrote them into the PR description so there would be no ambiguity about what a correct review looks like:

Smoke test for the provider-resolution fix. Three deliberate bugs: subject truncation that fails when there is no space, SQL string interpolation, swallowed exception.

The repo is public, so you can check every claim below against the actual PR: jovian-zhibai/Jovian-ZhiBai#1.

Here is the whole thing:

"""Release note helpers — trimmed for a review smoke test."""

import sqlite3


def short_subject(title: str) -> str:
    """Take the first word of a release title as its channel name."""
    return title.rsplit(" ", 1)[0]


def find_notes(db_path: str, channel: str):
    conn = sqlite3.connect(db_path)
    cur = conn.cursor()
    cur.execute("SELECT id, body FROM notes WHERE channel = '%s'" % channel)
    return cur.fetchall()


def publish(notes, send):
    for note in notes:
        try:
            send(note)
        except Exception:
            pass

What came back

Risk score 46/100, MEDIUM. Four findings across four agents: 1 critical, 1 high, 1 medium, 1 low.

# Severity Finding My planted bug?
1 🔴 Critical SQL Injection via string formatting Yes — bug 2
2 🟠 High Swallowed exceptions hide errors Yes — bug 3
3 🟡 Medium Logic error in extracting first word Yes — bug 1
4 🟢 Low Missing parameter type hints No

3 for 3 on the planted bugs. That is the headline, and it is also the least interesting part. The interesting part is finding 3, because it disagrees with me.

It corrected my own bug report, and it was right

I described bug 1 as "subject truncation that fails when there is no space." That description is wrong. I wrote the bug, and I still described it wrong.

"BugFix".rsplit(" ", 1) returns ["BugFix"], so [0] is "BugFix". No exception, no failure. The real defect is the opposite of what I said: on a title with several words it returns everything before the last space, not the first word.

The reviewer said this:

The docstring says "Take the first word", but the implementation takes the substring before the last space. This is likely a logic error. For "Fix bug 123", it returns "Fix bug", not "Fix".

And then it gave the fix I should have written in the first place: title.split(" ", 1)[0].

That matters more than the hit rate. If the reviewer were leaning on the PR description to decide what to look for, it would have inherited my mistake and reported "fails when there is no space" — a bug that does not exist. Instead it read the code, found the actual contract violation, and produced a better description of my own bug than I did.

One finding is not proof it never reads the description. But this is the specific case where copying would have been visible, and it did not copy.

What was not clean

Three for three on recall does not mean the report is clean, and I would rather show you the seams than round them off.

The low finding is noise. "Missing parameter type hints" on a two-parameter helper in a smoke test file is technically true and worth nothing. It is the kind of finding that trains people to stop reading the low section.

The critical finding is four findings stacked into one. Read the body and it contains: the SQL injection, an unclosed sqlite3 connection, a missing return annotation, and a StyleAgent note that string interpolation is also unidiomatic. Four different issues, one severity label, one suggestion. A reader skimming the critical section learns "there is a critical thing here" but not that three unrelated smaller things arrived attached to it.

The line anchors point at functions, not statements. The SQL injection is reported at PR#1:11, which is def find_notes(...). The interpolated query is on line 14. Swallowed exceptions are reported at PR#1:20 (try:) when the except: pass is on 22. Missing type hints at PR#1:17 (a blank line) for a signature on 18. Only finding 3 lands exactly, at line 8, and that is because the function body is a single line.

Function-level anchoring is defensible for a summary report — the whole function is the unit of blame. This run was on the free tier, which posts one summary comment and nothing else, so nothing was misplaced.

It stops being defensible on the paid tier. The pricing page sells Pro as "inline annotations on every finding," and an inline comment anchored to a def line makes the reader hunt for the problem themselves. That is a gap between what the page promises and what the current code can deliver, and I would rather write it down than have a paying customer discover it.

The score I am willing to defend

  • Recall on planted bugs: 3 of 3.
  • Precision: not 4 for 4. One finding is noise, one is a stack of four issues under a single label. Call it three substantive units out of four reported, and the useful ones are not cleanly separated.

Reporting only the first number is how benchmark claims become lies. A reviewer that stays silent can also post a beautiful precision number, which is why the other half of this exercise — whether it finds things when nobody told it what to look for — is the number I actually care about. That one does not have a tidy answer yet.

Why I am posting this

Because the number is small enough that you can check it. One file, one PR, a public repo. You can read the diff, read the report in the PR comments, and decide whether finding 3 is as good as I think it is, or whether the line-anchor problem makes the whole thing less useful than I am claiming.

The part I would want a reader to take away is not "it caught three bugs." It is that the one finding which disagreed with my own written description turned out to be the correct one, and that the report still had seams I had to describe for you to see.

If you want to run the same test on your own code, the GitHub App is free for 50 reviews a month with 4 agents (this report ran on exactly that): app.revhive.souljian.cn. If you find a case where it agrees with a wrong description instead of correcting it, I would like to see that PR more than I would like another compliment.

📰 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.