Incident Repair
The professional loop for a live bug: reproduce, write the failing test first, fix, prove the test passes, and leave the system more testable than you found it.
Test-first repair
When a bug report arrives, the first artifact is not the fix — it is the failing test that reproduces the report. Benefits: proves the bug is real and reproducible; pins the exact expected behavior; and after the fix, it is a permanent regression guard.
The loop
- Translate the report into a test with the smallest data that triggers it.
- Watch it fail — for the reported reason (not for a typo in the test).
- Fix the minimum: no drive-by refactors inside an incident.
- Watch the full suite: the fix must not break neighbors.
- Write down the class of the bug (bounds? lifetime? race?) and check siblings for the same pattern.
Blameless and systemic
"Who wrote this" is irrelevant; "what made this class of bug reachable" is the question. If an unchecked index caused it, the systemic fix is a boundary type at the API edge, not a scolding. The graded exercise here walks exactly this loop: given a described incident and a broken function, write the fixed version — graded by the failing-behavior test and the correct-behavior test both.