Nadia’s short refund started as an email from Grace and ended as a one-line fix in refundValue(), with a saved check that printed 450p before the fix and 600p after it. Grace’s shelf count went the same way earlier in the course, from a negative number on the staff desk to a refused adjustment.
Two bugs in different modules took the same route from report to checked fix. The shelf count never needed its history, but Nadia’s refund did, and you’d practiced that part on the price floor and the basket limit. When the next report lands in code you didn’t write, you know where to start and what counts as done.
The Routine for the Next Bug Report
A bug report in code you didn’t write can feel like a reason to read all of it. The routine below gives you an order to work in instead, and every step ends in something you ran or logged:
- Reproduce it. Split the report into what someone did, what they saw, and what they concluded, and reproduce the bug from the first two. Write steps that fail every time from a known starting state anyone can re-create (here, a fresh
npm run seed), cut down to the records that matter. When the bug appears only sometimes, vary one condition at a time, as you did when -20 on book-1 reproduced the bug but -5 didn’t. - Locate it at the seams. State the expected and actual results exactly, and form a hypothesis that a check could prove wrong. Log the value where one module hands it to the next, then read closely only the part where a good value turns bad. Record each check and what it ruled out.
- Halve when the seams don’t point you at a line. Choose what to halve from what you know. In a pipeline, check the value at its midpoint, then at the midpoint of the failing half, and repeat. Split a large input the same way, keeping the half that fails. For the history, check a good release and a bad one yourself, then let
git bisect runand your check find the first bad commit. - Ask the history why. Before you change a puzzling line, follow it with
git blameto the commit that introduced it, or start from the commit thatgit bisectidentified. Read that commit’s diff and its linked issue or pull request, as you did for the legacy price floor insrc/orders/pricing.jsand for pull request #24. - Fix the cause, and nothing more. Watch your check fail on a new branch, then change only the lines needed to fix the cause. Go through every caller and invariant the change touches, rerun the reproduction and
npm test, and leave cleanup, like renamingdelta, for a separate change. - Hand it over with your evidence. Say what the reproduction, the cause, the commit, and the fix each rest on. Put anything you didn’t confirm with a run under Not checked yet, as you did in Nadia’s sign-off.