Feature/ccm 13906 urgent letter priority#453
Feature/ccm 13906 urgent letter priority#453stevebux wants to merge 7 commits intofeature/CCM-13116-Letter-Queue-Operationsfrom
Conversation
be40ad8 to
40fbb3f
Compare
770c5c4 to
b9d96ad
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for urgent letter prioritisation by propagating a priority value through supplier allocation and upsert flows, and by updating the letter-queue sort/index strategy so queued letters can be ordered by priority.
Changes:
- Add
priorityto supplier variant mapping and to the SQS message envelope passed from supplier-allocator → upsert-letter. - Persist
priorityon letters/pending-letters and introducequeueSortOrderSkto support priority-ordered queueing. - Emit per-supplier/per-priority allocation metrics (EMF) from the supplier-allocator Lambda.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| package-lock.json | Adds aws-embedded-metrics dependency. |
| lambdas/upsert-letter/src/handler/upsert-handler.ts | Requires/uses supplierSpec.priority and writes priority onto inserted letters. |
| lambdas/upsert-letter/src/handler/tests/upsert-handler.test.ts | Updates tests to include/assert priority. |
| lambdas/supplier-allocator/src/handler/allocate-handler.ts | Adds priority to SupplierSpec, forwards it, and emits EMF metrics by supplier+priority. |
| lambdas/supplier-allocator/src/handler/tests/allocate-handler.test.ts | Adds assertions around forwarded priority and emitted metrics. |
| lambdas/supplier-allocator/src/config/env.ts | Extends VARIANT_MAP schema to require bounded priority. |
| lambdas/supplier-allocator/src/config/tests/env.test.ts | Updates env parsing tests for priority. |
| lambdas/supplier-allocator/package.json | Adds aws-embedded-metrics dependency. |
| internal/datastore/src/types.ts | Adds optional priority and introduces queueSortOrderSk on PendingLetter. |
| internal/datastore/src/letter-queue-repository.ts | Builds queueSortOrderSk from priority+timestamp when enqueueing. |
| internal/datastore/src/test/letter-queue-repository.test.ts | Adds test coverage for padded/defaulted priority in queueSortOrderSk. |
| internal/datastore/src/test/db.ts | Updates test DynamoDB table definition to use queueSortOrderSk in the LSI. |
| infrastructure/terraform/components/api/variables.tf | Extends letter_variant_map objects to include priority. |
| infrastructure/terraform/components/api/ddb_table_letter_queue.tf | Updates the letter-queue LSI sort key to the new queue sort attribute. |
| infrastructure/terraform/components/api/README.md | Updates generated input docs for the new letter_variant_map shape. |
| .vscode/settings.json | Pins the TypeScript SDK path for the workspace. |
You can also share your feedback on Copilot code review. Take the survey.
1402dc1 to
6c44dc5
Compare
| secretAccessKey: "fakeSecretAccessKey", | ||
| }, | ||
| maxAttempts: 1, | ||
| }); |
There was a problem hiding this comment.
This is to prevent failing tests from retrying multiple times, and then hitting the 30 second timeout
nhsd-david-wass
left a comment
There was a problem hiding this comment.
Looks good - have you created a PR in https://github.com/NHSDigital/nhs-notify-internal to update infrastructure/terraform/etc/group_nhs-notify-supplier-api-dev.tfvars ?
If you do, you can update your build to reference that PR, so everything works in your dynamic environement - see this commit on my branch:
2a61ca8 to
0a54471
Compare
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.