Skip to content

[HOTE-1100] feat: result-status-lambda#347

Open
TSeelig wants to merge 16 commits intomainfrom
feature/hote-1100/result-status-lambda
Open

[HOTE-1100] feat: result-status-lambda#347
TSeelig wants to merge 16 commits intomainfrom
feature/hote-1100/result-status-lambda

Conversation

@TSeelig
Copy link
Copy Markdown
Contributor

@TSeelig TSeelig commented Apr 13, 2026

Description

HOTE-1100 - Reactive Results: Enabler 1 - Create Result Status Lambda
Introduces new lambda to update result status. Currently only accepts result available.

Context

Implements 1 of 3 lambdas required for epic: Reactive result after clinician contact - Result Available

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 13, 2026 14:27
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

Lambdas Coverage Report

Lines Statements Branches Functions
Coverage: 98%
98.48% (1559/1583) 92.62% (402/434) 96.77% (240/248)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

UI Coverage Report

Lines Statements Branches Functions
Coverage: 96%
96.16% (5669/5895) 88.22% (682/773) 88.06% (214/243)

@TSeelig TSeelig force-pushed the feature/hote-1100/result-status-lambda branch from ad81571 to 8572e51 Compare April 13, 2026 14:32
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

Adds a new result-status-lambda intended to accept a FHIR Task and record a “result available” status update for an order.

Changes:

  • Introduces result-status-lambda handler, request validation schema, and unit tests.
  • Adds ResultService DB helper for inserting result_status records.
  • Extends OrderService with a query to fetch the patient UID for an order (for ownership checks).

Reviewed changes

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

Show a summary per file
File Description
lambdas/src/result-status-lambda/models.ts Adds Zod schema for validating incoming FHIR Task payloads for result status updates.
lambdas/src/result-status-lambda/init.ts Wires up commons + Postgres client + ResultService/OrderService dependencies.
lambdas/src/result-status-lambda/init.test.ts Adds init wiring/unit tests for environment construction and singleton behaviour.
lambdas/src/result-status-lambda/index.ts Implements the result status endpoint handler (parse/validate, authorise, write status).
lambdas/src/result-status-lambda/index.test.ts Adds handler unit tests covering parsing, validation, auth, DB error paths, and success.
lambdas/src/lib/db/result-db.ts Adds DB helper to insert into result_status.
lambdas/src/lib/db/result-db.test.ts Unit tests for ResultService.updateResultStatus.
lambdas/src/lib/db/order-db.ts Adds OrderPatientReference type and retrievePatientIdFromOrder query method.
lambdas/src/lib/db/order-db.test.ts Unit tests for the new retrievePatientIdFromOrder method.
Comments suppressed due to low confidence (1)

lambdas/src/result-status-lambda/init.test.ts:151

  • Leaving //TODO notes in committed tests (and missing the common init-module "rejection retry" test seen in other lambdas) makes the suite incomplete; add the rejection-retry coverage (e.g., assert init can be called again after buildEnvironment() throws) and remove the TODOs.

  describe("singleton behavior", () => {
    it("should return the same Environment instance on multiple calls to init", () => {
      const env1 = init();
      const env2 = init();

      expect(env1).toBe(env2);
    });
  });
});

Copilot AI review requested due to automatic review settings April 13, 2026 15:27
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 10 out of 10 changed files in this pull request and generated 5 comments.

@TSeelig TSeelig force-pushed the feature/hote-1100/result-status-lambda branch from b44938f to d663a2b Compare April 13, 2026 16:10
Copilot AI review requested due to automatic review settings April 13, 2026 16:10
@TSeelig TSeelig force-pushed the feature/hote-1100/result-status-lambda branch from d663a2b to 85e3399 Compare April 13, 2026 16:13
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 11 out of 11 changed files in this pull request and generated 3 comments.

@TSeelig TSeelig force-pushed the feature/hote-1100/result-status-lambda branch from 85e3399 to 27ea63b Compare April 13, 2026 16:25
Copilot AI review requested due to automatic review settings April 14, 2026 08:42
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 12 out of 12 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

lambdas/src/lib/db/order-db.ts:103

  • updateOrderStatusAndResultStatus has correlationId available but the error log omits it; this makes failed status updates harder to trace across services/log aggregation.
      console.error("order-db", "Failed to update order and result status", {
        error,
        orderUid,
      });
      throw error;

Copilot AI review requested due to automatic review settings April 14, 2026 09:45
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 10 out of 10 changed files in this pull request and generated 6 comments.

@TSeelig
Copy link
Copy Markdown
Contributor Author

TSeelig commented Apr 14, 2026

Raised NHSDigital/hometest-mgmt-terraform#99 for hometest-mgmt-terraform update

Copilot AI review requested due to automatic review settings April 14, 2026 10:41
@TSeelig TSeelig force-pushed the feature/hote-1100/result-status-lambda branch from 9edd59a to fd0d011 Compare April 14, 2026 10:41
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 10 out of 10 changed files in this pull request and generated 4 comments.

@TSeelig TSeelig requested a review from cptiv2020 April 14, 2026 11:45
Copilot AI review requested due to automatic review settings April 14, 2026 12:06
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 11 out of 11 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings April 14, 2026 13:20
…tion or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
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 11 out of 11 changed files in this pull request and generated 6 comments.

Copilot AI review requested due to automatic review settings April 14, 2026 14:58
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 13 out of 13 changed files in this pull request and generated 7 comments.

orderId = result.order_uid;
patientId = result.patient_uid;
correlationId = randomUUID();
console.log(`Created test order with ID: ${orderId}`);
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Avoid console.log in Playwright tests; use the shared Logger utility (tests/utils/Logger.ts) or remove the log line to keep test output clean and consistent.

Copilot generated this review using guidance from repository custom instructions.
@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.

6 participants