A practical check for AI builders
Did the AI fix actually fix the problem?
A change to the code is the start. A useful check shows that the reported problem happens before the change and behaves as expected afterwards.
1. State the expected behaviour
In our fictional shop example, delivery is free on an order subtotal of A$100 or more. A smaller order has an A$9.95 delivery fee. The subtotal excludes delivery.
2. Reproduce the fault
At exactly A$100, the original function returns A$9.95. That contradicts the stated rule.
function deliveryFee(orderTotalCents) {
if (orderTotalCents > 10000) return 0;
return 995;
}3. Make a focused correction
The condition uses “greater than” when the rule says “at least”. The example patch changes > to >=.
function deliveryFee(orderTotalCents) {
if (orderTotalCents >= 10000) return 0;
return 995;
}4. Check the surrounding cases
| Order subtotal | Expected delivery | Before | After |
|---|---|---|---|
| A$0.00 | A$9.95 | Pass | Pass |
| A$99.99 | A$9.95 | Pass | Pass |
| A$100.00 | A$0.00 | Fail | Pass |
| A$100.01 | A$0.00 | Pass | Pass |
The page’s interactive example calculates these results by running the displayed functions. Its patch is prewritten. This is a fictional demonstration, not a customer case study, a live AI repair or proof that a complete app is fault-free.
Apply the same questions to your project
- Can you describe what should happen and what happens instead?
- Can you trigger the same problem again?
- Does the proposed change fix that problem?
- Do the relevant existing checks still pass?
Tell us where you’re stuck
Spotted Ridge Engineering is developing an AI-powered service with a planned A$19.99 price for one eligible fix. Early-access enquiries are open. Assessment, payment and repair delivery are not yet offered as a live automated transaction.
Enquire about early access