Garfield's worst nightmare (or how a API difference caused a bad bug)
summary
A Discord bot that posts Garfield daily uses cached image-hashes keyed by days-since-first-comic; a recent rewrite swaps date libraries and computes keys by subtracting dates as an interval but only reads the interval’s days field, so different date differences collapse to the same key and the bot posted the 9/11 strip instead of the current comic. The fix is to use a proper day-count or epoch representation, add a collision test (300k days runs in ~1s), and add unit tests.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 0:44Garfield bot purpose
- 1:51Comic URL and date system
- 3:38Unexpected comic date bug
- 5:24Time vs EOS datetime libraries
- 7:11Root cause of key collision
- 8:33Why bug occurred with EOS
- 9:14Lessons learned and testing
- 10:36Writing the postmortem
- 12:21Second API change and redirect
- 14:30Q&A








