test(grpc-data): R2_S2 hold test keeps its stale-before-release ordering under a loaded run (MaxHold 600 ms -> 5 s)

Intermittent failure in a full Runtime.Tests run. Test timing, not a production defect: the held runner's stale mark is
armed only after its loop has unwound (no late Good can follow it) and fires 100 ms later, while MaxHold runs from the
hold itself. Measured with the thread pool saturated: stale mark ~1.9 s after the hold, MaxHold release at ~0.9 s, so
the release ended the hold first (stale skipped / removal seen by the 'not removed before MaxHold' check). Production
MaxHold is 5 min. With 5 s the ordering holds under that load (stale ~1.9 s, release ~5 s).
This commit is contained in:
Joseph Doherty
2026-12-03 15:47:41 -05:00
parent a6e5ae8aa2
commit 62e39d5de5
@@ -1033,7 +1033,13 @@ public sealed class GrpcDataProjectedConditionAccessTests
[Fact]
public async Task R2_S2_a_hold_that_never_settles_goes_stale_then_is_released_past_MaxHold()
{
await using var f = new Fixture(Fixture.DefaultOptions with { MaxHold = TimeSpan.FromMilliseconds(600) }, ("map-a", DataRealm.Raw, 10));
// #1057 (flake, test timing — not a production defect): the stale mark is armed only once the held runner's loop has
// unwound (so no late Good from that loop can follow it), then fires 100 ms later; MaxHold runs from the hold itself.
// With MaxHold = 600 ms the test relied on the loop unwinding within ~500 ms. Measured with the thread pool saturated
// (as in a full parallel Runtime.Tests run): the stale mark landed ~1.9 s after the hold while the release fired at
// ~0.9 s — the release ends the hold first, so the stale mark is skipped (or the test's later check sees the removal).
// Production keeps minutes of margin (MaxHold 5 min). 5 s keeps the ordering under that load (~3 s of margin).
await using var f = new Fixture(Fixture.DefaultOptions with { MaxHold = TimeSpan.FromSeconds(5) }, ("map-a", DataRealm.Raw, 10));
using var demand = f.Access.AcquireEventDemand(null);
await CompleteFirstAsync(f, ("map-a", [Record(Key("x"), 3)]));
await f.WaitAsync(() => f.Sink.Live.Count == 1);