CCM-22997: Shared utilities - #249
Open
rhyscoxnhs wants to merge 4 commits into
Open
Conversation
rhyscoxnhs
force-pushed
the
feature/CCM-22997
branch
2 times, most recently
from
August 19, 2026 11:37
7c9b84c to
829fcaf
Compare
rhyscoxnhs
force-pushed
the
feature/CCM-22997
branch
from
August 19, 2026 11:45
829fcaf to
30176ec
Compare
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
Introduces a new publishable package,
@nhsdigital/nhs-notify-shared-utils, in a newpackages/workspace. It holds generic, technical-only utilities for reuse across NHSNotify bounded contexts.
Each module is a subpath export, so a consumer imports only what it needs and Lambda
bundles never pull in test-only code:
./logger— a generic pino-backedLogger. Redaction is fully opt-in: the classdeclares no redact paths of its own; each bounded context supplies its own via
redactPaths../lambda-utils—requireEnv/MissingEnvironmentVariableError, a pureformatZodIssuesformatter, and SQS string-attribute readers. No AWS SDK dependency../test-support— integration test helpers: deployment/naming helpers, pollingprimitives, and an override-based event-factory base. AWS client factories are split
per service under
./test-support/{cloudwatch,sqs,s3,dynamodb,eventbridge}, soimporting one service does not load the others' AWS SDK packages; the barrel itself is
AWS-SDK-free.
./s3-json— a get-JSON-from-S3-and-optionally-validate helper.Dependency and build contract:
pinoand the AWS SDK v3 clients are peer dependencies (AWS SDK peers optional),preventing duplicate copies in consumer bundles.
tscwith a split tooling/buildtsconfig;filesrestricted todist. Every module ships a README with usage.Workspace and release wiring:
packages/*workspace glob,awsandruntimepnpm catalogs, acache-correct turbo
buildtask, and ESLint coverage for the new package.publish-packages.yaml) to GitHub Packages under@nhsdigital, triggered only byshared-utils-v*tags and decoupled from theTerraform module release. It fails unless the pushed tag version matches
package.jsonversion. Least-privilege permissions (contents: read,packages: write),GITHUB_TOKENauth only.jestentry intypesand use of deprecatedbaseUrlpropertiesContext
The app-response and client-callbacks bounded contexts independently built
near-identical technical utilities — structured logging, environment-variable
validation, AWS SDK client factories, and integration test-support helpers. Maintaining
two copies causes drift and doubled effort. This extracts the generic, technical-only
utilities into a single versioned package so bounded contexts can depend on one shared
implementation, keeping the dependency one-way (bounded context → shared) and leaving
all domain logic in its own context. Consumers adopt it on their own cadence in
follow-up work; this change only introduces the package in the host repository.
Ref: CCM-22997.
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.