CCM-22692: Send letters to DLQ if supplier allocation fails - #672
Open
stevebux wants to merge 9 commits into
Open
CCM-22692: Send letters to DLQ if supplier allocation fails#672stevebux wants to merge 9 commits into
stevebux wants to merge 9 commits into
Conversation
Please enter the commit message for your changes. Lines starting
There was a problem hiding this comment.
Pull request overview
Routes terminal supplier-configuration allocation failures directly to the allocator DLQ instead of creating rejected letters.
Changes:
- Adds typed configuration errors and DLQ handling.
- Updates IAM, environment configuration, tests, and documentation.
- Adds component-test SQS polling support.
Validation: AI-assisted static review; tests were not executed.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/package.json |
Adds SQS and allocator test dependencies. |
tests/helpers/aws-queue-helper.ts |
Adds DLQ polling helper. |
tests/component-tests/allocation-tests/supplier-allocation.spec.ts |
Verifies unknown variants reach the DLQ. |
tests/component-tests/allocation-tests/letter-allocation-rejected.spec.ts |
Updates rejected-allocation scenarios for DLQ behavior. |
tests/component-tests/allocation-tests/allocation-target-percentage.spec.ts |
Verifies unavailable suppliers reach the DLQ. |
package-lock.json |
Locks new test dependencies. |
lambdas/supplier-allocator/src/services/supplier-config.ts |
Classifies terminal configuration validation failures. |
lambdas/supplier-allocator/src/services/__tests__/supplier-config.test.ts |
Tests typed validation errors. |
lambdas/supplier-allocator/src/handler/allocation-config.ts |
Uses typed errors for allocation failures. |
lambdas/supplier-allocator/src/handler/allocate-handler.ts |
Sends terminal failures directly to the DLQ. |
lambdas/supplier-allocator/src/handler/__tests__/allocation-config.test.ts |
Tests allocation error types. |
lambdas/supplier-allocator/src/handler/__tests__/allocate-handler.test.ts |
Tests DLQ and retry behavior. |
lambdas/supplier-allocator/src/errors/supplier-config-validation-error.ts |
Defines validation error type. |
lambdas/supplier-allocator/README.md |
Documents revised failure handling. |
lambdas/supplier-allocator/jest.config.ts |
Enables transformation of supplier-config schemas. |
internal/datastore/src/supplier-config-repository.ts |
Classifies missing configuration records. |
internal/datastore/src/index.ts |
Exports the missing-config error. |
internal/datastore/src/errors/missing-supplier-config-error.ts |
Defines missing-config error type. |
infrastructure/terraform/components/api/module_lambda_supplier_allocator.tf |
Configures DLQ URL and send permissions. |
Suppressed comments (3)
lambdas/supplier-allocator/README.md:22
- This integration-point description omits
MissingSupplierConfigError, although the handler directly publishes that error type to the DLQ too. Include both terminal configuration errors.
- **SQS**: Input from EventSub, output to the upsert-letter queue (`UPSERT_LETTERS_QUEUE`), and direct publish to the allocator DLQ (`SUPPLIER_ALLOCATOR_DLQ_URL`) for `SupplierConfigValidationError`.
lambdas/supplier-allocator/README.md:31
- These retry semantics exclude only
SupplierConfigValidationError, but the implementation also acknowledgesMissingSupplierConfigErrorafter a direct DLQ send. Update this summary so operators do not expect missing-config records to follow normal retries.
- **`SupplierConfigValidationError` is treated as terminal for retries.** The handler sends the original message directly to the allocator DLQ and acknowledges the source record.
- **All other failures retain normal retry semantics.** Non-`SupplierConfigValidationError` records are returned in `batchItemFailures` and retried according to queue configuration.
tests/helpers/aws-queue-helper.ts:32
- With
VisibilityTimeout: 0, every unmatched message is immediately eligible to be returned again. Because allocation tests run fully parallel with up to ten workers (tests/config/playwright.base.config.ts:12,21), pollers can repeatedly receive the same unrelated DLQ record and time out without progressing through the queue. Temporarily hide a batch of unmatched messages so polling advances.
VisibilityTimeout: 0,
WaitTimeSeconds: 5,
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
RossFaulds171
approved these changes
Aug 11, 2026
sidnhs
approved these changes
Aug 13, 2026
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.



Description
Context
When letters fail to be delivered due to missing or incorrect config, we have no way to replay them once the config is updated, meaning that we have to go back to the client and ask them to resend them. If the messages are on a DLQ, we can replay them ourselves without needing assistance from the client.
Type of changes
Checklist
DT3-Specific Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.