Description
src/webhooks/webhook.dispatcher.ts retries deliveries but lacks a terminal dead-letter path for permanently failing endpoints, risking unbounded retry loops. This backend task adds capped exponential backoff and a dead-letter state recorded in src/webhooks/webhook.store.ts so failed deliveries are observable and stop retrying.
Requirements and Context
- Cap retries with bounded exponential backoff and jitter.
- Move exhausted deliveries to a
dead_letter status with the last error.
- Expose dead-letter entries for inspection.
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/webhook-dead-letter
- Implement changes
src/webhooks/webhook.dispatcher.ts — backoff + DLQ transition
src/webhooks/webhook.store.ts — persist status/attempts
src/webhooks/webhook.types.ts — add dead_letter status
- Test and commit
npm test -- src/webhooks/webhook.dispatcher.test.ts
- Cover edge cases
- Include test output and notes in the PR
Example commit message
feat: add dead-letter queue to webhook dispatcher
Acceptance Criteria
Guidelines
- Minimum 90% test coverage with Jest
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
src/webhooks/webhook.dispatcher.tsretries deliveries but lacks a terminal dead-letter path for permanently failing endpoints, risking unbounded retry loops. This backend task adds capped exponential backoff and a dead-letter state recorded insrc/webhooks/webhook.store.tsso failed deliveries are observable and stop retrying.Requirements and Context
dead_letterstatus with the last error.Suggested Execution
src/webhooks/webhook.dispatcher.ts— backoff + DLQ transitionsrc/webhooks/webhook.store.ts— persist status/attemptssrc/webhooks/webhook.types.ts— adddead_letterstatusnpm test -- src/webhooks/webhook.dispatcher.test.tsExample commit message
Acceptance Criteria
dead_letterGuidelines