๐๐ถ๐ ๐ง๐ผ๐ฑ๐ฎ๐ ๐ช๐ฎ๐ ๐ฌ๐ฒ๐๐๐ฒ๐ฟ๐ฑ๐ฎ๐
A timezone bug almost broke my booking platform.
I lead a platform where venues sell activities. We had a strange issue. For one venue, the activity list disappeared when users clicked an activity card. I could not reproduce this error myself.
I used Claude to look at our database. The AI noticed the venue was in Australia. Since our app is US-based, the AI guessed a timezone issue. It was right.
The problem was our logic for past days. A user in the USA looking at an Australian venue was actually looking at the venue's yesterday. Our code excluded all activities from past days. This caused the UI to crash and show nothing.
I had to fix this without breaking existing features. I could not just remove the constraint because the blast radius was too large. I did not know how it would affect other parts of the system.
Instead, I used a specific fix:
- For past days, the system still sends all activities.
- It sends them with empty time slots.
- The UI no longer breaks.
- The availability remains unchanged for past days.
I used unit tests to pin the bug. I created a red test to fail and a green test to confirm the fix.
AI helped find the cause, but it missed the bigger picture. It did not see that our architecture allowed this bug to exist. AI needs clear rules and constraints. It cannot see problems that span across different layers of your system.
Two lessons from this:
- Define your blast radius. You must understand the exact impact of a change before you deploy it.
- Do not let AI work blindly. You must understand your code better than the AI does.
I also noticed our code for fetching activities is messy. I want to refactor it to separate activities from availability. But I will not do it right now. Refactoring just because you hate your code causes outages. I will wait for a specific trigger before I change the architecture.