It’s always “fun” trying to find bugs in code. Very few people intentionally make bugs; sometimes they’re just poorly understood features.
But the problem with debugging, especially your own code, is that you have to accept that the code you’re reading and think you understand is behaving differently. You have a mental model of the way the code should behave but reality is giving you a different picture. Some times reality is right.
Other times you get feedback from the code but the data you get is wrong — or at least interpreted incorrectly. If you start making decisions based on data that turns out to be janky, well, those decisions are transitively janky as well. Reality sometimes isn’t as real a reality as it seems. (The underlying reality is real, but sometimes you see it wrong.)
The real key is getting your mental model the situation in sync with the reality.
Came up at work too often this week…