matrix_sdk_ui/room_list_service/mod.rs
1// Copyright 2023 The Matrix.org Foundation C.I.C.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for that specific language governing permissions and
13// limitations under the License.
14
15//! `RoomListService` API.
16//!
17//! The `RoomListService` is a UI API dedicated to present a list of Matrix
18//! rooms to the user. The syncing is handled by [`SlidingSync`]. The idea is to
19//! expose a simple API to handle most of the client app use cases, like:
20//! Showing and updating a list of rooms, filtering a list of rooms, handling
21//! particular updates of a range of rooms (the ones the client app is showing
22//! to the view, i.e. the rooms present in the viewport) etc.
23//!
24//! As such, the `RoomListService` works as an opinionated state machine. The
25//! states are defined by [`State`]. Actions are attached to the each state
26//! transition.
27//!
28//! The API is purposely small. Sliding Sync is versatile. `RoomListService` is
29//! _one_ specific usage of Sliding Sync.
30//!
31//! # Basic principle
32//!
33//! `RoomListService` works with 1 Sliding Sync List:
34//!
35//! * `all_rooms` (referred by the constant [`ALL_ROOMS_LIST_NAME`]) is the only
36//! list. Its goal is to load all the user' rooms. It starts with a
37//! [`SlidingSyncMode::Selective`] sync-mode with a small range (i.e. a small
38//! set of rooms) to load the first rooms quickly, and then updates to a
39//! [`SlidingSyncMode::Growing`] sync-mode to load the remaining rooms “in the
40//! background”: it will sync the existing rooms and will fetch new rooms, by
41//! a certain batch size.
42//!
43//! This behavior has proven to be empirically satisfying to provide a fast and
44//! fluid user experience for a Matrix client.
45//!
46//! [`RoomListService::all_rooms`] provides a way to get a [`RoomList`] for all
47//! the rooms. From that, calling [`RoomList::entries_with_dynamic_adapters`]
48//! provides a way to get a stream of rooms. This stream is sorted, can be
49//! filtered, and the filter can be changed over time.
50//!
51//! [`RoomListService::state`] provides a way to get a stream of the state
52//! machine's state, which can be pretty helpful for the client app.
53
54pub mod filters;
55mod room_list;
56pub mod sorters;
57mod state;
58
59use std::{sync::Arc, time::Duration};
60
61use async_stream::stream;
62use eyeball::Subscriber;
63use futures_util::{Stream, StreamExt, pin_mut};
64use matrix_sdk::{
65 Client, Error as SlidingSyncError, Room, SlidingSync, SlidingSyncList, SlidingSyncMode,
66 event_cache::EventCacheError, sliding_sync::PollTimeout, timeout::timeout,
67};
68pub use room_list::*;
69use ruma::{
70 OwnedRoomId, RoomId, UInt, api::client::sync::sync_events::v5 as http, assign,
71 events::StateEventType,
72};
73pub use state::*;
74use thiserror::Error;
75use tracing::{debug, error, warn};
76
77/// The default `required_state` constant value for sliding sync lists and
78/// sliding sync room subscriptions.
79const DEFAULT_REQUIRED_STATE: &[(StateEventType, &str)] = &[
80 (StateEventType::RoomName, ""),
81 (StateEventType::RoomEncryption, ""),
82 (StateEventType::RoomMember, "$LAZY"),
83 (StateEventType::RoomMember, "$ME"),
84 (StateEventType::RoomTopic, ""),
85 // Temporary workaround for https://github.com/matrix-org/matrix-rust-sdk/issues/5285
86 (StateEventType::RoomAvatar, ""),
87 (StateEventType::RoomCanonicalAlias, ""),
88 (StateEventType::RoomPowerLevels, ""),
89 (StateEventType::CallMember, "*"),
90 (StateEventType::RoomJoinRules, ""),
91 (StateEventType::RoomTombstone, ""),
92 // Those two events are required to properly compute room previews.
93 // `StateEventType::RoomCreate` is also necessary to compute the room
94 // version, and thus handling the tombstoned room correctly.
95 (StateEventType::RoomCreate, ""),
96 (StateEventType::RoomHistoryVisibility, ""),
97 // Required to correctly calculate the room display name.
98 (StateEventType::MemberHints, ""),
99 (StateEventType::SpaceParent, "*"),
100 (StateEventType::SpaceChild, "*"),
101 // Required for live location sharing to work - beacon events reference this state.
102 (StateEventType::BeaconInfo, "*"),
103];
104
105/// The default `required_state` constant value for sliding sync room
106/// subscriptions that must be added to `DEFAULT_REQUIRED_STATE`.
107const DEFAULT_ROOM_SUBSCRIPTION_EXTRA_REQUIRED_STATE: &[(StateEventType, &str)] =
108 &[(StateEventType::RoomPinnedEvents, "")];
109
110/// The default Sliding Sync connection ID for the room list service.
111pub(crate) const DEFAULT_CONNECTION_ID: &str = "room-list";
112
113/// The default timeline limit for the room list service.
114pub(crate) const DEFAULT_LIST_TIMELINE_LIMIT: u32 = 1;
115
116/// The default `timeline_limit` value when used with room subscriptions.
117const DEFAULT_ROOM_SUBSCRIPTION_TIMELINE_LIMIT: u32 = 20;
118
119/// The [`RoomListService`] type. See the module's documentation to learn more.
120#[derive(Debug)]
121pub struct RoomListService {
122 /// Client that has created this [`RoomListService`].
123 client: Client,
124
125 /// The Sliding Sync instance.
126 sliding_sync: Arc<SlidingSync>,
127
128 /// The current state of the `RoomListService`.
129 ///
130 /// `RoomListService` is a simple state-machine.
131 state_machine: StateMachine,
132}
133
134impl RoomListService {
135 /// Create a new `RoomList`.
136 ///
137 /// A [`matrix_sdk::SlidingSync`] client will be created, with a cached list
138 /// already pre-configured.
139 ///
140 /// This won't start an encryption sync, and it's the user's responsibility
141 /// to create one in this case using
142 /// [`EncryptionSyncService`][crate::encryption_sync_service::EncryptionSyncService].
143 pub async fn new(client: Client) -> Result<Self, Error> {
144 Self::new_with(client, true, DEFAULT_CONNECTION_ID, DEFAULT_LIST_TIMELINE_LIMIT, false)
145 .await
146 }
147
148 /// Like [`RoomListService::new`] but with additional configuration options.
149 ///
150 /// - `share_pos`: toggles [`SlidingSyncBuilder::share_pos`] for
151 /// cross-process position sharing.
152 /// - `connection_id`: the Sliding Sync connection ID
153 /// - `timeline_limit`: the timeline limit
154 /// - `profiles_extension`: enables the Profiles extension, required to
155 /// merge the global `m.status` and `m.call` fields into room members and
156 /// profiles
157 ///
158 /// [`SlidingSyncBuilder::share_pos`]: matrix_sdk::sliding_sync::SlidingSyncBuilder::share_pos
159 pub async fn new_with(
160 client: Client,
161 share_pos: bool,
162 connection_id: &str,
163 timeline_limit: u32,
164 profiles_extension: bool,
165 ) -> Result<Self, Error> {
166 let mut builder = client
167 .sliding_sync(connection_id)
168 .map_err(Error::SlidingSync)?
169 .with_account_data_extension(
170 assign!(http::request::AccountData::default(), { enabled: Some(true) }),
171 )
172 .with_receipt_extension(assign!(http::request::Receipts::default(), {
173 enabled: Some(true),
174 rooms: Some(vec![http::request::ExtensionRoomConfig::AllSubscribed])
175 }))
176 .with_typing_extension(assign!(http::request::Typing::default(), {
177 enabled: Some(true),
178 }));
179
180 match client.enabled_thread_subscriptions().await {
181 Ok(true) => {
182 debug!("Client requested thread subscriptions extension");
183
184 builder = builder.with_thread_subscriptions_extension(
185 assign!(http::request::ThreadSubscriptions::default(), {
186 enabled: Some(true),
187 limit: Some(ruma::uint!(10))
188 }),
189 );
190 }
191
192 Ok(false) => {
193 debug!(
194 "Thread subscriptions extension either not requested on the client, or the server doesn't advertise support for it: not enabling."
195 );
196 }
197
198 Err(error) => {
199 warn!(
200 ?error,
201 "Failed to check whether the client requested thread subscriptions extension: not enabling."
202 );
203 }
204 }
205
206 if profiles_extension {
207 debug!("Enabling the profiles extension for the room list sliding sync");
208 builder = builder.with_profiles_extension(assign!(
209 http::request::Profiles::default(),
210 { enabled: Some(true) }
211 ));
212 }
213
214 if share_pos {
215 // The e2ee extensions aren't enabled in this sliding sync instance, and this is
216 // the only one that could be used from a different process. So it's
217 // fine to enable position sharing (i.e. reloading it from disk),
218 // since it's always exclusively owned by the current process.
219 debug!("Enabling `share_pos` for the room list sliding sync");
220 builder = builder.share_pos();
221 }
222
223 let state_machine = StateMachine::new();
224 let observable_state = state_machine.cloned_state();
225
226 let sliding_sync = builder
227 .add_cached_list(
228 SlidingSyncList::builder(ALL_ROOMS_LIST_NAME)
229 .sync_mode(
230 SlidingSyncMode::new_selective()
231 .add_range(ALL_ROOMS_DEFAULT_SELECTIVE_RANGE),
232 )
233 .timeline_limit(timeline_limit)
234 .required_state(
235 DEFAULT_REQUIRED_STATE
236 .iter()
237 .map(|(state_event, value)| (state_event.clone(), (*value).to_owned()))
238 .collect(),
239 )
240 .filters(Some(assign!(http::request::ListFilters::default(), {
241 // As defined in the [SlidingSync MSC](https://github.com/matrix-org/matrix-spec-proposals/blob/9450ced7fb9cf5ea9077d029b3adf36aebfa8709/proposals/3575-sync.md?plain=1#L444)
242 // If unset, both invited and joined rooms are returned. If false, no invited rooms are
243 // returned. If true, only invited rooms are returned.
244 is_invite: None,
245 })))
246 .requires_timeout(move |request_generator| {
247 // We want Sliding Sync to apply the poll + network timeout —i.e. to do the
248 // long-polling— in some particular cases. Let's define them.
249 match observable_state.get() {
250 // These are the states where we want an immediate response from the
251 // server, with no long-polling.
252 State::Init
253 | State::SettingUp
254 | State::Recovering
255 | State::Error { .. }
256 | State::Terminated { .. } => PollTimeout::Some(0),
257
258 // Otherwise we want long-polling if the list is fully-loaded.
259 State::Running => {
260 if request_generator.is_fully_loaded() {
261 // Long-polling.
262 PollTimeout::Default
263 } else {
264 // No long-polling yet.
265 PollTimeout::Some(0)
266 }
267 }
268 }
269 }),
270 )
271 .await
272 .map_err(Error::SlidingSync)?
273 .build()
274 .await
275 .map(Arc::new)
276 .map_err(Error::SlidingSync)?;
277
278 // Eagerly subscribe the event cache to sync responses.
279 client.event_cache().subscribe()?;
280
281 Ok(Self { client, sliding_sync, state_machine })
282 }
283
284 /// Start to sync the room list.
285 ///
286 /// It's the main method of this entire API. Calling `sync` allows to
287 /// receive updates on the room list: new rooms, rooms updates etc. Those
288 /// updates can be read with `RoomList::entries` for example. This method
289 /// returns a [`Stream`] where produced items only hold an empty value
290 /// in case of a sync success, otherwise an error.
291 ///
292 /// The `RoomListService`' state machine is run by this method.
293 ///
294 /// Stopping the [`Stream`] (i.e. by calling [`Self::stop_sync`]), and
295 /// calling [`Self::sync`] again will resume from the previous state of
296 /// the state machine.
297 ///
298 /// This should be used only for testing. In practice, most users should be
299 /// using the [`SyncService`](crate::sync_service::SyncService) instead.
300 #[doc(hidden)]
301 pub fn sync(&self) -> impl Stream<Item = Result<(), Error>> + '_ {
302 stream! {
303 let sync = self.sliding_sync.sync();
304 pin_mut!(sync);
305
306 // This is a state machine implementation.
307 // Things happen in this order:
308 //
309 // 1. The next state is calculated,
310 // 2. The actions associated to the next state are run,
311 // 3. A sync is done,
312 // 4. The next state is stored.
313 loop {
314 debug!("Run a sync iteration");
315
316 // Calculate the next state, and run the associated actions.
317 let next_state = self.state_machine.next(&self.sliding_sync).await?;
318
319 // Do the sync.
320 match sync.next().await {
321 // Got a successful result while syncing.
322 Some(Ok(_update_summary)) => {
323 debug!(state = ?next_state, "New state");
324
325 // Update the state.
326 self.state_machine.set(next_state);
327
328 yield Ok(());
329 }
330
331 // Got an error while syncing.
332 Some(Err(error)) => {
333 debug!(expected_state = ?next_state, "New state is an error");
334
335 let next_state = State::Error { from: Box::new(next_state) };
336 self.state_machine.set(next_state);
337
338 yield Err(Error::SlidingSync(error));
339
340 break;
341 }
342
343 // Sync loop has terminated.
344 None => {
345 debug!(expected_state = ?next_state, "New state is a termination");
346
347 let next_state = State::Terminated { from: Box::new(next_state) };
348 self.state_machine.set(next_state);
349
350 break;
351 }
352 }
353 }
354 }
355 }
356
357 /// Force to stop the sync of the `RoomListService` started by
358 /// [`Self::sync`].
359 ///
360 /// It's of utter importance to call this method rather than stop polling
361 /// the `Stream` returned by [`Self::sync`] because it will force the
362 /// cancellation and exit the sync loop, i.e. it will cancel any
363 /// in-flight HTTP requests, cancel any pending futures etc. and put the
364 /// service into a termination state.
365 ///
366 /// Ideally, one wants to consume the `Stream` returned by [`Self::sync`]
367 /// until it returns `None`, because of [`Self::stop_sync`], so that it
368 /// ensures the states are correctly placed.
369 ///
370 /// Stopping the sync of the room list via this method will put the
371 /// state-machine into the [`State::Terminated`] state.
372 ///
373 /// This should be used only for testing. In practice, most users should be
374 /// using the [`SyncService`](crate::sync_service::SyncService) instead.
375 #[doc(hidden)]
376 pub fn stop_sync(&self) -> Result<(), Error> {
377 self.sliding_sync.stop_sync().map_err(Error::SlidingSync)
378 }
379
380 /// Force the sliding sync session to expire.
381 ///
382 /// This is used by [`SyncService`](crate::sync_service::SyncService).
383 ///
384 /// **Warning**: This method **must not** be called while the sync loop is
385 /// running!
386 pub(crate) async fn expire_sync_session(&self) {
387 self.sliding_sync.expire_session().await;
388
389 // Usually, when the session expires, it leads the state to be `Error`,
390 // thus some actions (like refreshing the lists) are executed. However,
391 // if the sync loop has been stopped manually, the state is `Terminated`, and
392 // when the session is forced to expire, the state remains `Terminated`, thus
393 // the actions aren't executed as expected. Consequently, let's update the
394 // state.
395 if let State::Terminated { from } = self.state_machine.get() {
396 self.state_machine.set(State::Error { from });
397 }
398 }
399
400 /// Get a [`Stream`] of [`SyncIndicator`].
401 ///
402 /// Read the documentation of [`SyncIndicator`] to learn more about it.
403 pub fn sync_indicator(
404 &self,
405 delay_before_showing: Duration,
406 delay_before_hiding: Duration,
407 ) -> impl Stream<Item = SyncIndicator> + use<> {
408 let mut state = self.state();
409
410 stream! {
411 // Ensure the `SyncIndicator` is always hidden to start with.
412 yield SyncIndicator::Hide;
413
414 // Let's not wait for an update to happen. The `SyncIndicator` must be
415 // computed as fast as possible.
416 let mut current_state = state.next_now();
417
418 loop {
419 let (sync_indicator, yield_delay) = match current_state {
420 State::SettingUp | State::Error { .. } => {
421 (SyncIndicator::Show, delay_before_showing)
422 }
423
424 State::Init | State::Recovering | State::Running | State::Terminated { .. } => {
425 (SyncIndicator::Hide, delay_before_hiding)
426 }
427 };
428
429 // `state.next().await` has a maximum of `yield_delay` time to execute…
430 let next_state = match timeout(state.next(), yield_delay).await {
431 // A new state has been received before `yield_delay` time. The new
432 // `sync_indicator` value won't be yielded.
433 Ok(next_state) => next_state,
434
435 // No new state has been received before `yield_delay` time. The
436 // `sync_indicator` value can be yielded.
437 Err(_) => {
438 yield sync_indicator;
439
440 // Now that `sync_indicator` has been yielded, let's wait on
441 // the next state again.
442 state.next().await
443 }
444 };
445
446 if let Some(next_state) = next_state {
447 // Update the `current_state`.
448 current_state = next_state;
449 } else {
450 // Something is broken with the state. Let's stop this stream too.
451 break;
452 }
453 }
454 }
455 }
456
457 /// Get the [`Client`] that has been used to create [`Self`].
458 pub fn client(&self) -> &Client {
459 &self.client
460 }
461
462 /// Get a subscriber to the state.
463 pub fn state(&self) -> Subscriber<State> {
464 self.state_machine.subscribe()
465 }
466
467 async fn list_for(&self, sliding_sync_list_name: &str) -> Result<RoomList, Error> {
468 RoomList::new(&self.client, &self.sliding_sync, sliding_sync_list_name, self.state()).await
469 }
470
471 /// Get a [`RoomList`] for all rooms.
472 pub async fn all_rooms(&self) -> Result<RoomList, Error> {
473 self.list_for(ALL_ROOMS_LIST_NAME).await
474 }
475
476 /// Get a [`Room`] if it exists.
477 pub fn room(&self, room_id: &RoomId) -> Result<Room, Error> {
478 self.client.get_room(room_id).ok_or_else(|| Error::RoomNotFound(room_id.to_owned()))
479 }
480
481 /// Subscribe to rooms.
482 ///
483 /// It means that all events from these rooms will be received every time,
484 /// no matter how the `RoomList` is configured.
485 ///
486 /// [`LatestEvents::listen_to_room`][listen_to_room] will be called for each
487 /// room in `room_ids`, so that the [`LatestEventValue`] will automatically
488 /// be calculated and updated for these rooms, for free.
489 ///
490 /// Previous room subscriptions that are not contained in the specified room
491 /// IDs will be forgotten.
492 ///
493 /// [listen_to_room]: matrix_sdk::latest_events::LatestEvents::listen_to_room
494 /// [`LatestEventValue`]: matrix_sdk::latest_events::LatestEventValue
495 pub async fn subscribe_to_rooms(&self, room_ids: &[&RoomId]) {
496 // Calculate the settings for the room subscriptions.
497 let settings = assign!(http::request::RoomSubscription::default(), {
498 required_state: DEFAULT_REQUIRED_STATE.iter().map(|(state_event, value)| {
499 (state_event.clone(), (*value).to_owned())
500 })
501 .chain(
502 DEFAULT_ROOM_SUBSCRIPTION_EXTRA_REQUIRED_STATE.iter().map(|(state_event, value)| {
503 (state_event.clone(), (*value).to_owned())
504 })
505 )
506 .collect(),
507 timeline_limit: UInt::from(DEFAULT_ROOM_SUBSCRIPTION_TIMELINE_LIMIT),
508 });
509
510 // Decide whether the in-flight request (if any) should be cancelled if needed.
511 let cancel_in_flight_request = match self.state_machine.get() {
512 State::Init | State::Recovering | State::Error { .. } | State::Terminated { .. } => {
513 false
514 }
515 State::SettingUp | State::Running => true,
516 };
517
518 // Before subscribing, let's listen these rooms to calculate their latest
519 // events.
520 if self.client.event_cache().has_subscribed() {
521 let latest_events = self.client.latest_events().await;
522
523 for room_id in room_ids {
524 if let Err(error) = latest_events.listen_to_room(room_id).await {
525 // Let's not fail the room subscription. Instead, emit a log because it's very
526 // unlikely to happen.
527 error!(?error, ?room_id, "Failed to listen to the latest event for this room");
528 }
529 }
530 }
531
532 // Subscribe to the rooms.
533 self.sliding_sync.resubscribe_to_rooms(room_ids, Some(settings), cancel_in_flight_request)
534 }
535
536 #[cfg(test)]
537 pub fn sliding_sync(&self) -> &SlidingSync {
538 &self.sliding_sync
539 }
540}
541
542/// [`RoomList`]'s errors.
543#[derive(Debug, Error)]
544pub enum Error {
545 /// Error from [`matrix_sdk::SlidingSync`].
546 #[error(transparent)]
547 SlidingSync(SlidingSyncError),
548
549 /// An operation has been requested on an unknown list.
550 #[error("Unknown list `{0}`")]
551 UnknownList(String),
552
553 /// The requested room doesn't exist.
554 #[error("Room `{0}` not found")]
555 RoomNotFound(OwnedRoomId),
556
557 #[error(transparent)]
558 EventCache(#[from] EventCacheError),
559}
560
561/// An hint whether a _sync spinner/loader/toaster_ should be prompted to the
562/// user, indicating that the [`RoomListService`] is syncing.
563///
564/// This is entirely arbitrary and optinionated. Of course, once
565/// [`RoomListService::sync`] has been called, it's going to be constantly
566/// syncing, until [`RoomListService::stop_sync`] is called, or until an error
567/// happened. But in some cases, it's better for the user experience to prompt
568/// to the user that a sync is happening. It's usually the first sync, or the
569/// recovering sync. However, the sync indicator must be prompted if the
570/// aforementioned sync is “slow”, otherwise the indicator is likely to “blink”
571/// pretty fast, which can be very confusing. It's also common to indicate to
572/// the user that a syncing is happening in case of a network error, that
573/// something is catching up etc.
574#[derive(Debug, Eq, PartialEq)]
575pub enum SyncIndicator {
576 /// Show the sync indicator.
577 Show,
578
579 /// Hide the sync indicator.
580 Hide,
581}
582
583#[cfg(test)]
584mod tests {
585 use std::future::ready;
586
587 use futures_util::{StreamExt, pin_mut};
588 use matrix_sdk::{SlidingSyncMode, test_utils::mocks::MatrixMockServer};
589 use matrix_sdk_test::{TestError, async_test};
590 use ruma::{api::client::sync::sync_events::v5, assign, uint};
591
592 use super::{ALL_ROOMS_LIST_NAME, Error, RoomListService, State};
593
594 #[async_test]
595 async fn test_all_rooms_are_declared() -> Result<(), TestError> {
596 let server = MatrixMockServer::new().await;
597 let client = server.client_builder().build().await;
598 let room_list = RoomListService::new(client).await?;
599
600 let sliding_sync = room_list.sliding_sync();
601
602 // List is present, in Selective mode.
603 assert_eq!(
604 sliding_sync
605 .on_list(ALL_ROOMS_LIST_NAME, |list| ready(matches!(
606 list.sync_mode(),
607 SlidingSyncMode::Selective { ranges } if ranges == vec![0..=19]
608 )))
609 .await,
610 Some(true)
611 );
612
613 Ok(())
614 }
615
616 #[async_test]
617 async fn test_expire_sliding_sync_session_manually() -> Result<(), Error> {
618 let server = MatrixMockServer::new().await;
619 let client = server.client_builder().build().await;
620
621 let room_list = RoomListService::new(client).await?;
622
623 let sync = room_list.sync();
624 pin_mut!(sync);
625
626 // Run a first sync.
627 {
628 let _mock_guard = server
629 .mock_sliding_sync()
630 .ok({
631 let mut response = v5::Response::new("0".to_owned());
632 response.lists.insert(
633 ALL_ROOMS_LIST_NAME.to_owned(),
634 assign!(v5::response::List::default(), { count: uint!(0) }),
635 );
636 response
637 })
638 .mount_as_scoped()
639 .await;
640
641 let _ = sync.next().await;
642 }
643
644 assert_eq!(room_list.state().get(), State::SettingUp);
645
646 // Stop the sync.
647 room_list.stop_sync()?;
648
649 // Do another sync.
650 let _ = sync.next().await;
651
652 // State is `Terminated`, as expected!
653 assert_eq!(
654 room_list.state_machine.get(),
655 State::Terminated { from: Box::new(State::Running) }
656 );
657
658 // Now, let's make the sliding sync session to expire.
659 room_list.expire_sync_session().await;
660
661 // State is `Error`, as a regular session expiration would generate!
662 assert_eq!(room_list.state_machine.get(), State::Error { from: Box::new(State::Running) });
663
664 Ok(())
665 }
666}