relay
A Postgres-backed task queue with exactly-once side effects.
Problem
Most task queues promise at-least-once delivery, which means a side effect can run twice. When that side effect charges a card or sends an email, the duplicate is the bug. The case that breaks naive designs is a worker that dies mid-task while still holding a lease.
Approach
relay leases jobs with SKIP LOCKED, gives every lease a fencing token, and writes effects through a transactional outbox so the commit and the effect share one transaction. A chaos harness kills workers mid-task, and its negative control removes the fence on purpose so the invariant is seen to fail without it.
Outcome
A late write from a dead worker is rejected because its token is older than the current lease, so the effect lands exactly once. 22 tests run against a real Postgres, and the codebase stays clean under ruff and mypy --strict.