Skip to content

Add integration test asserting webhook delivery at-least-once semantics with exponential backoff #598

Description

@thlpkee20-wq

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
    • npm test
  • 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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions