Skip to content

Title: feat(webhooks): cap delivery attempts and dead-letter exhausted deliveries - #67

Open
Emeka000 wants to merge 1 commit into
octraban:mainfrom
Emeka000:webhook
Open

Title: feat(webhooks): cap delivery attempts and dead-letter exhausted deliveries #67
Emeka000 wants to merge 1 commit into
octraban:mainfrom
Emeka000:webhook

Conversation

@Emeka000

Copy link
Copy Markdown

Closes #45.

Changes

scheduleRetryOrFail() moves a delivery to a new terminal 'dead_letter' state once MAX_ATTEMPTS is exhausted (clears nextRetryAt/lease, sets processingStatus: 'done', records attempt count). SSRF-permanent rejections keep the distinct 'failed' state.
Env-configurable: WEBHOOK_MAX_ATTEMPTS (5), WEBHOOK_BACKOFF_BASE_MS (10000, capped 15 min), plus WEBHOOK_DISPATCH_CONCURRENCY now documented — all in .env.example.
Observability: deadLetterCount in getDispatchMetrics(), listDeadLetterDeliveries() helper, and GET /webhooks/:id/deliveries?status=dead_letter.
Tests in tests/webhooks/dispatcher.test.ts (wired into npm test): backoff schedule, HMAC X-Webhook-Signature, dead-letter transition after the cap.
No schema/migration — dead_letter is a new value of the existing status string.
CI (local): build, validate:prisma, lint (0 errors), typecheck:scripts, check:mock-gating all pass; npm test 216 passing. Pre-existing webhooks-smoke.test.ts failure left untouched (not in the CI test set).

One note
A configured git hook auto-committed the changes during the session and left a stray local branch webhook at that commit. I re-based the work onto a clean feature branch with a proper message; deleting the leftover webhook branch was blocked by the permission classifier, so you may want to run git branch -D webhook yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a delivery-attempt cap and dead-letter handling to the webhook dispatcher

2 participants