Skip to content

Commit b39c796

Browse files
committed
fix merge
2 parents c4a695a + 4095435 commit b39c796

File tree

389 files changed

+18670
-3719
lines changed

Some content is hidden

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

389 files changed

+18670
-3719
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
/docs/ @NHSDigital/nhs-notify-web-template-management
88
/infrastructure/terraform/ @NHSDigital/nhs-notify-platform
99

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

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
109109
version: "${{ needs.metadata.outputs.version }}"
110110
secrets: inherit
111+
111112
test-stage: # Recommended maximum execution time is 5 minutes
112113
name: "Test stage"
113114
needs: [metadata, dependencies, commit-stage]
@@ -121,6 +122,29 @@ jobs:
121122
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
122123
version: "${{ needs.metadata.outputs.version }}"
123124
secrets: inherit
125+
126+
pr-create-dynamic-environment:
127+
name: Create Dynamic Environment
128+
needs: [metadata, dependencies, commit-stage]
129+
runs-on: ubuntu-latest
130+
if: needs.metadata.outputs.does_pull_request_exist == 'true' && github.ref != 'refs/heads/main'
131+
steps:
132+
- uses: actions/[email protected]
133+
- name: Trigger dynamic environment creation
134+
env:
135+
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
136+
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
137+
shell: bash
138+
run: |
139+
.github/scripts/dispatch_internal_repo_workflow.sh \
140+
--infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \
141+
--releaseVersion "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \
142+
--targetWorkflow "dispatch-deploy-dynamic-env.yaml" \
143+
--targetEnvironment "pr${{ github.event.number }}" \
144+
--targetComponent "branch" \
145+
--targetAccountGroup "nhs-notify-template-management-dev" \
146+
--terraformAction "apply" \
147+
--overrides "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
124148
acceptance-stage: # Recommended maximum execution time is 10 minutes
125149
name: "Acceptance stage"
126150
needs: [metadata, dependencies, test-stage]

.github/workflows/pr_create_dynamic_env.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/pr_destroy_dynamic_env.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: PR Destroy Environment
33
on:
44
pull_request:
55
types: [closed]
6+
branches:
7+
- '*'
68

79
concurrency:
810
group: ${{ github.workflow }}-${{ github.ref }}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ jobs:
8686
- name: "Restore node_modules from cache"
8787
uses: ./.github/actions/node-modules-cache
8888
with:
89-
node_version: "${{ inputs.nodejs_version }}"
89+
# Pinned Node version for running unit tests to ensure that coverage checks work as expected
90+
# Long term fix covered in CCM-9959
91+
node_version: "22.21.1"
9092
- name: "Generate dependencies"
9193
run: |
9294
npm run generate-dependencies --workspaces --if-present

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,7 @@ lambdas/backend-api/src/email/email-template.json
9393
# vscode
9494
.vscode/settings.local.json
9595

96+
# github
97+
.github/copilot-instructions.md
98+
9699
test-runs

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.

frontend/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
public
22
amplify
3+
next-env.d.ts

frontend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
"jwt-decode": "^4.0.0",
1111
"markdown-it": "^13.0.2",
1212
"markdown-to-jsx": "^7.7.10",
13-
"next": "^15.2.3",
13+
"next": "^15.5.9",
1414
"next-client-cookies": "^2.0.1",
1515
"nhs-notify-backend-client": "^0.0.1",
1616
"nhs-notify-web-template-management-utils": "^0.0.1",
1717
"nhsuk-frontend": "^10.0.0",
1818
"nhsuk-react-components": "^5.0.0",
1919
"path": "^0.12.7",
20-
"react": "^19.0.0",
21-
"react-dom": "^19.0.0",
20+
"react": "^19.0.3",
21+
"react-dom": "^19.0.3",
2222
"react-idle-timer": "^5.7.2",
2323
"zod": "^4.0.17"
2424
},

