Skip to content

Commit 8a0b984

Browse files
committed
Merge branch 'main' into feature/CCM-12616_mesh_poll_retrieve
2 parents f2061ab + f509cf4 commit 8a0b984

File tree

141 files changed

+5690
-2795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+5690
-2795
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
*.code-workspace @NHSDigital/nhs-notify-digital-letters-admins
99
/infrastructure/terraform/ @NHSDigital/nhs-notify-platform
1010

11+
# Root level AGENTS.md owned by platform.
12+
AGENTS.md @NHSDigital/nhs-notify-platform
13+
1114
# Codeowners must be final check
1215
/.github/CODEOWNERS @NHSDigital/nhs-notify-code-owners
1316
/CODEOWNERS @NHSDigital/nhs-notify-code-owners

.github/actions/acceptance-tests/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ runs:
3030
run: |
3131
npm ci
3232
33+
- name: "Generate dependencies"
34+
shell: bash
35+
run: |
36+
npm run generate-dependencies
37+
3338
- name: Run test - ${{ inputs.testType }}
3439
shell: bash
3540
run: |

.github/workflows/stage-2-test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
npm ci
5858
- name: "Generate dependencies"
5959
run: |
60-
npm run generate-dependencies --workspaces --if-present
60+
npm run generate-dependencies
6161
git diff --exit-code
6262
test-unit:
6363
name: "Unit tests"
@@ -75,7 +75,7 @@ jobs:
7575
npm ci
7676
- name: "Generate dependencies"
7777
run: |
78-
npm run generate-dependencies --workspaces --if-present
78+
npm run generate-dependencies
7979
- name: "Run unit test suite"
8080
run: |
8181
make test-unit
@@ -115,7 +115,7 @@ jobs:
115115
npm ci
116116
- name: "Generate dependencies"
117117
run: |
118-
npm run generate-dependencies --workspaces --if-present
118+
npm run generate-dependencies
119119
- name: "Run linting"
120120
run: |
121121
make test-lint
@@ -131,7 +131,7 @@ jobs:
131131
npm ci
132132
- name: "Generate dependencies"
133133
run: |
134-
npm run generate-dependencies --workspaces --if-present
134+
npm run generate-dependencies
135135
- name: "Run typecheck"
136136
run: |
137137
make test-typecheck

.github/workflows/stage-3-build.yaml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,3 @@ jobs:
4444
uses: ./.github/actions/build-docs
4545
with:
4646
version: "${{ inputs.version }}"
47-
48-
49-
50-
# artefact-1:
51-
# name: "Artefact 1"
52-
# runs-on: ubuntu-latest
53-
# timeout-minutes: 3
54-
# steps:
55-
# - name: "Checkout code"
56-
# uses: actions/checkout@v5
57-
# - name: "Build artefact 1"
58-
# run: |
59-
# echo "Building artefact 1 ..."
60-
# - name: "Check artefact 1"
61-
# run: |
62-
# echo "Checking artefact 1 ..."
63-
# - name: "Upload artefact 1"
64-
# run: |
65-
# echo "Uploading artefact 1 ..."
66-
# # Use either action/cache or action/upload-artifact
67-
# artefact-n:
68-
# name: "Artefact n"
69-
# runs-on: ubuntu-latest
70-
# timeout-minutes: 3
71-
# steps:
72-
# - name: "Checkout code"
73-
# uses: actions/checkout@v5
74-
# - name: "Build artefact n"
75-
# run: |
76-
# echo "Building artefact n ..."
77-
# - name: "Check artefact n"
78-
# run: |
79-
# echo "Checking artefact n ..."
80-
# - name: "Upload artefact n"
81-
# run: |
82-
# echo "Uploading artefact n ..."
83-
# # Use either action/cache or action/upload-artifact

