Verifying a proposed fix
Understand the idea
A fix that makes an error message disappear is not automatically correct. Root cause and symptom suppression are different outcomes.
When the alarm goes quiet
AI patches love quiet. An empty catch, a broad default, a ?. chain that turns a programming mistake into undefined - each can make the demo stop throwing. Your verification question is sharper: is the gone, or only the alarm?
AI Lab · verify or suppress
AI fix: the TypeError is gone
cartTotal throws TypeError: Cannot read properties of undefined (reading 'price') when a missing catalog id leaves item undefined. A teammate pasted the error into a chat model and accepted this patch because the error message disappeared.
Proposed fix
function cartTotal(cart, catalog) {
try {
return cart.reduce((sum, line) => {
const item = catalog[line.id];
return sum + item.price * line.qty; // still blows up if item is missing
}, 0);
} catch {
return 0; // error message gone - total quietly wrong
}
}Wrap the whole reducer in try/catch and return 0 on any error. The TypeError no longer surfaces.
What a real verification checks
Re-run the failing case with an independently chosen expectation. Confirm the invalid state is rejected, repaired, or explicitly allowed by product policy. Then re-run a previously working case so the patch did not trade one bug for another. Message absence is a weak signal by itself.
| Patch shape | What goes quiet | What remains |
|---|---|---|
| empty catch → 0 | TypeError | Wrong total / missing item |
| swallow fetch error | Network rejection | Stale UI state |
| default empty array | Undefined crash | Lost distinction: empty vs failed |
| validate id + signal | Nothing useful | Invalid line cannot silently price |
Common suppression patterns
Watch for catch blocks with no log, optional chaining used to dodge missing required data, and "return null and move on" suggestions that erase the difference between empty and failed. These patterns show up because they make screenshots look healthy.
Questions to ask every proposed fix
What invalid state existed? Does that state still exist after the patch? If it does, is it now explicit? What would a user or operator see? If the answer is "nothing, forever," you may have muted a production signal.
Only then ship the patch
Ship when the failing case passes for the right reason and the nearby cases still pass. That is verification. Anything less is optimism dressed as a diff.
Mental model
FOLLOW THE VALUE
Silence is not success.
01 / 03Trace the transformation
Live example
A missing catalog id yields 0 through an empty catch - a quiet wrong total labeled suppressed.
Your console output appears here.
Guided challenge
Label the patch honestly
The second log says fixed. Change it to suppressed.
Your console output appears here.
EXPECTED CONSOLE OUTPUT
0 suppressed not-root-cause verify done
Hints 0/2
Use all hints or make 3 failed runs (0/3).
Free sandbox
Make a variation, test an assumption, or break the example on purpose. This draft is saved separately.
Your console output appears here.
Quiz
A quick check for understanding. Retry as often as you like; your learning path stays open.
Ready to call this one understood?
Mark this lesson complete to earn 200 XP. You can always revisit it.