# FixFork run report

- Repo: `examples/demo-repo`
- Test command: `python3 -m unittest discover -s tests`
- Baseline: **FAILED (2 of 2)**

## Branches

| Branch | Status | Tests | Lines changed | Tokens | Cost ($) |
|---|---|---|---|---|---|
| 1 | green | OK (2 tests) | 1 | 0 | 0.00000 |
| 2 | green | OK (2 tests) | 3 | 0 | 0.00000 |
| 3 | error |  | 2 | 2850 | 0.00053 |

## Verdict

- Winner: **branch 1**
- Why: branch 1 passed the tests (OK (2 tests)) with 1 line(s) changed
- Tokens: **7543** total (4693 diagnosis) · cost ~ **$0.0042**

## Hypotheses (raced)

- **1. Discount sign inverted** — The discount is incorrectly increasing the subtotal because it multiplies by (1 + discount) instead of (1 - discount), causing discounted orders to cost more than the original. _(files: src/tax.py)_
- **2. VAT applied after discount instead of before** — The intended calculation is to apply VAT first, then the discount. The current implementation applies discount (incorrectly) then VAT, leading to an inflated total. Swapping the order fixes the logic. _(files: src/tax.py)_
- **3. Unnecessary vat_rate parameter shadows global constant** — The function defines a vat_rate parameter with default VAT_RATE, but the global constant is sufficient. Keeping the parameter can cause confusion if a different value is passed. Removing the parameter and using the constant directly simplifies the code and eliminates potential misuse. _(files: src/tax.py)_

## Winning diff

```diff
diff --git a/src/tax.py b/src/tax.py
--- a/src/tax.py
+++ b/src/tax.py
@@ -6,5 +6,5 @@
 def order_total(prices, discount=0.0, vat_rate=VAT_RATE):
     """Total for an order: prices summed, discount applied, then VAT added."""
     subtotal = sum(prices)
-    discounted = subtotal * (1 + discount)
+    discounted = subtotal * (1 - discount)
     return round(discounted + discounted * vat_rate, 2)
```

## Notes

- diagnosis model proposed 3 hypotheses (4693 tokens, $0.0037)