AGENTS.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# AGENTS.md
2+
<!-- vale off -->
3+
4+
## Scope
5+
6+
This file is for **AI agents** working within NHS Notify repositories.
7+
Humans should read `README.md` and the docs for how we actually work day to day.
8+
Keep anything language or tool-specific in nested `AGENTS.md` files (for example under `infrastructure/terraform` or `lambdas`).
9+
10+
## Repository Layout (high level)
11+
12+
At a glance, the main areas are:
13+
14+
- `infrastructure/terraform/` – Terraform components, and shared modules for AWS accounts and environments.
15+
- `lambdas/` – TypeScript lambda projects (each with their own `package.json`, Jest config, etc.). Root level packages.json defines workspaces and scripts. Tests for the lambda are stored in `lambdas/{name}/src/__test`.
16+
- `src/` and `utils/` – Shared code and utilities (for example `utils/logger`).
17+
- `docs/` – Documentation site, ADRs, RFCS, and other long‑form docs.
18+
- `.github/workflows/` and `.github/actions/` – GitHub Actions workflows and composite actions.
19+
- `scripts/` – Helper scripts and tooling used by humans and workflows.
20+
- `tests/` – Cross‑cutting tests and harnesses for the repo.
21+
22+
Agents should look for a nested `AGENTS.md` in or near these areas before making non‑trivial changes.
23+
24+
## Root package.json – role and usage
25+
26+
The root `package.json` is the orchestration manifestgit co for this repo. It does not ship application code; it wires up shared dev tooling and delegates to workspace-level projects.
27+
28+
- Workspaces: Declares the set of npm workspaces (e.g. under `lambdas/`, `utils/`, `tests/`, `scripts/`). Agents should add a new workspace path here when introducing a new npm project.
29+
- Scripts: Provides top-level commands that fan out across workspaces using `--workspaces` (lint, typecheck, unit tests) and project-specific runners (e.g. `lambda-build`).
30+
- Dev tool dependencies: Centralises Jest, TypeScript, ESLint configurations and plugins to keep versions consistent across workspaces. Workspace projects should rely on these unless a local override is strictly needed.
31+
- Overrides/resolutions: Pins transitive dependencies (e.g. Jest/react-is) to avoid ecosystem conflicts. Agents must not remove overrides without verifying tests across all workspaces.
32+
33+
Agent guidance:
34+
35+
- Before adding or removing a workspace, update the root `workspaces` array and ensure CI scripts still succeed with `npm run lint`, `npm run typecheck`, and `npm run test:unit` at the repo root.
36+
- When adding repo-wide scripts, keep names consistent with existing patterns (e.g. `lint`, `lint:fix`, `typecheck`, `test:unit`, `lambda-build`) and prefer `--workspaces` fan-out.
37+
- Do not publish from the root. If adding a new workspace intended for publication, mark that workspace package as `private: false` and keep the root as private.
38+
- Validate changes by running the repo pre-commit hooks: `make githooks-run`.
39+
40+
Success criteria for changes affecting the root `package.json`:
41+
42+
- `npm run lint`, `npm run typecheck`, and `npm run test:unit` pass at the repo root.
43+
- Workspace discovery is correct (new projects appear under `npm run typecheck --workspaces`).
44+
- No regression in lambda build tooling (`npm run lambda-build`).
45+
46+
## What Agents Can / Can’t Do
47+
48+
Agents **can**:
49+
50+
- Propose changes to code, tests, GitHub workflows, Terraform, and docs.
51+
- Suggest new scripts, Make targets, or composite actions by copying existing patterns.
52+
- Run tests to validate proposed solutions.
53+
54+
Agents **must not**:
55+
56+
- Create, push, or merge branches or PRs.
57+
- Introduce new technologies, providers, or big architectural patterns without clearly calling out that an ADR is needed.
58+
- Invent secrets or hard‑code real credentials anywhere.
59+
60+
## Working With This Repo
61+
62+
- All dependencies can be setup using the command `make config` from the repository root.
63+
- **Don’t guess commands.** Derive them from what’s already here or ask for guidance form the human user:
64+
- Prefer `Makefile` targets, `scripts/`, `.github/workflows/`, and `.github/actions/`.
65+
- For Terraform, follow `infrastructure/terraform/{components,modules}` and respect `versions.tf`.
66+
- Keep diffs small and focused. Avoid mixing refactors with behaviour changes unless you explain why.
67+
68+
## Quality Expectations
69+
70+
When proposing a change, agents should:
71+
72+
- Keep code formatted and idiomatic (Terraform, TypeScript, Bash, YAML).
73+
- Stick to existing patterns where available (for example `utils/logger`, composite actions under `.github/actions`).
74+
- Use available information on best practices within the specific area of the codebase.
75+
- **Always** run local pre-commit hooks from the repo root with:
76+
77+
```sh
78+
pre-commit run \
79+
--config scripts/config/pre-commit.yaml
80+
```
81+
82+
to catch formatting and basic lint issues. Domain specific checks will be defined in appropriate nested AGENTS.md files.
83+
84+
- Suggest at least one extra validation step (for example `npm test` in a lambda, or triggering a specific workflow).
85+
- Any required follow up activites which fall outside of the current task's scope should be clearly marked with a 'TODO: CCM-12345' comment. The human user should be prompted to create and provide a JIRA ticket ID to be added to the comment.
86+
87+
## Security & Safety
88+
89+
- All agent-generated changes **must** be reviewed and merged by a human.
90+
- Provide a concise, clear summary of the proposed changes to make human review easier (what changed, why (refer directly to the guidance in relevant Agents.MD files when applicable), and how it was validated). It should be directly pastable into the PR description and make it clear that AI assistance was used.
91+
- Never output real secrets or tokens. Use placeholders and rely on the GitHub/AWS secrets already wired into workflows.
92+
93+
## Escalation / Blockers
94+
95+
If you are blocked by an unavailable secret, unclear architectural constraint, missing upstream module, or failing tooling you cannot safely fix, stop and ask a single clear clarifying question rather than guessing.

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ dependencies:: # Install dependencies needed to build and test the project @Pipe
1717
$(MAKE) -C utils/metric-publishers install
1818
$(MAKE) -C utils/event-publisher-py install
1919
$(MAKE) -C utils/py-mock-mesh install
20+
$(MAKE) generate
2021
npm install --workspaces
2122

