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
@@ -47,6 +47,36 @@ public class CommunicationOptions
/// </summary>
public TimeSpan NotificationForwardTimeout { get; set; } = TimeSpan.FromSeconds(30);
/// <summary>
/// Audit Log: timeout for the SITE-side Ask that forwards one audit-telemetry batch
/// (<c>IngestAuditEventsCommand</c> / <c>IngestCachedTelemetryCommand</c>) through the site's
/// <c>SiteCommunicationActor</c> and awaits central's ack. Deliberately the LONGEST rung of the
/// ingest timeout ladder.
/// </summary>
/// <remarks>
/// <para>
/// The ladder is strictly monotonic, outermost first:
/// <c>AuditForwardTimeout</c> (35 s, this option) &gt;
/// <c>SiteStreamGrpcServer.AuditIngestAskTimeout</c> (30 s — both the gRPC call deadline and
/// central's own Ask of the ingest singleton) &gt;
/// <c>AuditLogIngestActor.IngestBudget</c> (20 s) &gt;
/// <c>AuditLogIngestActor.IngestSqlCommandTimeout</c> (15 s).
/// </para>
/// <para>
/// Strictness matters: it used to reuse <see cref="NotificationForwardTimeout"/> (30 s), the
/// same value as the rung below it, so a slow-but-succeeding central write could be acked to a
/// caller whose Ask had already expired — the drain loop would treat the batch as unsent and
/// re-ship it. Central dedups on <c>EventId</c>, so the duplicate was harmless but the retry
/// traffic and the "stalled" telemetry signal were not. A timeout here is still transient: the
/// rows stay <c>Pending</c> and drain on the next tick.
/// </para>
/// <para>
/// <see cref="CommunicationOptionsValidator"/> enforces the outermost inequality — this value
/// must be strictly greater than the 30 s gRPC/central Ask rung.
/// </para>
/// </remarks>
public TimeSpan AuditForwardTimeout { get; set; } = TimeSpan.FromSeconds(35);
/// <summary>
/// Preshared key authenticating this node's gRPC control plane — the site↔central
/// boundary. On a site node this is the key its inbound gate