Skip to content

Fix: [AEA-5838] - changing log levels#1955

Merged
connoravo-nhs merged 7 commits intomainfrom
aea-5838-changing-log-levels
Mar 27, 2026
Merged

Fix: [AEA-5838] - changing log levels#1955
connoravo-nhs merged 7 commits intomainfrom
aea-5838-changing-log-levels

Conversation

@jonathanwelch1-nhs
Copy link
Copy Markdown
Contributor

https://nhsd-jira.digital.nhs.uk/browse/AEA-5838
https://nhsd-jira.digital.nhs.uk/browse/AEA-5841
https://nhsd-jira.digital.nhs.uk/browse/AEA-5837

Routine Change

Details

Changing some log levels that were showing false errors. 2 have been downgraded to warn as they are expected logs when a user is trying to make an api call without correct tokens
1 is correct behaviour so changed to info

Testing added

Copilot AI review requested due to automatic review settings March 26, 2026 12:11
@github-actions
Copy link
Copy Markdown
Contributor

This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:

AEA-5838

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 adjusts logging levels and authentication error responses to reduce false error logs during expected invalid/expired-session scenarios, and updates test expectations accordingly.

Changes:

  • Downgrade selected UI logs (e.g., “no prescriptions” and tracker user info fetch failures) from error to info/warn.
  • Refine auth middleware behavior for invalid sessions (log level changes and ensure invalidSessionCause is returned on failure paths).
  • Update unit tests to reflect the new log levels and 401 response bodies.

Reviewed changes

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

Show a summary per file
File Description
packages/cpt-ui/src/pages/PrescriptionListPage.tsx Downgrades “no prescriptions” logging from error to info.
packages/cpt-ui/src/helpers/userInfo.tsx Downgrades tracker user info fetch logging from error to warn.
packages/cpt-ui/tests/PrescriptionListPage.test.tsx Updates assertion to expect logger.info instead of logger.error.
packages/common/authFunctions/src/authenticationMiddleware.ts Adjusts invalid-session/concurrent-session branching and sets invalidSessionCause on exception paths.
packages/common/authFunctions/src/authenticationConcurrentAwareMiddleware.ts Downgrades “no matching session found” from error to warn and sets invalidSessionCause on exception paths.
packages/common/authFunctions/tests/test_authenticationMiddleware.test.ts Updates mocks/expectations for new invalid-session behavior and response body content.
packages/common/authFunctions/tests/test_authenticationConcurrentAwareMiddleware.test.ts Updates expected 401 payloads to include invalidSessionCause.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link
Copy Markdown

@connoravo-nhs connoravo-nhs merged commit 06d9e3b into main Mar 27, 2026
20 checks passed
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.

3 participants