2223
dependencies-docs:: # Install documentation dependencies @Pipeline
2324
$(MAKE) -C docs install
2425

2526
build: dependencies-docs # Build the project artefact @Pipeline
26-
$(MAKE) -C docs build
27+
28+
generate: # Generate any autogenerated output @Pipeline
29+
npm run generate-dependencies
2730

2831
debug:
2932
$(MAKE) -C docs debug
@@ -45,7 +48,7 @@ clean:: # Clean-up project resources (main) @Operations
4548
$(MAKE) -C utils/event-publisher-py clean
4649
$(MAKE) -C utils/py-mock-mesh clean
4750
rm -f .version
48-
# TODO: Implement project resources clean-up step
51+
npm run clean
4952

5053
config:: _install-dependencies version dependencies # Configure development environment (main) @Configuration
5154

@@ -62,5 +65,5 @@ ${VERBOSE}.SILENT: \
6265
build \
6366
clean \
6467
config \
65-
dependencies \
68+
generate \
6669
deploy \

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Clone the repository
3333
```shell
3434
git clone https://github.com/NHSDigital/nhs-notify-digital-letters.git
3535
cd nhs-notify-digital-letters
36-
code protject.code-workspace
36+
code project.code-workspace
3737
```
3838

3939
Reopen with container
@@ -76,6 +76,10 @@ Installation and configuration of the toolchain dependencies
7676
make config
7777
```
7878
79+
Note that the `make config` command will also build the flattened event schemas and auto-generate a Typescript
80+
type and JS validator code for each event. See the [typescript-schema-generator](src/typescript-schema-generator/)
81+
package for more details.
82+
7983
## Usage
8084

8185
### Testing

docs/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ build: clean build-schemas copy-schema-docs copy-schema-yaml-docs copy-schemas b
4343

4444
build-ci: build-schemas-ci copy-schema-docs copy-schema-yaml-docs copy-schemas build-eventcatalog build-docs show-build-output
4545

46-
4746
build-eventcatalog:
4847
$(MAKE) build-eventcatalog-prereq
4948
make -C $(EVENT_CAT_ROOT_DIR) build BASE_URL=$(EVENT_CAT_URL)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
3+
title: MESH Acknowledger
4+
parent: MESH Services
5+
nav_order: 4
6+
has_children: true
7+
last_modified_date: 2024-10-28
8+
owner: Tom D'Roza
9+
author: Tom D'Roza
10+
diagrams: [c4code-mesh-acknowledger]
11+
events-raised: [mesh-inbox-message-acknowledged]
12+
events-consumed: [mesh-inbox-message-downloaded]
13+
c4type: code
14+
---
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
3+
title: Send letter to print
4+
parent: Print Supplier Services
5+
nav_order: 9
6+
has_children: false
7+
is_not_draft: false
8+
last_modified_date: 2025-12-04
9+
owner: Ross Buggins
10+
author: Tom D'Roza
11+
diagrams: []
12+
events-raised: [external-supplier-api-letter-prepared]
13+
events-consumed: [queue-item-dequeued]
14+
c4type: code
15+
---

0 commit comments

Comments
 (0)