What the bug taught me

The fix was two characters. Finding it took two days. Somewhere in that ratio is most of what I've learned about this work.

It was a caching bug — the kind where every part is correct in isolation and wrong together. I read the cache layer a dozen times and saw nothing, because the bug wasn't in the code I was reading. It was in an assumption I'd made so early I'd stopped seeing it as a choice: that a key was unique, when it wasn't.

The lesson isn't “check your assumptions,” which everyone says and no one can act on. It's narrower than that. When the code looks right and the behaviour is wrong, stop reading the code. The mistake is upstream of the file you're staring at.