Can a coding assistant fix a failing test for the wrong reason? A QA team’s guide to comparing repair costs

If your QA team is choosing a coding assistant, ask what a repair costs after someone has checked the behaviour it might break. An assistant can turn a bug report into a candidate patch in minutes. Your job is to decide whether that patch is safe to merge. Here you will run the same regression checks on three candidate implementations, then build a worksheet that counts failed attempts and reviewer time.

Author: Mia Lu, Ofox, https://ofox.ai/

A customer reports that 05/06/2026 came back as May 6. The support ticket says June 5. A coding assistant could fix that example by swapping the month and day in one format string. Before you merge the patch, try importing April 13 from a US feed. If that date disappears, the one-line fix has traded a visible error for silent data loss.

1. Write down the promise before asking for a patch

For this exercise, the importer receives slash-separated dates from two older feeds. It uses day/month/year when both readings are valid. If that reading is impossible, it tries month/day/year. If neither reading is a calendar date, it returns None. A production importer with reliable locale metadata should use that metadata. Here the fallback is a requirement deliberately chosen to make the regression reproducible.

When you set up the trial, give the assistant that contract, the broken implementation and the reported case. Keep the rest of the cases in a separate test harness outside its workspace. The contract must be visible: an assistant cannot infer the intended locale policy from a single ambiguous date. Keep the expected answers private until scoring so that a repair cannot simply special-case the examples.

Can a coding assistant fix a failing test for the wrong reason? A QA team’s guide to comparing repair costs

2. Run three candidate implementations

Save this listing as dates.py and run python3 dates.py. It needs only the Python standard library. The three implementations differ only in the sequence of format strings. They were constructed for this exercise. Nobody paid for model calls to produce these results.

from datetime import datetime
PUBLIC = [("05/06/2026", "2026-06-05")]
HELD = [
    ("04/07/2026", "2026-07-04"),
    ("13/04/2026", "2026-04-13"),
    ("04/13/2026", "2026-04-13"),
    ("29/02/2024", "2024-02-29"),
    ("29/02/2025", None),
    ("31/04/2026", None),
]
def parse_with(text, formats):
    for fmt in formats:
        try:
            return datetime.strptime(text, fmt).date().isoformat()
        except ValueError:
            continue
    return None
for label, formats in [
    ("baseline", ["%m/%d/%Y"]),
    ("swap only", ["%d/%m/%Y"]),
    ("day first with fallback", ["%d/%m/%Y", "%m/%d/%Y"]),
]:
    for group, cases in [("public", PUBLIC), ("held", HELD)]:
        passed = sum(parse_with(s, formats) == y for s, y in cases)
        print(f"{label} | {group}: {passed}/{len(cases)}")

Observed output

baseline | public: 0/1
baseline | held: 3/6
swap only | public: 1/1
swap only | held: 5/6
day first with fallback | public: 1/1
day first with fallback | held: 6/6

3. Read the failures one input at a time

The baseline passes three hidden cases, including both impossible dates. That is a reminder that an aggregate score can flatter the wrong implementation: a parser that rejects everything will get some answers right. The swap passes the public example and five hidden cases. Its failure on 04/13/2026 matters because no thirteenth month exists. Under the stated contract this input has a valid and unambiguous interpretation. The swap silently returns None instead.

The fallback gets all six hidden cases right. Notice why the ordering matters. Both formats accept 04/07/2026, so the first successful parse decides whether the result is July 4 or April 7. A test that only verifies that a date was returned would miss this bug in either direction. Assert the exact ISO date and separately assert None for an invalid input. Run the file once more with the two fallback formats reversed to see which assumptions your tests actually protect.

4. Compare assistants without losing the failed attempts

For a real comparison, give each assistant the same initial code, contract and public test in a clean workspace. Set the retry cap before starting. Record the code for each attempt before running the private harness. Decide in advance whether a retry sees the failing inputs or only the failed requirement. Giving one assistant the private inputs on its second try changes the task, so record that condition separately.

Use one worksheet row per attempt. Include task ID, attempt number, assistant and model version, public result, private result, billed amount and reviewer minutes. For the swap above, a row would read: date-import, attempt 1, constructed patch, public 1/1, private 5/6, no billed call. Leave the reviewer time blank unless someone measured it. A real experiment should take a charge from the provider’s usage record and keep any estimate explicitly labelled.

Add the charges for every attempt, even when it timed out or yielded an unusable patch, then divide by the number of distinct tasks whose final repair passed the contract. A task repaired on the third attempt contributes three costs and one accepted repair. If nothing passes, report the total spent and zero accepted repairs. Report review minutes separately so a low API bill does not hide half an hour of debugging.

What to take back to your QA team

One passing ticket tells a reviewer that the reported example works. To sign off this importer, the reviewer also needs to know that valid inputs still survive, impossible dates still fail and ambiguous inputs follow the agreed policy. Those three questions cost only six extra cases here, and one of them catches a regression the customer who filed the ticket could never have shown us. When you compare assistants, put the total billed across attempts beside the number of accepted repairs. Keep reviewer minutes visible as a separate cost. You can then tell whether a tool saves your teamwork or merely moves it from implementation to review.

About the Author

Mia Lu works on growth and developer content at Ofox, a platform that provides access to multiple AI models through an API. The Ofox content team prepared this tutorial with AI assistance and verified the Python output. The example uses synthetic inputs and does not benchmark a commercial tool.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.