Skip to content

CCM-16553: Deployment into nft environment in NonProd#293

Open
nhsd-angel-pastor wants to merge 3 commits intomainfrom
feature/CCM-16553_dl_nft
Open

CCM-16553: Deployment into nft environment in NonProd#293
nhsd-angel-pastor wants to merge 3 commits intomainfrom
feature/CCM-16553_dl_nft

Conversation

@nhsd-angel-pastor
Copy link
Copy Markdown
Contributor

@nhsd-angel-pastor nhsd-angel-pastor commented Apr 15, 2026

Description

Deployment of main into nft and main environments for NonProd account. Added tool to publish events from the SupplierAPI and from Core (for the opt out letter). Evidences under comment

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

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.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@nhsd-angel-pastor nhsd-angel-pastor force-pushed the feature/CCM-16553_dl_nft branch 6 times, most recently from 0abe021 to 07dced7 Compare April 20, 2026 16:16
* Common interface for all event destinations (SQS, EventBridge, etc.).
* Implementations are responsible for batching, retries and back-off.
*/
export interface DestinationClient {
Copy link
Copy Markdown
Contributor Author

@nhsd-angel-pastor nhsd-angel-pastor Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally did this to support in the future other destinations like SQS so the code in SMS nudge could work, but then I removed the SQS client as for the current case it isn't used, but I left this if we want to reintroduce SQS or other destination.

@nhsd-angel-pastor nhsd-angel-pastor force-pushed the feature/CCM-16553_dl_nft branch from 01acdc1 to d5ff9a7 Compare April 21, 2026 07:31
@nhsd-angel-pastor nhsd-angel-pastor marked this pull request as ready for review April 21, 2026 12:01
@nhsd-angel-pastor nhsd-angel-pastor requested review from a team as code owners April 21, 2026 12:01
Comment thread project.code-workspace
Copy link
Copy Markdown
Contributor

@gareth-allan gareth-allan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not reviewed the nft-event-generator application yet, but one comment on everything else.

Comment thread Makefile Outdated
simonlabarere
simonlabarere previously approved these changes Apr 23, 2026
Comment thread scripts/nft-event-generator/package.json Outdated
Comment thread scripts/package.json Outdated
"bump-terraform-modules": "ts-node terraform/bump-shared-modules.ts",
"lint": "eslint nft-event-generator/",
"lint:fix": "eslint nft-event-generator/ --fix",
"start": "tsx nft-event-generator/src/cli.ts",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support the use of tsx, given ts-node hasn't had an update in 2 years, but we're already using ts-node for the bump-terraform-modules command here. It seems silly to have two dependencies for doing the same thing, so we should settle on one. Do you know if we use one or the other elsewhere in Digital Letters?

Comment thread scripts/tsconfig.json Outdated
"compilerOptions": {
"baseUrl": ".",
"isolatedModules": true
"baseUrl": "./nft-event-generator/src",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does changing this baseUrl affect the terraform/bump-shared-modules.ts script? It seems odd to have the baseUrl for the scripts application pointing at the nft-event-generator subdirectory. What if we add other applications?

Comment thread scripts/tsconfig.json
Comment on lines +6 to +13
"jest": [
"../../../node_modules/jest"
]
},
"typeRoots": [
"../node_modules/@types",
"./node_modules/@types"
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we referencing node_modules directories several levels above this one? We'd normally let NPM work this sort of thing out, wouldn't we?

Comment thread scripts/package.json Outdated
},
"devDependencies": {
"@types/node": "^24.0.10",
"@jest/diff-sequences": "^30.0.1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you're using this dependency, are you?

Suggested change
"@jest/diff-sequences": "^30.0.1",

Comment thread scripts/package.json Outdated
"@nhsdigital/nhs-notify-event-schemas-status-published": "1.0.1",
"@nhsdigital/nhs-notify-event-schemas-supplier-api": "1.0.17",
"csv-parse": "^6.1.0",
"digital-letters-events": "^0.0.1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using this digital-letters-events dependency?

Comment on lines +36 to +40
function wait(interval: number) {
return new Promise((resolve) => {
setTimeout(resolve, interval);
});
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utils/utils/src/util-retry/sleep.ts exports a sleepMs function that does the same as this.

Comment thread scripts/nft-event-generator/README.md
currentBatch += 1;

const entries = batch.map((event) => {
const cloudEvent = event as unknown as CloudEventEnvelope;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just define the events argument as CloudEventEnvelope[] (or add the source, type and time properties to the PublishableEvent interface), rather than casting here?

I'm assuming the idea was to keep PublishableEvent generic enough to support multiple publishing methods, but I think it's probably reasonable to say that they all need to accept events in the shape of CloudEvents.

Comment on lines +99 to +110
const events: LetterEvent[] = [];

for (let i = 0; i < numberOfEvents; i++) {
events.push(
generateSupplierApiLetterEvent(environment, status, {
id,
time,
subject,
messageReference,
}),
);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use Array.from, I think. Like you've done in send-events-to-event-bus.test.ts

Suggested change
const events: LetterEvent[] = [];
for (let i = 0; i < numberOfEvents; i++) {
events.push(
generateSupplierApiLetterEvent(environment, status, {
id,
time,
subject,
messageReference,
}),
);
}
const events = Array.from({ length: numberOfEvents }, () =>
generateSupplierApiLetterEvent(environment, status, {
id,
time,
subject,
messageReference,
}),
);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good point

};

function generatePaperLetterOptOutEvent(
environment: string,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

environment isn't used. Should it be going into the source field, as with the other event?

@nhsd-angel-pastor nhsd-angel-pastor force-pushed the feature/CCM-16553_dl_nft branch 2 times, most recently from b9e566d to bc42881 Compare April 27, 2026 13:48
@nhsd-angel-pastor nhsd-angel-pastor force-pushed the feature/CCM-16553_dl_nft branch from bc42881 to 35ebe4f Compare April 27, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants