QA SkillsBlog

16 November 2026

We ran 250 real bug fixes against the code before the fix

A regression test is supposed to fail on the bug and pass on the fix. When the fix and the test arrive in one commit, nobody watches it fail. We went back and watched, for 250 merged fixes in nine open-source projects.

The worry is easy to state. An agent, or a person in a hurry, writes a fix and a test in one sitting. The test is green. It has only ever run against the fixed code, so it may describe what the new code does and nothing about the bug. We had shipped a helper for this the day before, tested on our own small lab, and we expected to find such tests in the wild.

We did not find a single one. What we found instead was more useful, and it showed that our own tool was close to unusable on a real test file.

What we ran

Nine repositories: undici, fastify, eslint, express and hono on the Node side, pytest, click, fastapi and llm on the Python side. From each we took the most recent merged commits whose title says "fix" and which change both a source file and a test file, and added commits that carry a coding agent's co-author line. That gave 293 commits. Forty-three were set aside by rules written down before the first run (mostly merge commits where only an inner commit, not the pull request, says fix), which left 250.

For each one, three runs: the parent commit with its own tests, the parent commit with the fix commit's test files copied onto it, and the fix commit. The first run tells you which tests are new. The second is the one nobody did at the time.

The result

What happenedCommitsWith an agent co-author
Tests fail before the fix and pass after22656
Could not get a result on our machine80
Fail before the fix only on another runtime or under the type checker72
Fail before the fix for a reason that is not the bug53
Other: a flaky test, a refactor titled fix, a failure at import, one needing Python 3.1541
Total25062

In none of the 250 could we show a test that passes on the buggy code and would keep passing. These are reviewed, mature projects, and their fix commits do what they say. If you maintain one of them, that is the headline. The headline we had in mind, that regression tests are routinely never seen red, is wrong for this sample, and we are not going to write it.

The 62 agent co-authored commits look like the rest: 56 clean. Three of the five "wrong reason" cases below carry an agent's co-author line, against two among the 188 others. Three is too small a number to hang a claim on.

Five tests that were red for the wrong reason

All five are in pytest. In each, the new test imports a private helper that the fix itself adds. On the commit before the fix that helper does not exist, so the test fails with ImportError, in four cases before a single test in the file runs. Red before, green after. The red has nothing to do with the bug.

We then made each import tolerant and ran the tests again on the old code. In all five commits at least one test now failed on the actual behaviour. So the tests are sound, and the fixes are real. But nobody reading "red, then green" on those pull requests could have known that, because the same result would have come from a test that checks nothing.

One of them makes a good worked example. Issue 14552 reports that after a test directory is moved, a second run fails with assert '…st1/test_a.py' == '…st2/test_a.py'. The fix adds two tests. We ran them at both commits three ways:

Test fileSymptom we asked forVerdict
As committedThe one from the reportInconclusive. The test failed before the fix with ImportError: cannot import name '_imp_fix_co_filename', not with the symptom
As committed/co_filename/, a word from the issue titleAccepted, wrongly. The import error contains the helper's name, and the helper's name contains the word
Import made tolerantThe one from the reportAccepted. Both tests fail before the fix with the reported symptom and pass after

The middle row is our own tool being fooled by a lazy symptom. We had told people to give the symptom from the bug report. We had not told them that one word from the title can match an identifier in an unrelated error.

A pass before the fix is sometimes the machine

Seven commits looked at first like tests that never fail on the bug. Five are hono fixes to types. Their tests pass under vitest on the old code and fail under tsc, with between one and eight type errors that the fix removes. One pytest fix concerns Python 3.12 only and one fastapi fix Python 3.14 only. On those interpreters the tests fail before the fix. On the 3.13 we started with they pass at both commits.

One undici test was recorded as passing on the buggy commit. Run twenty times there, it failed eighteen. A single run before the fix is one sample.

And the eight inconclusive ones are ours: old commits whose tests would not run with today's dependencies, and three where the fix commit's own tests fail on our Mac.

What it did to our tool

The helper we had shipped takes test files, a base revision and a symptom, and answers with one verdict. Handed a real changed test file with its defaults, it gave a useful answer for 9 of the 250 commits. For 158 it said the tests do not distinguish the two revisions, because it wants every selected test to fail before the fix and a real test file is mostly old tests. For another 83 it stopped, most often at a duplicate test name or a skipped test. All of that is documented behaviour. It also means nobody would have used it twice.

The survey needed a different shape: look at each test the change adds, say what it did on the old code, and say why. So that is what version 3.6.1 ships, as a command in the bug-reproduction skill:

node scripts/regression-check.mjs --base origin/main --symptom 'total is 0\.30000000000000004' -- \
  npx vitest run --reporter=junit --outputFile={report} {tests}

It finds the changed test files by itself, carries them onto the base in a git worktree, and reports every new or changed test under one of a few headings: shows the bug, red without the symptom, green at the base, flaky at the base, and missing_at_base for a test that fails only because it uses something the fix adds. That last one is not decided from the error text. The script takes the name out of the error and looks for it in both revisions; the status applies only when the old code does not contain the name anywhere and the new code does. A crash on a name the old code already uses, which may well be the bug, stays a plain red.

It repeats the run on the old code while a new test keeps passing there, and it runs each test command in its own process group, because some buggy revisions leave workers that never exit.

On the pytest fix above it needs no symptom to get the answer:

missing_at_base (2): fails at the base because something the candidate adds does not exist there
  …test_moved_test_file_updates_code_filename[import-lib]
      needs _imp_fix_co_filename: ImportError: cannot import name '_imp_fix_co_filename' …
  …test_moved_test_file_updates_code_filename[pure-python]
      needs _imp_fix_co_filename: ImportError: cannot import name '_imp_fix_co_filename' …

verdict: no_test_shows_the_bug

Then we ran the command over the same 250 commits with its defaults: no symptom, and the test files found by the command itself. It ran 249 of them. For 228 the verdict was red_then_green, where the old helper had given 9 useful answers. We had read 226 commits as red then green by hand, and the command agreed on 225. The one left over is the commit it did not run, which is the last item in the list below. Twelve commits ended as no_test_shows_the_bug, the five pytest fixes among them: for those it printed missing_at_base with the helper's name, and nobody had to supply a symptom. Eight ended as inconclusive, and one as not_fixed because one of its new tests fails on our Mac at the fix commit. Half the commits took eight seconds or less.

It looked at 2,365 new or changed tests. 1,010 failed before the fix and passed after. 430 passed on the old code every time it ran them. 906 could not find a name the fix adds, and 888 of those sit in four pytest commits where the test file imports the new helper at the top, so every test in the file fails with it.

The trial changed the command twice. At first it refused 14 hono commits. Hono keeps its tests beside the code in src/utils/ and src/helper/, and we had those folder names on a list of test support that is never handed to the runner. Now a file named like a test is a test wherever it lives. The other change is about two commits whose only new test is skipped on our Python. The command said no test shows the bug. A test that never ran shows nothing either way, so that is inconclusive now.

Things we got wrong along the way

Limits

One machine. One run per commit, except for undici and fastify, which we ran twice (83 of 85 commits gave the same result). Only commits titled "fix", only the test files the fix commit touches, only projects whose tests run locally in a couple of minutes. Reviewed open-source projects are the easy case for this question; a repository where agents merge their own work may look different, and we have not measured one. A co-author line shows that an agent took part in a commit, not who wrote the test. And where a test failed before the fix with an assertion error, we did not compare the message with the bug report, apart from the pytest example.

The full report has the method, every commit and its result, the hand readings and the scripts. The command is in the bug-reproduction skill, and needs Node and git, nothing else.