fix(notifications): add stable Idempotency-Key header to outbound web… - #101
Open
udeachudivine-spec wants to merge 1 commit into
Open
Conversation
…hook dispatch (ecotask-network#59) - Export buildWebhookIdempotencyKey() helper that derives a SHA-256 hex digest of outboxId:webhookUrl — stable across BullMQ retries of the same job, unique per outbox row and per subscriber URL - Add Idempotency-Key header alongside Content-Type on every outbound webhook POST in sendWebhook() - Thread outboxId through dispatchNotification(notificationId, outboxId?) and the BullMQ worker processor so the stable outbox row ID drives the key - Falls back to notificationId as key base when outboxId is not supplied (direct/admin calls) to avoid any random/time-based value - Add tests/services/notificationDispatchService.test.ts covering: key determinism, subscriber-uniqueness, retry-stability, header presence, Content-Type co-existence, and already-delivered short-circuit path NOTE: the current NotificationOutbox schema has no delivery-generation column, so deliberate re-sends (DEAD_LETTER reset) after a permanent failure will reuse the same key as the original delivery's retries. A follow-up is needed: add deliveryGeneration Int @default(0) to NotificationOutbox and incorporate it into the key construction.
Author
|
close issue #59 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…hook dispatch (#59)
NOTE: the current NotificationOutbox schema has no delivery-generation column, so deliberate re-sends (DEAD_LETTER reset) after a permanent failure will reuse the same key as the original delivery's retries. A follow-up is needed: add deliveryGeneration Int @default(0) to NotificationOutbox and incorporate it into the key construction.
Description
Please include a summary of the change and which issue is fixed.
Fixes #(issue)
Type of Change
How Has This Been Tested?
npm testpassesnpm run buildsucceedsChecklist
Additional Context
Add any other context about the PR here.