Do not let the fake-link presence test depend on the order of media and pushes

presence_follows_the_link_until_it_disconnects played a voice packet, a poke
and an error in one go and waited for Talking, the poke and the error in that
order. Talking comes from the media queue and the poke and the error from the
push channel, and the loop of SessionLink cannot order two channels: when the
push was polled first the engine reported Poke, Error, Talking, the wait for
Talking skipped the first two and the next wait timed out. It failed in 22 of
300 isolated runs (the baseline never did).

The test now plays the voice packet, waits for Talking, and only then plays the
poke and the error. The design records the change (it is a change of the order
of the steps, not of an assertion).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-23 22:26:28 +03:00
1 parent b5ea0c3e95
commit 6b2b792926
1 file changed
+6 -3
+6 -3
View File
@@ -272,9 +272,13 @@ async fn presence_follows_the_link_until_it_disconnects() {
assert_eq!(state.server_uid.as_deref(), Some(SERVER_UID));
assert_eq!(state.presence_source, Some(Source::Voice));
// Alice talks: a packet of her voice (the session derives who talks). The
// voice comes from the media path and a poke or an error from the push
// path, and the session orders the two paths in no way, so the test waits
// for the talking before it plays the others.
conn.play([voice_of(8)]);
h.next(|e| matches!(e, Event::Talking { client: 8, talking: true, .. }).then_some(())).await;
conn.play([
// Alice talks: a packet of her voice (the session derives who talks).
voice_of(8),
LinkEvent::Poke {
from: 8,
from_uid: Some("alice=".into()),
@@ -283,7 +287,6 @@ async fn presence_follows_the_link_until_it_disconnects() {
},
LinkEvent::Error("move refused".into()),
]);
h.next(|e| matches!(e, Event::Talking { client: 8, talking: true, .. }).then_some(())).await;
let poke = h
.next(|e| match e {
Event::Poke { from_name, message, blocked, .. } => Some((from_name, message, blocked)),