Dev.to
7/8/2026

Inbox Contracts for Scheduled Automation
Short summary
The article introduces 'inbox contracts' — a testing pattern where each scheduled automation run gets a unique run ID, a dedicated mailbox, and a set of assertions to verify the correct email was sent exactly once with the right content and links. The author provides concrete shell-script examples and a logging schema (run ID, workflow name, message count, subject, extracted host) that makes postmortems fast and unambiguous. The core discipline: treat email as a first-class artifact of the job, not a side effect, so failures leave clear evidence instead of forcing log archaeology.
- •Each scheduled run gets a unique run ID, isolated mailbox, and targeted assertions (message count, subject, link host, body phrase)
- •Log run ID, workflow name, recipient, message count, subject, extracted host, and provider message ID for fast incident review
- •Keep retention short and store evidence as small JSON artifacts beside job output for easy diffing between reruns
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



