fix(nestsClient): wait for mute replay in setMuted_intent_replays test

ScriptedSpeaker publishes startCount > 0 from inside startBroadcasting,
so polling startCount alone races the wrapper pump's subsequent
`if (desiredMuted) handle.setMuted(true)` step. Under load (full suite
run on CI) the assertion fired before the pump replayed mute intent,
producing setMutedCalls=0. Wait for the post-condition the assertion
checks instead.
This commit is contained in:
Claude
2026-05-01 20:26:18 +00:00
parent 7be405847f
commit 7c1af48ae7
@@ -346,9 +346,16 @@ class ReconnectingNestsSpeakerTest {
}
assertTrue(first.handles[0].isMuted, "first handle should be muted by user toggle")
// Wait for refresh to swap to the second session.
// Wait for refresh to swap to the second session AND
// for the pump to replay mute intent on the new handle.
// `startCount > 0` is published from inside
// ScriptedSpeaker.startBroadcasting BEFORE the pump
// gets to run `if (desiredMuted) handle.setMuted(true)`,
// so polling startCount alone races the replay step
// under load (observed flake on CI). Wait for the
// post-condition the assertion is about instead.
withTimeout(5_000L) {
while (second.startCount == 0) delay(5)
while (second.handles.isEmpty() || !second.handles[0].isMuted) delay(5)
}
// Critical postcondition: the new underlying handle