From 6b2b7929260c31f2448cef247ddb312106155eb2 Mon Sep 17 00:00:00 2001 From: faumaray Date: Fri, 23 Oct 2026 22:26:28 +0300 Subject: [PATCH] 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 --- crates/voelin-core/tests/link_fake.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/voelin-core/tests/link_fake.rs b/crates/voelin-core/tests/link_fake.rs index ed9b394..a63c48e 100644 --- a/crates/voelin-core/tests/link_fake.rs +++ b/crates/voelin-core/tests/link_fake.rs @@ -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)),