If you’ve been head-down on a task for too long, lift your head up to make sure you’re going the right way. Don’t do well what you shouldn’t do at all.
Another lesson learned from fixing a bug.
A customer emailed my team about an issue of page not found when clicking some links. A quick reproduction of the issue tells me that it’s a good time to execute some customer obsessions and get it fixed quickly as it’s caused by my pull request. So I naturally followed my instinct to revert the “culprit” piece of code and was about to wrap up the day for work. However, the compiler doesn’t let me go. Guess what? I trusted my gut again and reverted more code. And this is the exact beginning of going down into a rabbit hole of reverting changes only to revert more changes.
After an hour or two, I finally realized that I probably headed into the wrong direction as I can sense my unusual calmness starts to fade away little by little. I concluded that there’s some refactoring done by others and it needs to be incorporated, so I looked up for help accordingly. Luckily I got a prompt response confirmed that any future change should be based upon existing refactoring, thus I have to shift the direction entirely, but this time, I was able to make the compiler happy within 15 to 20 minutes.
Would we wrap up the entire story as a dumb guy who gets trapped by his unreliable guts and is saved by his coworker through accepting the reality that sometimes the project goes on and code may change, time travel back doesn’t always work? Remember that the issue is a link is broken, is it possible that there’s a good alternative to use? And it turns out that’s the case, that I only need to swap the link. Alright, what a bummer…
My commit is the trigger of the bug, but not the root cause. The root cause is simply a broken link that needs to be substituted. Technically, it’s a one liner fix that can be done within minutes, but without diagnosing the issue correctly, it costs hours of waste of time, even though the initial diagnosis is slower than taking mindless actions. Simple yet profound … 🥲