In this lesson, you watched a reviewer rank a queue of five changes by risk before reading any of them closely. The five come from the history of main and are already merged: pulls #18, #22, #24 and #25, and Edsger’s formatter commit, 9dd98af. The video pictures them arriving together on one morning. You know how #24 ended, since you tracked its refund bug down with git bisect, so it’s ranked on what a reviewer could see before the merge.
Key Points
- Rank first, then read. Giving every line the same care means your time goes by size. The formatter’s 473 lines would eat most of the morning, and the one-line refund change in #24, fourth in line, would wait until you’d run out of time. Spend your time where a mistake would cost the most.
- Ask each change the same questions. What does it reach? Can a revert undo it? Does it touch stored data, money or security? Is it new logic, code that now decides differently? Does a test run what it changes?
- Large and harmless can be a skim. The formatter is the biggest change, yet in the ordinary diff each line comes back with only its indentation changed, and
git diff -wagrees: nothing left. An emptygit diff -wcould still hide a change, since it also ignores spaces inside strings. - A loud, undoable change can be a skim too. Pull #18 renames the weekly report’s npm script from
reporttoweekly-report. Only people who type the command use it, andgit grep -n 'npm run report'finds one stale reader,README.md:35, which you found when you checked #18 against its intent. The old command fails loudly withnpm error Missing script: "report", and a revert undoes the rename. - Wide reach with low stakes gets a light read. Pull #22 runs on every order. But a mistake there declines a basket before any stock or money moves: in
createOrder(),orderLines()runs on line 15 ofsrc/orders/create.js, beforereserve()on line 23 andpayOrder()on line 24. A revert undoes it, so it gets a light read. - Money that can’t come back gets the close reads. Pulls #24 and #25 both decide how much money goes back to a customer, and a refund that’s sent can’t be reverted.
- The authors on the cards decide nothing. Margaret built the refunds code, but that’s no reason to skim her changes, or to read them harder. The same diff gets the same review, whoever wrote it.
- A test counts only if it runs the behavior that changed. Edsger’s note on #24 says the ordinary return still passes, and the refund area has two tests. Check with a run whether either one runs what #24 changed.
- Pull #24 is untested. Pull #24 swapped the paid items subtotal for the gross subtotal. With the paid one back in
src/refunds/allocation.js, all fifteen tests still pass. At #24’s own commit, before #25 added its test, the old line passes too: fourteen of fourteen. No test can tell the change from the line it replaced.git restoreputs the file back. - Pull #25’s final-penny case is covered. Take out the line that hands over the last penny, and its own test fails. That’s one case, not the whole change, but it’s more evidence than #24 has.
- So #24 goes to the top. It’s one line that sends money out, and no test would catch a mistake in it. Then #25, a light read of #22, and a skim of #18 and the formatter. Ranking takes minutes, and the close reads get most of the morning. The close read of #24 starts where no test reaches: an order with a complimentary book, the case Edsger’s note says he never tried.
- Write the triage down in your map’s Reviews section, so whoever reads your review knows what you read closely, what you skimmed and why. Give each line its reason and its evidence, such as a run or a line you found.
- The rule: rank by what a mistake would cost, check every coverage claim with a run, then read from the top.
The Coverage Checks
This is the check on #24, from your clone on main. Line 4 of src/refunds/allocation.js is let denominator = order.grossSubtotal;. Put back the old line from before the change, let denominator = order.paidItemsSubtotal;, then run the tests: