Description
Cover webhook delivery: on 5xx from the receiver, retry with exponential backoff (up to 6 attempts), and mark as succeeded after any 2xx, asserting metrics reflect each attempt.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/workers/webhookRetry.ts, src/webhooks/dispatch.ts
Suggested execution
- Fork the repo and create a branch
git checkout -b tests/webhook-at-least-once
- Implement changes
- Mock receiver returning 500 twice then 200
- Assert exactly 3 attempts with backoff timings
- Assert
webhook_deliver_attempts_total{result} counter increments per attempt
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- receiver always 500 (max attempts exhausted, moved to DLQ), receiver 2xx on first try, 429 with Retry-After
- Include test output and notes
Example commit message
tests: webhook at-least-once + backoff
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
Cover webhook delivery: on 5xx from the receiver, retry with exponential backoff (up to 6 attempts), and mark as
succeededafter any 2xx, asserting metrics reflect each attempt.Requirements and context
src/workers/webhookRetry.ts,src/webhooks/dispatch.tsSuggested execution
git checkout -b tests/webhook-at-least-oncewebhook_deliver_attempts_total{result}counter increments per attemptTest and commit
npm testExample commit message
tests: webhook at-least-once + backoffGuidelines