Skip to content

[HOTE-803] feat: fix stubs deployment, align dep versions#336

Draft
mikeeq wants to merge 9 commits intomainfrom
feature/hote-803/improve-lambdas
Draft

[HOTE-803] feat: fix stubs deployment, align dep versions#336
mikeeq wants to merge 9 commits intomainfrom
feature/hote-803/improve-lambdas

Conversation

@mikeeq
Copy link
Copy Markdown
Collaborator

@mikeeq mikeeq commented Apr 10, 2026

Description

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.

Copilot AI review requested due to automatic review settings April 10, 2026 13:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make WireMock/NHS Login stubs more reliable between runs and to align local/dev tooling dependency versions (Postgres + mise tooling config).

Changes:

  • Add a per-process nonce to WireMock JWT kid values to avoid JWKS key-cache collisions across runs.
  • Update Postgres image tags from 17.7 to 17.9 across local Docker and the DB client integration test.
  • Tighten mise configuration (locked + lockfile) and adjust the pinned Python patch version.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/utils/users/wiremockAuthMappings.ts Appends a nonce to kid to force JWKS re-fetches instead of serving stale cached keys.
tests/scripts/push-wiremock-mappings.ts Passes WireMock base URL through to auth manifest generation (issuer), and updates related comments.
local-environment/scripts/database/Dockerfile Bumps the Postgres base image to 17.9 for DB migration container.
local-environment/docker-compose.yml Bumps the Postgres service image to 17.9.
lambdas/src/lib/db/db-client.integration.test.ts Aligns the testcontainer Postgres image to 17.9.
.mise.toml Enables locked installs, adds python/aqua settings, and changes the Python patch version.

Comment on lines +87 to +91
// Generate fresh RSA key pairs + JWTs for all default test users.
// The issued JWTs use the Docker-internal WIREMOCK_ISSUER ("http://wiremock:8080")
// as the issuer so they match what the login-lambda validates against
// (NHS_LOGIN_BASE_ENDPOINT_URL inside the localstack container).
// The issued JWTs use wiremockBaseUrl as the issuer so they match what the
// login-lambda validates against (NHS_LOGIN_BASE_ENDPOINT_URL).
cleanupWireMockAuthState();
const manifest = createWireMockAuthManifest();
const manifest = createWireMockAuthManifest(wiremockBaseUrl);
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

createWireMockAuthManifest is now passed wiremockBaseUrl as the JWT issuer, but in local dev the login/session lambdas validate against the container URL (http://wiremock:8080 via NHS_LOGIN_BASE_ENDPOINT_URL), so the default wiremockBaseUrl (http://localhost:8080) will produce tokens with an issuer that the lambdas will reject. Split the WireMock admin base URL from the JWT issuer (e.g. keep default issuer as http://wiremock:8080 or add a separate WIREMOCK_ISSUER env var / replace localhost→wiremock only for issuer).

Copilot uses AI. Check for mistakes.
[settings.python]
compile = false

# Disable to avoid calling Github API
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The comment says "Github API" but the project uses the "GitHub" capitalization elsewhere; please change it for consistency.

Suggested change
# Disable to avoid calling Github API
# Disable to avoid calling GitHub API

Copilot uses AI. Check for mistakes.

# https://devguide.python.org/versions/
python = "3.14.3"
python = "3.14.2"
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

python is set to "3.14.2" here, but mise.lock still pins Python 3.14.3; with locked/lockfile enabled this mismatch can break or confuse tool installs. Regenerate/update mise.lock to match the new Python version (or revert the version change) so the config and lockfile stay consistent.

Suggested change
python = "3.14.2"
python = "3.14.3"

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings April 10, 2026 15:31
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Lambdas Coverage Report

Lines Statements Branches Functions
Coverage: 98%
98.5% (1451/1473) 92.37% (424/459) 96.66% (232/240)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

UI Coverage Report

Lines Statements Branches Functions
Coverage: 95%
95.66% (5732/5992) 87.58% (684/781) 87.86% (210/239)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Comment on lines 87 to 92
// Generate fresh RSA key pairs + JWTs for all default test users.
// The issued JWTs use the Docker-internal WIREMOCK_ISSUER ("http://wiremock:8080")
// as the issuer so they match what the login-lambda validates against
// (NHS_LOGIN_BASE_ENDPOINT_URL inside the localstack container).
// The issued JWTs use wiremockBaseUrl as the issuer so they match what the
// login-lambda validates against (NHS_LOGIN_BASE_ENDPOINT_URL).
cleanupWireMockAuthState();
const manifest = createWireMockAuthManifest();
const manifest = createWireMockAuthManifest(wiremockBaseUrl);

Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

createWireMockAuthManifest(wiremockBaseUrl) ties the JWT iss claim to the URL used to push mappings (default http://localhost:8080), but in localstack wiremock mode the login lambda validates tokens against NHS_LOGIN_BASE_ENDPOINT_URL which is typically the Docker-internal http://wiremock:8080 (see local-environment/infra/main.tf locals). Consider separating “WireMock API base URL” from “JWT issuer” (e.g. WIREMOCK_JWT_ISSUER/NHS_LOGIN_BASE_ENDPOINT_URL) and pass the issuer into createWireMockAuthManifest (and /userinfo mapping) independently.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings April 13, 2026 10:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings April 13, 2026 12:01
@sonarqubecloud
Copy link
Copy Markdown

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.

2 participants