diff --git a/src/ZB.MOM.WW.ScadaBridge.DeploymentManager/ArtifactDeploymentService.cs b/src/ZB.MOM.WW.ScadaBridge.DeploymentManager/ArtifactDeploymentService.cs index 16e0601f..9c580cbe 100644 --- a/src/ZB.MOM.WW.ScadaBridge.DeploymentManager/ArtifactDeploymentService.cs +++ b/src/ZB.MOM.WW.ScadaBridge.DeploymentManager/ArtifactDeploymentService.cs @@ -50,12 +50,6 @@ public class ArtifactDeploymentService /// Repository for deployment records. /// Repository for templates. /// Repository for external systems. - /// - /// Retained on the signature for DI/source compatibility but - /// intentionally NOT consumed. Notification lists and SMTP configuration are - /// central-only and are never shipped to sites, so the artifact path must not read - /// the notification repository at all. - /// /// Service for communicating with sites. /// Service for audit logging. /// Deployment manager options. @@ -75,7 +69,6 @@ public class ArtifactDeploymentService IDeploymentManagerRepository deploymentRepo, ITemplateEngineRepository templateRepo, IExternalSystemRepository externalSystemRepo, - INotificationRepository notificationRepo, CommunicationService communicationService, IAuditService auditService, IOptions options, @@ -87,9 +80,6 @@ public class ArtifactDeploymentService _deploymentRepo = deploymentRepo; _templateRepo = templateRepo; _externalSystemRepo = externalSystemRepo; - // notificationRepo is deliberately not stored — notification - // lists and SMTP configs are central-only and are never fetched for shipping to sites. - _ = notificationRepo; _communicationService = communicationService; _auditService = auditService; _options = options.Value; diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Admin/SitesPageTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Admin/SitesPageTests.cs index 84155d8a..0b7bed72 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Admin/SitesPageTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Admin/SitesPageTests.cs @@ -50,7 +50,6 @@ public class SitesPageTests : BunitContext Substitute.For(), Substitute.For(), Substitute.For(), - Substitute.For(), comms, Substitute.For(), Options.Create(new DeploymentManagerOptions()), diff --git a/tests/ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests/ArtifactDeploymentServiceTests.cs b/tests/ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests/ArtifactDeploymentServiceTests.cs index 999612aa..a6bab7e8 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests/ArtifactDeploymentServiceTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests/ArtifactDeploymentServiceTests.cs @@ -26,7 +26,6 @@ public class ArtifactDeploymentServiceTests : TestKit private readonly IDeploymentManagerRepository _deploymentRepo; private readonly ITemplateEngineRepository _templateRepo; private readonly IExternalSystemRepository _externalSystemRepo; - private readonly INotificationRepository _notificationRepo; private readonly IAuditService _audit; private readonly ArtifactRevisionHashService _hashService = new(); private readonly ISecretStore _secretStore; @@ -41,7 +40,6 @@ public class ArtifactDeploymentServiceTests : TestKit // The notification repo is retained only so the // tests can assert the artifact path NEVER touches it (it is no longer a // constructor dependency of ArtifactDeploymentService). - _notificationRepo = Substitute.For(); _audit = Substitute.For(); // Unconfigured GetAsync returns null (NSubstitute default), i.e. "not in the store" — // exactly the fail-closed posture a test wants unless it explicitly seeds a row. @@ -208,11 +206,10 @@ public class ArtifactDeploymentServiceTests : TestKit await _templateRepo.Received(1).GetAllSharedScriptsAsync(Arg.Any()); await _externalSystemRepo.Received(1).GetAllExternalSystemsAsync(Arg.Any()); await _externalSystemRepo.Received(1).GetAllDatabaseConnectionsAsync(Arg.Any()); - // Notification lists and SMTP configuration are - // central-only — the artifact path must NEVER fetch them, and the per-site - // command must NEVER carry them. - await _notificationRepo.DidNotReceive().GetAllNotificationListsAsync(Arg.Any()); - await _notificationRepo.DidNotReceive().GetAllSmtpConfigurationsAsync(Arg.Any()); + // Notification lists and SMTP configuration are central-only — the service has no + // notification repository at all (see + // Constructor_TakesNoNotificationRepository), and the per-site command must NEVER + // carry them. Assert.All(recorder.Received, cmd => { Assert.Null(cmd.NotificationLists); @@ -278,9 +275,7 @@ public class ArtifactDeploymentServiceTests : TestKit await _templateRepo.Received(1).GetAllSharedScriptsAsync(Arg.Any()); await _externalSystemRepo.Received(1).GetAllExternalSystemsAsync(Arg.Any()); await _externalSystemRepo.Received(1).GetAllDatabaseConnectionsAsync(Arg.Any()); - // Central-only — never fetched, never shipped. - await _notificationRepo.DidNotReceive().GetAllNotificationListsAsync(Arg.Any()); - await _notificationRepo.DidNotReceive().GetAllSmtpConfigurationsAsync(Arg.Any()); + // Central-only — never fetched (no notification repository), never shipped. Assert.All(recorder.Received, cmd => { Assert.Null(cmd.NotificationLists); @@ -1105,6 +1100,21 @@ public class ArtifactDeploymentServiceTests : TestKit Assert.DoesNotContain("Ciphertext", json, StringComparison.OrdinalIgnoreCase); } + /// + /// review 2026-10-21 04/U4: notification lists and SMTP configs are central-only and never + /// shipped, so the service must not depend on the notification repository at all — a + /// dead DI edge kept a spurious DeploymentManager→Notification dependency alive. + /// + [Fact] + public void Constructor_TakesNoNotificationRepository() + { + var parameterTypes = typeof(ArtifactDeploymentService).GetConstructors() + .SelectMany(c => c.GetParameters()) + .Select(p => p.ParameterType); + + Assert.DoesNotContain(typeof(INotificationRepository), parameterTypes); + } + private ArtifactDeploymentService CreateService(ILogger? logger = null) { var comms = new CommunicationService( @@ -1112,7 +1122,7 @@ public class ArtifactDeploymentServiceTests : TestKit NullLogger.Instance); return new ArtifactDeploymentService( - _siteRepo, _deploymentRepo, _templateRepo, _externalSystemRepo, _notificationRepo, + _siteRepo, _deploymentRepo, _templateRepo, _externalSystemRepo, comms, _audit, Options.Create(new DeploymentManagerOptions()), logger ?? NullLogger.Instance, @@ -1132,7 +1142,7 @@ public class ArtifactDeploymentServiceTests : TestKit comms.SetCommunicationActor(commActor); return new ArtifactDeploymentService( - _siteRepo, _deploymentRepo, _templateRepo, _externalSystemRepo, _notificationRepo, + _siteRepo, _deploymentRepo, _templateRepo, _externalSystemRepo, comms, _audit, Options.Create(new DeploymentManagerOptions { diff --git a/tests/ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests/PendingUpdatesEvaluatorTests.cs b/tests/ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests/PendingUpdatesEvaluatorTests.cs index caa4e62e..26d5cc23 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests/PendingUpdatesEvaluatorTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests/PendingUpdatesEvaluatorTests.cs @@ -39,7 +39,6 @@ public class PendingUpdatesEvaluatorTests private readonly ISiteRepository _siteRepo = Substitute.For(); private readonly ITemplateEngineRepository _templateRepo = Substitute.For(); private readonly IExternalSystemRepository _externalSystemRepo = Substitute.For(); - private readonly INotificationRepository _notificationRepo = Substitute.For(); private readonly IDeploymentManagerRepository _deploymentRepo = Substitute.For(); private readonly IFlatteningPipeline _pipeline = Substitute.For(); private readonly IAuditService _audit = Substitute.For(); @@ -63,7 +62,7 @@ public class PendingUpdatesEvaluatorTests NullLogger.Instance); _artifactService = new ArtifactDeploymentService( - _siteRepo, _deploymentRepo, _templateRepo, _externalSystemRepo, _notificationRepo, + _siteRepo, _deploymentRepo, _templateRepo, _externalSystemRepo, comms, _audit, Options.Create(new DeploymentManagerOptions()), NullLogger.Instance, diff --git a/tests/ZB.MOM.WW.ScadaBridge.ManagementService.Tests/ManagementActorTests.cs b/tests/ZB.MOM.WW.ScadaBridge.ManagementService.Tests/ManagementActorTests.cs index 66badb49..6b977f20 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.ManagementService.Tests/ManagementActorTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.ManagementService.Tests/ManagementActorTests.cs @@ -81,7 +81,6 @@ public class ManagementActorTests : TestKit, IDisposable Substitute.For(), Substitute.For(), Substitute.For(), - Substitute.For(), comms, Substitute.For(), Options.Create(new DeploymentManagerOptions()),