Skip to content

feat: wire-up dummy gp code changes#1895

Draft
MWClayson-NHS wants to merge 27 commits intomainfrom
feat/wireup-dummyGPCode
Draft

feat: wire-up dummy gp code changes#1895
MWClayson-NHS wants to merge 27 commits intomainfrom
feat/wireup-dummyGPCode

Conversation

@MWClayson-NHS
Copy link
Copy Markdown
Contributor

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.

MWClayson-NHS and others added 12 commits April 22, 2026 14:14
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

Unit Test Results

✔️ Tests 1076 / 1076 - passed in 71.2s
📝 Coverage 47.76%
📏 5252 / 11282 lines covered 🌿 1262 / 2358 branches covered
🔍 click here for more details

✏️ updated for commit def90f4

MWClayson-NHS and others added 4 commits April 29, 2026 13:12
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@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

This PR wires up “Remove Dummy GP Code” end-to-end, adding RBAC-gated UI access, forwarding CIS2 auth headers to the new function endpoint, and extending audit logging so requests can be captured and persisted via the audit pipeline.

Changes:

  • Add UI RBAC gating for the Remove Dummy GP Code feature and send CIS2 tokens to the backend.
  • Introduce an audit logging host extension and add audit events for ServiceNow receive + dummy GP code removal.
  • Refactor Functions auth to use an IFunctionContextAuthResolver, and move audit snapshot blob-writing into AuditWriter.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
tests/UnitTests/SharedTests/AuthenticationTests/AuthenticationTests.cs Updates middleware construction to use the new auth resolver dependency.
tests/UnitTests/SharedTests/AuditLogClientTests/AuditLogClientTests.cs Adds unit coverage for AuditLogClient queueing/logging behavior.
tests/UnitTests/ServiceNowMessageHandlerTests/ReceiveServiceNowMessageFunctionTests.cs Updates function constructor to include IAuditLogClient.
tests/UnitTests/ParticipantManagementServicesTests/RemoveDummyGPCodeTests/ReceiveRemoveDummyGPCodeFunctionTests.cs Updates test harness for new auth/audit dependencies and FunctionContext setup.
tests/UnitTests/ParticipantManagementServicesTests/ManageServiceNowParticipantTests/ManageServiceNowParticipantFunctionTests.cs Removes audit-client expectations after audit responsibility shift.
tests/UnitTests/AuditServicesTests/AuditWriterTests/AuditWriterTests.cs Updates AuditWriter tests for blob snapshot write behavior and failure modes.
infrastructure/tf-core/environments/development.tfvars Adds key vault hookup + UserInfoUrl for RemoveDummyGPCode.
application/CohortManager/src/Web/app/remove-dummy-gp-code/page.tsx Adds server-side RBAC check + redirect guard for the page.
application/CohortManager/src/Web/app/lib/removeDummyGpCode.ts Adds CIS2 token headers when calling the RemoveDummyGPCode API.
application/CohortManager/src/Web/app/lib/removeDummyGpCode.test.ts Mocks auth for the updated server action.
application/CohortManager/src/Web/app/lib/checkAccess.ts Adds RBAC check helper specific to Remove Dummy GP Code feature flag/code.
application/CohortManager/src/Web/app/components/overview.tsx Conditionally renders Dummy GP Code cards based on RBAC.
application/CohortManager/src/Web/.env.example Documents new RBAC env var for Remove Dummy GP Code.
application/CohortManager/src/Functions/Shared/Model/ParticipantAuditMessage.cs Removes JsonIgnore so RequestSnapshot is serialized into audit messages.
application/CohortManager/src/Functions/Shared/Common/Extensions/AuthenticationExtension.cs Registers auth resolver and swaps middlewares to use it.
application/CohortManager/src/Functions/Shared/Common/Extensions/AuditExtension.cs Adds AddAuditLogging host extension and registers IAuditLogClient.
application/CohortManager/src/Functions/Shared/Common/Authentication/Models/FunctionEndpointMetadataCollection.cs Extracts endpoint metadata helper type.
application/CohortManager/src/Functions/Shared/Common/Authentication/Models/FunctionEndpoint.cs Extracts endpoint wrapper type used by the auth resolver.
application/CohortManager/src/Functions/Shared/Common/Authentication/Middleware/PermissionsMiddleware.cs Replaces context extensions with IFunctionContextAuthResolver.
application/CohortManager/src/Functions/Shared/Common/Authentication/Middleware/Cis2AuthMiddleware.cs Fetches scoped ICis2UserService from InstanceServices; uses resolver for auth requirement.
application/CohortManager/src/Functions/Shared/Common/Authentication/IFunctionContextAuthResolver.cs Adds new abstraction for auth/roles resolution from FunctionContext.
application/CohortManager/src/Functions/Shared/Common/Authentication/FunctionContextAuthResolver.cs Implements cached endpoint metadata lookup + exposes user/role/auth checks.
application/CohortManager/src/Functions/Shared/Common/AuditLogClient.cs Removes snapshot blob write; now only enqueues audit messages.
application/CohortManager/src/Functions/ServiceNowIntegration/ServiceNowMessageHandler/ReceiveServiceNowMessageFunction.cs Emits audit log messages for incoming ServiceNow requests.
application/CohortManager/src/Functions/ServiceNowIntegration/ServiceNowMessageHandler/Program.cs Wires audit logging into ServiceNowMessageHandler host.
application/CohortManager/src/Functions/ParticipantManagementServices/RemoveDummyGPCode/ReceiveRemoveDummyGPCodeFunction.cs Adds [Authentication] and emits audit messages for dummy GP removals.
application/CohortManager/src/Functions/ParticipantManagementServices/RemoveDummyGPCode/Program.cs Enables auth middleware and wires audit logging.
application/CohortManager/src/Functions/ParticipantManagementServices/ManageServiceNowParticipant/Program.cs Removes audit client registration; adjusts ServiceBus registration ordering.
application/CohortManager/src/Functions/ParticipantManagementServices/ManageServiceNowParticipant/ManageServiceNowParticipantFunction.cs Removes audit enqueue from ManageServiceNowParticipant.
application/CohortManager/src/Functions/CaasIntegration/receiveCaasFile/Program.cs Switches to AddAuditLogging rather than manual audit client registration.
application/CohortManager/src/Functions/AuditServices/AuditWriter/Program.cs Registers IBlobStorageHelper for snapshot writes.
application/CohortManager/src/Functions/AuditServices/AuditWriter/AuditWriter.cs Writes RequestSnapshot to blob and persists resulting URI.
.github/workflows/ci-ui-tests.yaml Adds env vars for e2e tests related to new RBAC code + API URL.
Comments suppressed due to low confidence (1)