frontend/src/__tests__/app/choose-templates/__snapshots__/page.test.tsx.snap

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
102102
class="nhsuk-u-margin-bottom-2"
103103
data-testid="template-name-NHSAPP"
104104
>
105-
name
105+
app template name
106106
</p>
107107
<ul
108108
class="channel-template-actions"
@@ -111,7 +111,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
111111
<a
112112
class="nhsuk-link nhsuk-link--no-visited-state"
113113
data-testid="change-template-link-NHSAPP"
114-
href="/message-plans/choose-nhs-app-template/fbb81055-79b9-4759-ac07-d191ae57be34"
114+
href="/message-plans/choose-nhs-app-template/fbb81055-79b9-4759-ac07-d191ae57be34?lockNumber=0"
115115
>
116116
Change
117117
<span
@@ -127,14 +127,22 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
127127
<form>
128128
<input
129129
name="channel"
130+
readonly=""
130131
type="hidden"
131132
value="NHSAPP"
132133
/>
133134
<input
134135
name="routingConfigId"
136+
readonly=""
135137
type="hidden"
136138
value="fbb81055-79b9-4759-ac07-d191ae57be34"
137139
/>
140+
<input
141+
name="lockNumber"
142+
readonly=""
143+
type="hidden"
144+
value="0"
145+
/>
138146
<button
139147
class="channel-template-link--remove nhsuk-link"
140148
data-testid="remove-template-link-NHSAPP"
@@ -275,7 +283,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
275283
class="nhsuk-u-margin-bottom-2"
276284
data-testid="template-name-SMS"
277285
>
278-
name
286+
sms template name
279287
</p>
280288
<ul
281289
class="channel-template-actions"
@@ -284,7 +292,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
284292
<a
285293
class="nhsuk-link nhsuk-link--no-visited-state"
286294
data-testid="change-template-link-SMS"
287-
href="/message-plans/choose-text-message-template/fbb81055-79b9-4759-ac07-d191ae57be34"
295+
href="/message-plans/choose-text-message-template/fbb81055-79b9-4759-ac07-d191ae57be34?lockNumber=0"
288296
>
289297
Change
290298
<span
@@ -300,14 +308,22 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
300308
<form>
301309
<input
302310
name="channel"
311+
readonly=""
303312
type="hidden"
304313
value="SMS"
305314
/>
306315
<input
307316
name="routingConfigId"
317+
readonly=""
308318
type="hidden"
309319
value="fbb81055-79b9-4759-ac07-d191ae57be34"
310320
/>
321+
<input
322+
name="lockNumber"
323+
readonly=""
324+
type="hidden"
325+
value="0"
326+
/>
311327
<button
312328
class="channel-template-link--remove nhsuk-link"
313329
data-testid="remove-template-link-SMS"
@@ -451,7 +467,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
451467
<a
452468
class="nhsuk-link nhsuk-link--no-visited-state"
453469
data-testid="choose-template-link-EMAIL"
454-
href="/message-plans/choose-email-template/fbb81055-79b9-4759-ac07-d191ae57be34"
470+
href="/message-plans/choose-email-template/fbb81055-79b9-4759-ac07-d191ae57be34?lockNumber=0"
455471
>
456472
Choose
457473
<span
@@ -586,7 +602,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
586602
class="nhsuk-u-margin-bottom-2"
587603
data-testid="template-name-LETTER"
588604
>
589-
name
605+
letter template name
590606
</p>
591607
<ul
592608
class="channel-template-actions"
@@ -595,7 +611,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
595611
<a
596612
class="nhsuk-link nhsuk-link--no-visited-state"
597613
data-testid="change-template-link-LETTER"
598-
href="/message-plans/choose-standard-english-letter-template/fbb81055-79b9-4759-ac07-d191ae57be34"
614+
href="/message-plans/choose-standard-english-letter-template/fbb81055-79b9-4759-ac07-d191ae57be34?lockNumber=0"
599615
>
600616
Change
601617
<span
@@ -611,14 +627,22 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
611627
<form>
612628
<input
613629
name="channel"
630+
readonly=""
614631
type="hidden"
615632
value="LETTER"
616633
/>
617634
<input
618635
name="routingConfigId"
636+
readonly=""
619637
type="hidden"
620638
value="fbb81055-79b9-4759-ac07-d191ae57be34"
621639
/>
640+
<input
641+
name="lockNumber"
642+
readonly=""
643+
type="hidden"
644+
value="0"
645+
/>
622646
<button
623647
class="channel-template-link--remove nhsuk-link"
624648
data-testid="remove-template-link-LETTER"
@@ -650,7 +674,7 @@ exports[`ChooseTemplatesPage renders correctly for a message plan with multiple
650674
class="nhsuk-button"
651675
data-testid="move-to-production-cta"
652676
draggable="false"
653-
href="/message-plans/move-to-production/fbb81055-79b9-4759-ac07-d191ae57be34"
677+
href="/message-plans/get-ready-to-move/fbb81055-79b9-4759-ac07-d191ae57be34"
654678
role="button"
655679
>
656680
Move to production

0 commit comments

Comments
 (0)