# Webhook-to-email retry test matrix

Use this worksheet with test accounts and an authorized sandbox or narrowly scoped test audience. Replace example identifiers; never paste real recipient addresses, tokens, raw payloads, or signing secrets into a shared copy. This is a design and release worksheet, not a claim that a particular provider guarantees exactly-once delivery.

## 1. Define one intended message

| Field | Example | Your system |
|---|---|---|
| Source and environment | Registration service, sandbox | |
| Trigger event | registration.confirmed | |
| Source object ID | registration-482 | |
| Authoritative state lookup | registration API by ID | |
| Message purpose | confirmation | |
| Recipient ID, not address | holder-17 | |
| Version / legitimate repeat rule | v1; venue change gets new purpose | |
| Business send-intent key | confirmation/registration-482/holder-17/v1 | |
| Source event ID | evt-901 | |
| Retry and manual replay horizon | Document from source | |
| Email route and provider | Send API or named automation | |
| Provider idempotency support and window | Verify exact endpoint and duration | |
| Approval / consent rule | Transactional status or recorded marketing permission | |

The event key traces deliveries; the send-intent key protects one business message. If the source emits separate events for the same final transition, decide whether they should share one send-intent key. Document how a corrected recipient or deliberate resend obtains a new, authorized intent.

## 2. Record the durable contract

- Unique constraint or atomic conditional write on the **send-intent key**: ____________________
- Durable event receipt / queue before webhook success response: ____________________
- Transactional outbox or equivalent job handoff: ____________________
- Worker claim / lease and retry rules: ____________________
- Send states: pending → sending → accepted; failed and uncertain have distinct routes.
- Provider message ID lookup and reconciliation owner: ____________________
- Ledger retention based on source replay and manual-recovery window: ____________________
- Latest-state or version check before state-dependent mail: ____________________
- Other routes that could send the same message (journeys, tags, campaigns): ____________________

Do not treat a provider timeout as a confirmed rejection. A local unique key and outbox do not, by themselves, make a separate provider call exactly once after a crash or lost response. If an API supplies an idempotency key, repeat the same payload with the same key within its documented window; a concurrent request may need a later retry under the provider contract. Beyond that window, reconcile the local ledger and provider history before another send. If acceptance cannot be established, mark the test unverified and hold or escalate under an explicit risk decision.

## 3. Exercise controlled failure cases

| Case | Delivery / worker setup | Expected send intent | Expected provider action | Evidence / result |
|---|---|---:|---|---|
| A | First valid event | 1 | One acceptance | |
| B | Redeliver same event ID | Still 1 | No new acceptance | |
| C | Deliver same event concurrently to two workers | Still 1 | No parallel second send | |
| D | New event ID, same business object and purpose | Still 1 when it means same business action | No new acceptance | |
| E | Legitimate new venue-change purpose or version | 2 distinct intents | One acceptance for new notice | |
| F | Older confirmation arrives after cancellation | No obsolete intent | No obsolete email | |
| G | Webhook receipt cannot be stored | 0 new intents | Follow source failure/retry contract | |
| H | Send API times out after request submission | 1, state uncertain | Reconcile; retry only under documented provider protection or confirmed rejection | |
| I | Worker crashes after provider acceptance before local update | 1, state uncertain | Reconcile ID/history; no blind replay when the provider key has expired or is unavailable | |
| J | Address corrected after accepted send | Existing intent unchanged | Explicit owner-approved resend rule | |
| K | Automation re-entry after tag or field update | Defined by message contract | No extra copy through parallel route | |
| L | Crash after durable event receipt but before send intent commits | 1 after recovery | Resume unfinished processing; do not treat receipt alone as completed send | |

For each row, record source event ID, send-intent key, provider message/campaign ID, ledger state, test time, and owner. A matching subject line is not sufficient evidence of one message; use provider identifiers where available. If the platform cannot expose the outcome, mark the case **unverified**, not passed.

## 4. Release decision

- [ ] The same intent key survives ordinary retries and concurrent workers.
- [ ] An event receipt without a committed send intent resumes after recovery.
- [ ] The source event is verified and durably accepted before acknowledgement.
- [ ] A state-dependent message checks the authoritative current state.
- [ ] Timeout/uncertain send has an assigned reconciliation owner.
- [ ] Provider-specific idempotency is confirmed for the exact send route, or the gap is documented.
- [ ] Parallel automation and manual routes were checked.
- [ ] Two provider IDs for one intent trigger investigation.
- [ ] Test recipients and personal data stayed in authorized systems.

Decision: **RELEASE / HOLD** __________  Owner: __________  Date: __________  Evidence location: __________