application/CohortManager/src/Functions/Shared/Common/Extensions/AuthenticationExtension.cs:27

  • IFunctionContextAuthResolver is only registered inside the !authConfig.ByPassAuthentication branch. Any function that injects IFunctionContextAuthResolver directly (e.g., ReceiveRemoveDummyGpCodeFunction) will fail DI/startup when ByPassAuthentication is enabled. Consider registering FunctionContextAuthResolver unconditionally (even if the middleware pipeline is bypassed).
            hostBuilder.ConfigureServices((context, services) =>
            {
                services.AddSingleton<IFunctionContextAuthResolver, FunctionContextAuthResolver>();
                services.AddSingleton<IAuthenticationService, JwtAuthentication>();
                services.AddScoped<ICis2UserService,Cis2UserService>();
                services.AddSingleton<IRoleManager, RoleManager>();
            });

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

Comment thread .github/workflows/ci-ui-tests.yaml Outdated
Comment thread infrastructure/tf-core/environments/development.tfvars
MWClayson-NHS and others added 10 commits April 30, 2026 11:06
…ns/AuthenticationExtension.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ervices/RemoveDummyGPCode/ReceiveRemoveDummyGPCodeFunction.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ervices/RemoveDummyGPCode/ReceiveRemoveDummyGPCodeFunction.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ervices/RemoveDummyGPCode/ReceiveRemoveDummyGPCodeFunction.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ervices/RemoveDummyGPCode/ReceiveRemoveDummyGPCodeFunction.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…cation/Middleware/Cis2AuthMiddleware.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@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