A test written alongside a fix often passes whether or not the fix is there, and then it proves nothing. So every bug fix must come with a test that reproduces the bug, and the coordinator checks that the test can actually fail. It takes the fix out, runs the test and watches it fail, then puts the fix back.

Setup

  1. The coder's report names the test and quotes a short piece of the failure message it expects to see without the fix. With no prediction, the work goes back to the coder.

  2. The fix hasn't been committed yet, so never take it out with git restore. That would erase it permanently. Save it as a patch instead, and reverse it:

    git diff HEAD -- <changed files that are not tests> > "$TMPDIR/fix.patch"
    git apply -R "$TMPDIR/fix.patch"
    
  3. Run only that test. It counts as failed only if the runner reports that test failing with the predicted message. A build error, a crash, a different failing test, or zero tests run doesn't count.

  4. Put the fix back and check nothing else changed:

    git apply "$TMPDIR/fix.patch"
    

    Record a fingerprint of the copy (for example, a hash of git diff HEAD) before step 2 and again now. If they don't match, the pipeline stops.

  5. Run the test again. It must be reported as passed, not skipped and not missing.

Notes

  • If the test stays green with the fix removed, the test is wrong. It goes back to the coder, who must fix the test, not the code.
  • Sometimes the project won't build with the whole fix removed, because the test calls something the fix added. Then the coder writes a small patch that disables just the piece the test depends on. The judge checks that this was a fair break.
  • Run this check for bug fixes, and for any test a reviewer doubts can fail. A test for a new feature fails against old code simply because the feature isn't there yet, so that run proves nothing.
  • If the coder claims a bug can't be unit-tested, it must name the specific reason. "Hard to test" is rejected.
Loading SilverBullet…