Developer Ships Bug After Test Passed Only Due to Minimal Single-Commit Setup
A developer discovered a bug in a paid git worktree cleanup script after realising their verification tests had passed only by accident. The script used git cherry to detect squash-merged branches, but git cherry matches on patch-id, meaning it correctly identifies a one-commit squash merge while failing silently for multi-commit squash merges. The developer's test suite used the smallest possible reproduction case — a single-commit branch — which happened to be the only scenario where the broken logic worked. Rather than risk falsely deleting a user's working tree with an unreliable check, the developer removed the squash-merge detection entirely and added a visible warning when the GitHub CLI tool is unavailable. The incident highlights how minimising test inputs can inadvertently strip out the very property being tested, making 'it worked' an unreliable substitute for genuine verification.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in