Build a Replayable Email Smoke Test with a Run Ledger
Description and use
The email smoke test now records events in a ledger, enabling reproducible failures and faster debugging.
Problem
Email verification checks often fail in CI due to unclear causes such as missing messages, premature polling, or stale inboxes.
Outcome
The test now produces a durable ledger of events, making failures reproducible and debugging faster.
Workflow
- Generate a unique run_id
- Allocate a temporary inbox and log "allocated" state
- Submit verification request and log "requested" state
- Poll inbox for email, verify token, and log "observed" state
- Release inbox in a finally block and log "released" state
Evidence
Email verification checks are deceptively easy to automate. Create an inbox, submit a form, wait for a message, click the link, and assert that the account is active.
The ledger gives each test run one identity and connects its events to that identity.
Keep the first version small. Four states cover most useful triage: allocated, requested, observed, released.
The finally block is not decoration. It is what keeps a slow or broken test from leaving a pile of inboxes behind.
- Record date: 2026-10-27T15:11:42.786Z