A code fix. Put to the test.

A proposed fix isn’t always a working fix.

QualityMax checks whether a code change fixes the problem it was meant to solve. Follow this small online-shop example: a customer is charged delivery when it should be free, then compare a rejected patch with a successful repair.

See what happens

No code knowledge, signup, or installation needed to follow this example.

The example, step by step

A $50 order should cost $50. Not $55.

Imagine an online shop that promises free delivery on orders of $50 or more. An automatic check places the same $50 order before and after a proposed code change.

  1. 1 Start with the problem

    The original code only gives free delivery above $50. At exactly $50, it adds a $5 delivery charge.

    Expected: $50 · Actual: $55

  2. 2 Try a proposed fix

    A patch is a proposed code change. This one mistakenly raises the free-delivery threshold to above $100, so the $50 order still costs $55.

    The problem remains.

  3. 3 Check the same order again

    A test is an automatic check of expected behavior. The same check fails before and after this change. QualityMax reports needs human review.

    This proposed fix did not pass.

The downloadable sample runs this rejected patch first, then a repair that changes > 5000 to >= 5000. The repair makes the same $50 test pass. This page does not generate a new fix or run your code in the browser. You can inspect every file below, or reproduce both checks on your own machine.

Before and after

The original file, rejected patch, and successful repair

These are the complete files used in the walkthrough. Amounts in the code are in cents: 5000 means $50 and 500 means $5. The test stays the same for both changes.

1. Original file

invoice.py — calculates an order’s total.

Delivery is free only above $50. The $50 order is overcharged.

def invoice_total(subtotal_cents: int, member: bool = False) -> int:
    if subtotal_cents < 0:
        raise ValueError("subtotal must be non-negative")
    discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)
    shipping = 0 if subtotal_cents > 5000 else 500
    return discounted + shipping
Download original invoice.py

2. After the proposed change

invoice.py — with the unsuccessful patch applied.

Delivery is free only above $100. The $50 order is still overcharged.

def invoice_total(subtotal_cents: int, member: bool = False) -> int:
    if subtotal_cents < 0:
        raise ValueError("subtotal must be non-negative")
    discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)
    shipping = 0 if subtotal_cents > 10000 else 500
    return discounted + shipping
Download rejected invoice.py

3. Successful repair

invoice.py — with the free-delivery boundary corrected.

Delivery is free at $50, so the same order now totals $50.

def invoice_total(subtotal_cents: int, member: bool = False) -> int:
    if subtotal_cents < 0:
        raise ValueError("subtotal must be non-negative")
    discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)
    shipping = 0 if subtotal_cents >= 5000 else 500
    return discounted + shipping
Download repaired invoice.py
See the unchanged test file — test_invoice.py

The file checks orders just below $50 and at exactly $50. The recorded before-and-after run selects the second check: a $50 order must total $50.

from invoice import invoice_total


def test_paid_shipping_below_boundary():
    assert invoice_total(4999) == 5499


def test_free_shipping_boundary():
    assert invoice_total(5000) == 5000

Download unchanged test_invoice.py

Inspectable recorded evidence

Why one change fails and the repair passes

Rejected patch: the same check failed twice

The $50 order should total $50. Both versions charge $55. This change is not a verified fix.

Observed 2026-10-04 on Darwin arm64, CPython 3.11.8, pytest 8.3.5.

  • Original file (base selected test): 1 failed
  • Proposed file (head selected test): 1 failed
  • Additional checks (independent oracle): 4 passed, 4 failed

The additional checks test other parts of the shop’s pricing rules. They are separate supporting evidence. The recorded status is needs_human.

The default walkthrough exits 0 only after observing both the rejected patch and the successful repair outcomes. It does not mean the rejected patch passed.

Repair: the unchanged check passes

The local, synthetic, unsigned walkthrough starts from another copy of the same original file. Its selected $50 test fails before the repair, then passes after the boundary changes to >= 5000. Its independent oracle reports 8 passed.

This successful repair is a separate fixture outcome. It does not make the rejected patch a verified fix.

Local evidence files

Your machine → artifacts/verified-patch-sample/<run-id>/broken/ and artifacts/verified-patch-sample/<run-id>/repair/

Each directory contains the receipt, selected-test results, independent oracle, applied patch, and original/proposed source snapshots for that one fixture.

  • sample-result.json — verdict, status, and hashes
  • base-selected.xml — selected-test JUnit before patch
  • head-selected.xml — selected-test JUnit after patch
  • head-oracle.xml — independent JUnit contract check
  • candidate.patch — applied sample patch
  • base/ and head/ — generated source snapshots

Optional · for developers

Run the rejected patch and successful repair

The first run installs four pinned sample dependencies into a temporary environment. It then checks the rejected patch and successful repair separately, using independent copies of the original source and the same unchanged test. It does not install the QualityMax application.

  1. 1 Check prerequisites

    Python 3.11 or 3.12, Git, a working venv, macOS or Linux, and internet access to PyPI.

  2. 2 Inspect the standalone artifact

    Download verified_patch_sample.py before you run it. Inspect the public bundle for the reproduction record.

  3. 3 Run both checks

    python3.11 verified_patch_sample.py --bootstrap

    The output identifies each original file, proposed file, unchanged test, and receipt. Using Python 3.12? Substitute python3.12. Only pytest 8.3.5, iniconfig 2.1.0, packaging 24.2, and pluggy 1.5.0 are installed in a temporary environment.

Limitations

What this does not prove

Troubleshooting

If the run stops early

Use the actual output printed by the runner and its generated run directory to identify setup issues, then run again. A setup failure may produce no receipt. A timed-out execution can write execution_error in JSON and a needs_human verdict, then exit 2; it is not a completed reproduction.

Setup failure: Python, Git, or dependency install

The runner reports supported Python versions and bootstrap failures directly. Confirm Python 3.11 or 3.12, Git on your PATH, and PyPI access; then use the output from your own run to decide the next step.

Execution error or timeout

Read the generated JSON and the command output from this run. An execution error is distinct from a completed fixture result; do not infer a passed or failed patch from it.