Fix: [AEA-5838] - changing log levels#1955
Merged
connoravo-nhs merged 7 commits intomainfrom Mar 27, 2026
Merged
Conversation
Contributor
|
This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket: AEA-5838 |
Contributor
There was a problem hiding this comment.
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
errortoinfo/warn. - Refine auth middleware behavior for invalid sessions (log level changes and ensure
invalidSessionCauseis 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.
packages/common/authFunctions/tests/test_authenticationMiddleware.test.ts
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…to aea-5838-changing-log-levels
|
connoravo-nhs
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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
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