fix(communication): streaming endpoint lookups are generation-fenced and cannot strand their in-flight guards (review 2026-10-21 03/R-2 follow-up)

This commit is contained in:
Joseph Doherty
2026-10-22 08:30:14 -04:00
parent e0ebebac11
commit 82976b7377
4 changed files with 47 additions and 8 deletions
@@ -1070,4 +1070,19 @@ public class SiteAlarmAggregatorActorTests : TestKit
AwaitCondition(() => factory.ClientFor(GrpcNodeA).Subs.Count == 2, TimeSpan.FromSeconds(3));
}
/// <summary>Verifies that an endpoint lookup result from before a newer open does not open a second stream.</summary>
[Fact]
public void StaleEndpointLookupResult_DoesNotOpenASecondStream()
{
var (actor, seed, _, factory) = CreateActor();
AwaitCondition(() => factory.ClientFor(GrpcNodeA).Subs.Count == 1, TimeSpan.FromSeconds(3));
seed.CompleteNext();
// A lookup that started at an older stream generation completes after a stream was opened.
actor.Tell(new SiteStreamEndpointsResolved(new SiteStreamEndpoints(GrpcNodeA, GrpcNodeB), null, Generation: -1));
AssertHoldsFor(TimeSpan.FromMilliseconds(300),
(() => factory.ClientFor(GrpcNodeA).Subs.Count == 1, "a stale lookup must not open another stream"));
}
}