perf(comms+audit): close phase-2 residuals — direct ingest path, monotonic timeouts, synthetic probe, not-reporting set, cursor-exact audit pull

This commit is contained in:
Joseph Doherty
2026-08-14 21:38:23 -04:00
parent 4cd1441984
commit a5882753dd
38 changed files with 1254 additions and 443 deletions
@@ -29,6 +29,59 @@ public class CommunicationOptionsValidatorTests
Assert.Contains("DeploymentTimeout", result.FailureMessage);
}
// ── Audit-ingest timeout ladder (arch-review phase-2 residual #2) ────────────
[Fact]
public void TheAuditIngestTimeoutLadder_IsStrictlyMonotonic_EndToEnd()
{
// 35 (site forward Ask) > 30 (gRPC deadline AND central's Ask of the ingest singleton)
// > 20 (actor budget) > 15 (SQL command). Ties are the bug this closes: the site Ask
// used to reuse NotificationForwardTimeout (30 s), so a slow-but-succeeding central
// write could be acked to a caller that had already given up and re-sent the batch.
var options = new CommunicationOptions();
Assert.Equal(TimeSpan.FromSeconds(35), options.AuditForwardTimeout);
Assert.True(options.AuditForwardTimeout > ZB.MOM.WW.ScadaBridge.Communication.Grpc.SiteStreamGrpcServer.AuditIngestAskTimeout);
Assert.Equal(TimeSpan.FromSeconds(30), ZB.MOM.WW.ScadaBridge.Communication.Grpc.SiteStreamGrpcServer.AuditIngestAskTimeout);
}
[Fact]
public void AuditForwardTimeout_EqualToTheAskTimeout_IsRejected()
{
// Equality is precisely the pre-fix state, so the validator must refuse it, not just
// refuse something smaller.
var result = Validate(new CommunicationOptions
{
AuditForwardTimeout = ZB.MOM.WW.ScadaBridge.Communication.Grpc.SiteStreamGrpcServer.AuditIngestAskTimeout,
});
Assert.True(result.Failed);
Assert.Contains("AuditForwardTimeout", result.FailureMessage);
}
[Fact]
public void AuditForwardTimeout_ShorterThanTheAskTimeout_IsRejected()
{
var result = Validate(new CommunicationOptions
{
AuditForwardTimeout = TimeSpan.FromSeconds(5),
});
Assert.True(result.Failed);
Assert.Contains("AuditForwardTimeout", result.FailureMessage);
}
[Fact]
public void AuditForwardTimeout_IsStillConfigurableUpwards()
{
var result = Validate(new CommunicationOptions
{
AuditForwardTimeout = TimeSpan.FromMinutes(2),
});
Assert.True(result.Succeeded, result.FailureMessage);
}
[Fact]
public void NonPositiveGrpcMaxConcurrentStreams_IsRejected()
{