fix(audit): robust central options binding + interval clamps + doc/contract fixes (review)

This commit is contained in:
Joseph Doherty
2026-06-15 10:11:49 -04:00
parent 36a08a4145
commit c092e89fd1
7 changed files with 153 additions and 40 deletions
@@ -7,6 +7,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using ZB.MOM.WW.ScadaBridge.AuditLog;
using ZB.MOM.WW.ScadaBridge.AuditLog.Central;
using ZB.MOM.WW.ScadaBridge.AuditLog.Site;
using ZB.MOM.WW.ScadaBridge.AuditLog.Site.Telemetry;
using ZB.MOM.WW.ScadaBridge.ClusterInfrastructure;
@@ -238,6 +239,36 @@ public class CentralAuditWiringTests : IDisposable
Assert.NotNull(forwarder);
Assert.IsType<CachedCallTelemetryForwarder>(forwarder);
}
/// <summary>
/// I4 (review): the central composition root must register the production
/// reconciliation collaborators via
/// <c>AddAuditLogCentralReconciliationClient</c>. Asserting the concrete
/// implementations resolve here is a faster, clearer signal than a runtime
/// "actor not found" / cryptic <c>GetRequiredService</c> throw in
/// <c>AkkaHostedService.RegisterCentralActors</c> if that helper is ever
/// dropped from <c>Program.cs</c>.
/// </summary>
[Fact]
public void Central_Resolves_ISiteEnumerator_AsSiteEnumerator()
{
var enumerator = _factory.Services.GetService<ISiteEnumerator>();
Assert.NotNull(enumerator);
Assert.IsType<SiteEnumerator>(enumerator);
}
/// <summary>
/// I4 (review): companion to <see cref="Central_Resolves_ISiteEnumerator_AsSiteEnumerator"/>
/// — the production gRPC pull client must resolve on the central composition
/// root so the SiteAuditReconciliationActor singleton can dial sites.
/// </summary>
[Fact]
public void Central_Resolves_IPullAuditEventsClient_AsGrpcClient()
{
var client = _factory.Services.GetService<IPullAuditEventsClient>();
Assert.NotNull(client);
Assert.IsType<GrpcPullAuditEventsClient>(client);
}
}
/// <summary>