Repository navigation
Conversation
… permanent Add a single documented classifier (webhook-response-classifier.ts) that maps an HTTP response or thrown error to success (2xx), retryable (network/timeout, 408/425/429, any 5xx), or permanent (other 4xx, 1xx/3xx). The delivery service and the bounded retry helper both delegate to it, so they can no longer disagree: permanent client failures are never retried and transient failures are. WebhookDeliveryResult now carries the explicit classification. Closes Core-Foundry#643
Author
Author
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.
Closes #643
What
Webhook delivery outcomes were classified implicitly and in two places that could drift. This introduces one documented rule set shared by both the delivery service and the retry helper.
Changes
listener/src/services/webhook-response-classifier.ts(new) -classifyWebhookResponse({ statusCode?, error })returns exactly one of:success- HTTP 2xxretryable- network/timeout error, or HTTP 408/425/429, or any 5xxpermanent- any other 4xx, 1xx/3xx, or a missing status with no errorThe rules are documented in the module header, and
RETRYABLE_STATUS_CODES/isRetryableClassificationare exported.webhook-delivery-service.ts- uses the classifier and now returnsclassificationonWebhookDeliveryResult. Log behavior is unchanged for the existing categories (5xx -> warn, 4xx -> error, timeout -> warn, network -> error); transient non-5xx (408/425/429) now correctly warn instead of error.webhook-retry-helper.ts-isRetryabledelegates to the classifier, removing the duplicated status sets.Acceptance criteria
Validation
jest src/services/webhook-response-classifier.test.ts src/services/webhook-delivery-service.test.ts src/services/webhook-retry-helper.test.ts-> 3 suites, 85 tests pass.mainhas pre-existing, unrelated syntax errors insrc/utils/request-id.tsthat fail the repo-widetsc.