Open
Conversation
957f697 to
0c3f1ce
Compare
35b761e to
aa0d90a
Compare
b355fee to
aa0d90a
Compare
There was a problem hiding this comment.
Pull request overview
This PR shifts “get letters” behaviour to be backed by a dedicated DynamoDB letter queue table (with visibility-style timestamp updates) and extends the update-letter-queue Lambda to both add newly pending letters and remove letters when they transition out of PENDING.
Changes:
- Extend
update-letter-queueto insert pending letters onINSERTand delete queued letters when status changes away fromPENDINGonMODIFY. - Update API
get-lettersflow to read from the queue table and update each returned letter’squeueTimestampusingLETTER_QUEUE_VISIBILITY_TIMEOUT. - Expand
LetterQueueRepositorywithdeleteLetter,getLetters, andupdateLetterTimestamp, plus new datastore error types and Terraform updates for table/index/env/permissions.
Reviewed changes
Copilot reviewed 25 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e-tests/poetry.lock | Bumps Python dependency (authlib). |
| package.json | Adds npm override for a transitive dependency. |
| package-lock.json | Lockfile refresh with multiple dependency bumps. |
| lambdas/update-letter-queue/src/update-letter-queue.ts | Adds delete-on-status-change path and refactors record processing. |
| lambdas/update-letter-queue/src/tests/update-letter-queue.test.ts | Adds coverage for delete behaviour and replay handling. |
| lambdas/api-handler/src/services/letter-operations.ts | Replaces “get letters” logic with queue-backed getPendingLetters + timestamp update. |
| lambdas/api-handler/src/services/tests/letter-operations.test.ts | Updates tests for queue-backed fetch and timestamp update calls. |
| lambdas/api-handler/src/handlers/get-letters.ts | Switches handler to getPendingLetters and queue repo. |
| lambdas/api-handler/src/handlers/tests/get-letters.test.ts | Updates mocks/expectations for queue-backed retrieval. |
| lambdas/api-handler/src/config/env.ts | Adds required env vars for queue table + visibility timeout. |
| lambdas/api-handler/src/config/deps.ts | Wires LetterQueueRepository into the API handler deps container. |
| lambdas/api-handler/src/config/tests/env.test.ts | Updates env var test coverage for new required vars. |
| lambdas/api-handler/src/config/tests/deps.test.ts | Verifies LetterQueueRepository is constructed with correct config. |
| internal/datastore/src/types.ts | Introduces PendingLetterBase (schema/type) for queue writes. |
| internal/datastore/src/letter-repository.ts | Removes supplier/status list methods now replaced by queue operations. |
| internal/datastore/src/letter-queue-repository.ts | Adds delete, query-by-queueTimestamp, and timestamp update operations. |
| internal/datastore/src/letter-does-not-exist-error.ts | Adds explicit error type for missing queue items. |
| internal/datastore/src/letter-already-exists-error.ts | Adds explicit error type for duplicate queue items. |
| internal/datastore/src/index.ts | Updates exports to include new error types and queue repo export. |
| internal/datastore/src/test/letter-repository.test.ts | Removes tests for removed list/query methods. |
| internal/datastore/src/test/letter-queue-repository.test.ts | Adds tests for delete/get/update timestamp behaviour. |
| internal/datastore/src/test/db.ts | Renames LSI to queueTimestamp-index for queue ordering. |
| infrastructure/terraform/components/api/module_lambda_update_letter_queue.tf | Adds dynamodb:DeleteItem permission for queue maintenance. |
| infrastructure/terraform/components/api/module_lambda_get_letters.tf | Switches permissions/resources to queue table + adds UpdateItem. |
| infrastructure/terraform/components/api/locals.tf | Adds queue env vars and visibility timeout to common Lambda env. |
| infrastructure/terraform/components/api/ddb_table_letter_queue.tf | Adjusts primary key to (supplierId, letterId) + LSI on queueTimestamp. |
| infrastructure/terraform/components/api/README.md | Updates referenced shared-module versions. |
| .vscode/settings.json | Pins workspace TypeScript SDK to local node_modules. |
You can also share your feedback on Copilot code review. Take the survey.
lambdas/update-letter-queue/src/__tests__/update-letter-queue.test.ts
Outdated
Show resolved
Hide resolved
fdf1829 to
ed17066
Compare
3260716 to
b9ea08f
Compare
Vlasis-Perdikidis
previously approved these changes
Mar 10, 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
Type of changes
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.