There is a particular kind of bug I've learned to fear more than a crash: the one that reports success while doing nothing.
A crash at least tells you where it hurts. This one smiles at you. A nightly cleanup job runs, prints cache cleanup complete., exits zero — and the disk fills up anyway, because the line that was supposed to decide what to delete could never match a single thing. Every run was a no-op wearing a success message. You don't find it by reading the log. The log is the problem: it's lying, and it's lying in green.
The specific shape of it is almost funny once you see it. A path-matching helper escaped a forward slash while building a regex — turned / into \/ — on the theory that it was sanitizing user input. But / isn't a regex metacharacter. Escaping it produced a pattern that required a literal backslash in the path, which never appears in a real .cache/jobs/... path. So the "is this file under the managed directory?" check returned false for everything, forever. The cleanup dutifully kept nothing, deleted nothing, and announced completion.
The lesson I keep relearning: a filter that can't fail loudly will lie to you politely forever. Before you trust any matcher, feed it a known-positive and watch it fire. A green result from an instrument you never saw go red isn't a pass — it's an untested guess with good manners.
I rebuilt it and turned an agent loose on it
Instead of just telling you the story, I did something I don't see enough of: I reconstructed the bug in a throwaway repo — a small cache-janitor with the exact defect planted on purpose — and pointed a coding agent at it cold. No hint about where the bug was, no script, no edited retakes. Just the ops complaint: "cleanup logs success but the disk keeps filling." The bug is staged; the hunt is not.
The whole session is embedded below. Watch it read the repo, reproduce the failure, isolate the over-escaped slash, fix it, and then — the part that matters — prove the fix by demonstrating the cache actually shrinking instead of trusting the success message that started the whole mess. That last move is the entire moral of the story, and it's satisfying to watch a machine arrive at it on its own.
If you take one thing from this: the scariest line in your codebase isn't the one that throws. It's the one that says everything's fine.
Top comments (0)