From 5df011f08cdf051491511517cd80d1c084f5b9d4 Mon Sep 17 00:00:00 2001 From: faumaray Date: Fri, 23 Oct 2026 22:45:38 +0300 Subject: [PATCH] Count only the refusals that come after the host's update in the features test The last wait of the test asked for file lists until one was refused locally and took the first refusal on the bus. The asks made before the HostUpdate reached SessionLink are refused too while the server's list stands, and their events can still be unread on the bus, so the wait could end before the update had been applied. It accepts a refusal of a request made after the update only. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-core/src/link/tests.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/voelin-core/src/link/tests.rs b/crates/voelin-core/src/link/tests.rs index e7f5526..9d37375 100644 --- a/crates/voelin-core/src/link/tests.rs +++ b/crates/voelin-core/src/link/tests.rs @@ -2236,16 +2236,21 @@ async fn the_features_of_a_server_are_the_hosts_narrowed_by_the_servers_list() { }) .await; - // The host narrows what it offers this user. + // The host narrows what it offers this user. A refusal counts only for a + // request made after the update: the earlier ones were answered by the host's + // wider set (or, before the server lifted its list, refused for that). let update = v1::HostUpdate { features: vec!["voice".into(), "chat".into()], limits: None }; handle.push(v1::Push { body: Some(v1::push::Body::HostUpdate(update)) }).unwrap(); + let after = request; within("the narrower set to apply", async { loop { request += 1; ask(request); tokio::time::sleep(Duration::from_millis(20)).await; while let Ok(event) = bus.try_recv() { - if refused(&event) { + if matches!(&event, Event::FileList { request, .. } if *request > after) + && refused(&event) + { return Some(()); } }