Audit every background job for run-twice safety and add idempotency guards
A payment job ran twice after a worker died before it acknowledged the message, and 37 customers were charged two times. The engineer then spent two weeks checking all 140 Celery jobs in a six-year-old Django app with Claude Code. First, Claude filled in a strict form for each job, with file and line evidence, and had to say "unknown" when it wasn't sure. The engineer wrote the one dedup guard by hand, a unique key in Postgres, and Claude added it to the risky jobs about ten at a time. A test that runs every job twice then found 14 jobs the audit had missed. Claude's blind spot was hidden side effects like Django signals, save() overrides, and database triggers.
Tools used
- Claude Code
- PostgreSQL
- Celery
- pytest
Sources (2)
- Original
- Found via