{"slug": "my-tool-for-finding-date-bombs-in-tests-was-stuck-on-the-day-i-wrote-it", "title": "My Tool for Finding Date Bombs in Tests Was Stuck on the Day I Wrote It", "summary": "A developer running a daily autonomous Claude Code agent on a Windows PC found that their date-bomb detection tool—which shifts the current date forward by 1, 2, 3, 4, 5, 9, 30 and 100 days and reruns the full test suite at each—was hard-coded to August 20, the day it was written, so seven of its eight probe dates were already in the past by October 8. After fixing the base date to use date.today() and patching a second bug where a shared helper wrote a fake-date conftest.py into the repository root, the tool ran 2,915–2,916 tests across eight future dates with no failures, and new self-tests caught all four deliberately introduced breakages.", "body_md": "*A field note from the autonomous Claude Code agent I run every day on one Windows PC. The numbers come from its own ledgers, not from memory.*\n\n**Free to read first:** a PDF sample of the book behind this setup — its first 3 chapters: [https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample](https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample)\n\nA date bomb is a test that passes today and fails on a later date: an expiry check, a weekly cycle, a cutoff someone wrote as a fixed day. My project has a small tool for finding them. It moves today forward by 1, 2, 3, 4, 5, 9, 30 and 100 days and runs the whole test suite at each date. Its first run, on August 20, found a test that would have turned red four days later.\n\nI opened the tool while looking for material for a post. The base date was hard-coded to August 20, the day the tool was written. The comment next to it said the tool should not depend on today.\n\nSo on October 8 the eight dates it tried were August 21 to 25, August 29, September 19 and November 28. Seven of the eight were already in the past. A tool built to catch tests that only work today only worked on the day it was written.\n\n`date.today()` and left `datetime.now()` alone. Before fixing anything, I ran a quick copy of the same approach on six future dates of my own choosing. Every date showed the same two failures, in two tests whose shared helper read `conftest.py` at the top of the repository and removed it at the end. While it ran, any other pytest started in that folder saw the fake date too, and my agent's scheduled runs and its CI hook both start pytest there. If the run was interrupted, the file stayed.\nNumber 3 went off while I was writing a test for it. I already knew about it. To watch the new test fail first, I loaded the old file inside a test. Loading it started the full eight-date loop and wrote a `conftest.py` that set today to August 21. I stopped it within two minutes and deleted the file. Any other test run in that folder during those minutes would have seen August 21.\n\n`--base 2026-08-20` repeats an old run.`-p` for that one run. Nothing is written into the project, and nothing is left behind if you stop it.`main()` function behind a main guard.\nOn October 8 the fixed tool ran the suite at October 9, 10, 11, 12, 13 and 17, November 7, and January 16, 2027. All eight dates passed, each with 2,915 or 2,916 tests. No date bombs this time.\n\nThe tool now has tests of its own: importing it runs nothing, with no base date every date is in the future, and a fake project passes only if both clocks return the shifted day and nothing is written into it. I then broke the tool on purpose in four ways: fixed base date, `datetime.now()` left alone, fake date written into the repository, pandas not loaded first. The tests caught all four.\n\n**Where this comes from.** Every post here comes from one setup I run daily: a CLAUDE.md, memory files the agent reads before it touches anything, and a separate auditor agent that returns PASS or FAIL. The first 3 chapters of the book that walks through it are free as a PDF: [https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample](https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample)\n\nThe full edition is 11 chapters plus 4 ready-to-use templates (CLAUDE.md starter, memory files, auditor checklist, measurement guide) and a hands-on section for every chapter, $19 as a PDF: [https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code](https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code)\n\nQuestions about the setup are welcome in the comments — I'll answer with what actually happened, not theory.", "url": "https://wpnews.pro/news/my-tool-for-finding-date-bombs-in-tests-was-stuck-on-the-day-i-wrote-it", "canonical_source": "https://dev.to/dbsoul/my-tool-for-finding-date-bombs-in-tests-was-stuck-on-the-day-i-wrote-it-5af7", "published_at": "2026-10-20 04:10:04+00:00", "updated_at": "2026-10-20 04:16:41.972493+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Claude Code", "pytest", "Windows", "pandas"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/my-tool-for-finding-date-bombs-in-tests-was-stuck-on-the-day-i-wrote-it", "markdown": "https://wpnews.pro/news/my-tool-for-finding-date-bombs-in-tests-was-stuck-on-the-day-i-wrote-it.md", "text": "https://wpnews.pro/news/my-tool-for-finding-date-bombs-in-tests-was-stuck-on-the-day-i-wrote-it.txt", "jsonld": "https://wpnews.pro/news/my-tool-for-finding-date-bombs-in-tests-was-stuck-on-the-day-i-wrote-it.jsonld"}}