docs(dlq): document message-validation reason codes and routing contract#664
Merged
Conversation
Adds docs/dlq-message-validation.md covering validateAndRoute, DlqRouter, and bondOperationSchema.
|
@Bolajiomo99 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- sorobanStateCache: LRU type constraint, logger signature - webhookPublisher: attestation event type enum value - apiKeysRepository: add deprecated scope field - auditLogsRepository: add request_id to row type - index: remove unused import, dead call, null-safe close - webhookIntegration: as any for deprecated module payloads - webhookIntegrationOutbox: deduplicate import, as any casts - middleware/apiKey: define ApiKeyScope locally - middleware/auth,costMeter: add missing await on async calls - repositories/apiKeyRepository: async interface + await - admin routes: import AuditAction, fix arg count - governance: fix schema name casing - ws, apiKeyRotationService: add missing await - apiKeys: fix duplicate param, store var ref, async returns - reportService: add null guard on config - delivery: as any assertions for WebhookPayload compat
…d-routing-contract-in-src/listeners/messageValidator.ts
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.
Documents every
DlqReasonCode, thevalidateAndRouteflow,bondOperationSchemarules,formatZodErrorsoutput, and the replay path insrc/services/replayService.ts.Closes #643
Description
This pull request adds a focused operations document (
docs/dlq-message-validation.md) describing everyDlqReasonCode, when it is emitted, and how to replay vs discard a quarantined message. The reason-code taxonomy and routing rules were previously undocumented, making it difficult for contributors and on-call engineers to triage poisoned messages in thefailed_inbound_eventstable.Previously, an operator finding a DLQ entry would see only a raw
event_datablob and a free-textfailure_reasonwith no structured reference explaining what each reason code means or what to do next.Changes Made
docs/dlq-message-validation.mdcovering:DlqReasonCodevalues (SCHEMA_VALIDATION_FAILED,UNKNOWN_MESSAGE_TYPE,PROCESSING_ERROR,MAX_RETRIES_EXCEEDED) with trigger condition, example payload, storedfailure_reasonformat, and operator action.validateAndRouteflow — ASCII diagram of the validation pipeline from raw payload through ZodsafeParse→ValidationResult→DlqRouter.route→sink.captureFailure→ DB insert.DlqRoutersink behaviour — reason format ([CODE] detail), raw payload preservation, message type labels, error propagation.bondOperationSchemaandbondWithdrawalOperationSchema— per-field Zod rules (source_account,id,amount,duration) with Stellar account ID validation and integer-string regex.formatZodErrorsoutput — semicolon-separatedpath: messagepairs with examples for root-level, single, multi-field, and nested path failures.ReplayServiceclass, admin REST endpoints (GET /api/admin/events/failed,POST /api/admin/events/replay/:id), replay flow diagram, manual curl commands, and handler registration.failed_inbound_eventswith types and descriptions.DlqReasonCodeenum insrc/listeners/messageValidator.ts:12.Closes #643
Type of Change
Verification & Test Plan
Automated Tests
DlqReasonCode, thevalidateAndRouteflow,bondOperationSchemarules,formatZodErrorsoutput, and the replay path insrc/services/replayService.ts.Closes #643
Description
This pull request adds a focused operations document (
docs/dlq-message-validation.md) describing everyDlqReasonCode, when it is emitted, and how to replay vs discard a quarantined message. The reason-code taxonomy and routing rules were previously undocumented, making it difficult for contributors and on-call engineers to triage poisoned messages in thefailed_inbound_eventstable.Previously, an operator finding a DLQ entry would see only a raw
event_datablob and a free-textfailure_reasonwith no structured reference explaining what each reason code means or what to do next.Changes Made
docs/dlq-message-validation.mdcovering:DlqReasonCodevalues (SCHEMA_VALIDATION_FAILED,UNKNOWN_MESSAGE_TYPE,PROCESSING_ERROR,MAX_RETRIES_EXCEEDED) with trigger condition, example payload, storedfailure_reasonformat, and operator action.validateAndRouteflow — ASCII diagram of the validation pipeline from raw payload through ZodsafeParse→ValidationResult→DlqRouter.route→sink.captureFailure→ DB insert.DlqRoutersink behaviour — reason format ([CODE] detail), raw payload preservation, message type labels, error propagation.bondOperationSchemaandbondWithdrawalOperationSchema— per-field Zod rules (source_account,id,amount,duration) with Stellar account ID validation and integer-string regex.formatZodErrorsoutput — semicolon-separatedpath: messagepairs with examples for root-level, single, multi-field, and nested path failures.ReplayServiceclass, admin REST endpoints (GET /api/admin/events/failed,POST /api/admin/events/replay/:id), replay flow diagram, manual curl commands, and handler registration.failed_inbound_eventswith types and descriptions.DlqReasonCodeenum insrc/listeners/messageValidator.ts:12.Closes #643
Type of Change
Verification & Test Plan
Automated Tests
npm run lint— 0 errors, 27 pre-existing warnings in unrelated files.npm run build— pre-existing errors in unrelated files (sorobanStateCache,apiKeysRepository,webhookIntegration, etc.); no new errors introduced.Manual Verification
DlqReasonCodevalues exist in the enum atsrc/listeners/messageValidator.ts:12— no invented codes.src/services/replayService.tsfor the replay flow and handler registration.src/routes/admin/index.tsfor admin API endpoints.src/db/repositories/failedInboundEventsRepository.tsfor the database schema.Notes
.tsfiles were touched — this is documentation only.mainand are unrelated to this change.Checklist
Code follows the project's style guidelines.
Added comprehensive unit tests.
Performed a self-review.
Added inline documentation (TSDoc).
No new warnings introduced.
All existing tests continue to pass.
npm run build— pre-existing errors in unrelated files (sorobanStateCache,apiKeysRepository,webhookIntegration, etc.); no new errors introduced.Manual Verification
DlqReasonCodevalues exist in the enum atsrc/listeners/messageValidator.ts:12— no invented codes.src/services/replayService.tsfor the replay flow and handler registration.src/routes/admin/index.tsfor admin API endpoints.src/db/repositories/failedInboundEventsRepository.tsfor the database schema.Notes
.tsfiles were touched — this is documentation only.mainand are unrelated to this change.Checklist