Keep unavailable tabs recoverable and reject stale selections locally

This commit is contained in:
omar committed 2026-11-26 23:50:23 +03:00
1 parent f3f0950313
commit 5162a890c4
9 files changed
+47 -6

No files matched your search

+2
View File
@@ -2,6 +2,8 @@
## Unreleased ## Unreleased
- A tab with a failed core remains selectable for recovery. Selecting a stale tab after restart no longer exits the application or disrupts the other tabs.
- On a confirmed move to another channel, the core revokes already captured audio before publishing the new channel snapshot. Other users' moves do not interrupt capture. - On a confirmed move to another channel, the core revokes already captured audio before publishing the new channel snapshot. Other users' moves do not interrupt capture.
- Hiding offline contacts also hides the grouping switch without resetting its saved value. - Hiding offline contacts also hides the grouping switch without resetting its saved value.
+2
View File
@@ -4,6 +4,8 @@
## Возврат к разработке на ПК, 2026-11-26 ## Возврат к разработке на ПК, 2026-11-26
Windows, preload:onCoreStatus: менеджер публикует Starting перед созданием нового worker при перезапуске. Вкладка показывает состояние неработающего ядра и не предлагает подключение до Ready. Три адресных теста прошли. На уровне менеджера занятие временного слота дало Failed и Disconnected, соседняя вкладка ответила на profile_get, снятие блокировки позволило восстановить Ready. В отдельном тесте окна Slint выбор со старым SessionKey после перезапуска дал target_changed, цикл приложения продолжил работать, соседняя вкладка выбиралась и отвечала. Быстрое промежуточное Starting не измерялось как отдельный отрисованный кадр.
Windows, голосовое ядро: собственное событие ClientChannel с изменившимся каналом отзывает очередь и разрешение отправки ранее захваченных кадров, после чего снимок публикуется без обычной задержки. Три адресных теста teamspeach-core прошли: проверены собственный и чужой перенос, повторное уведомление без смены канала, блокировка отправки со старым разрешением и приём кадра с новым. Физический микрофон и сетевой переход не проверялись. Windows, голосовое ядро: собственное событие ClientChannel с изменившимся каналом отзывает очередь и разрешение отправки ранее захваченных кадров, после чего снимок публикуется без обычной задержки. Три адресных теста teamspeach-core прошли: проверены собственный и чужой перенос, повторное уведомление без смены канала, блокировка отправки со старым разрешением и приём кадра с новым. Физический микрофон и сетевой переход не проверялись.
Windows: contact_sort_uses_saved_mode_after_two_restarts проверил сортировку из настройки Chats. В негруппированном списке локальный псевдоним Alpha (офлайн) был выше Zulu (онлайн) при алфавитном порядке. После отключения настройки и двух перезапусков первым отображался онлайн-контакт Zulu. Присутствие взято из тестового снимка сервера; облачные сервисы не использовались. Вместе с проверкой независимого раскрытия групп прошли два теста. Windows: contact_sort_uses_saved_mode_after_two_restarts проверил сортировку из настройки Chats. В негруппированном списке локальный псевдоним Alpha (офлайн) был выше Zulu (онлайн) при алфавитном порядке. После отключения настройки и двух перезапусков первым отображался онлайн-контакт Zulu. Присутствие взято из тестового снимка сервера; облачные сервисы не использовались. Вместе с проверкой независимого раскрытия групп прошли два теста.
+1
View File
@@ -23,6 +23,7 @@
"bookmarks.empty": "No Bookmarks", "bookmarks.empty": "No Bookmarks",
"window.titlebar": "Window title bar", "window.titlebar": "Window title bar",
"ui.starting.core": "Starting core…", "ui.starting.core": "Starting core…",
"native.core.stopping": "Stopping core…",
"ui.restarting.core": "Restarting core…", "ui.restarting.core": "Restarting core…",
"ui.core.unavailable": "Core unavailable", "ui.core.unavailable": "Core unavailable",
"ui.restart.core": "Restart core", "ui.restart.core": "Restart core",
+1
View File
@@ -2367,4 +2367,5 @@
,"native.privacy.list.current": "Список актуален" ,"native.privacy.list.current": "Список актуален"
,"native.privacy.list.cached": "Используется последняя доступная копия" ,"native.privacy.list.cached": "Используется последняя доступная копия"
,"native.privacy.list.unavailable": "Список не загружен" ,"native.privacy.list.unavailable": "Список не загружен"
,"native.core.stopping": "Остановка ядра…"
} }
+6 -2
View File
@@ -62,7 +62,7 @@ impl From<ErrorObj> for ConnectionError {
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ConnectionState { Disconnected, Connecting, Connected, Disconnecting } pub enum ConnectionState { Disconnected, Connecting, Connected, Disconnecting }
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CoreStatus { Ready, Stopping, Stopped, Failed } pub enum CoreStatus { Starting, Ready, Stopping, Stopped, Failed }
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct AudioState { pub struct AudioState {
pub input_muted: bool, pub input_muted: bool,
@@ -575,12 +575,14 @@ impl Actor {
Operation::Key(id, reply) => { let _ = reply.send(self.index(&id).map(|index| self.entries[index].key())); } Operation::Key(id, reply) => { let _ = reply.send(self.index(&id).map(|index| self.entries[index].key())); }
Operation::Workflow(settings, reply) => { self.workflow = settings; let _ = reply.send(Ok(())); } Operation::Workflow(settings, reply) => { self.workflow = settings; let _ = reply.send(Ok(())); }
Operation::View(key, reply) => { Operation::View(key, reply) => {
let result = self.checked(&key).map(|index| { let result = self.index(&key.connection_id).and_then(|index| {
if self.entries[index].key()!=key { return Err(ConnectionError::TargetChanged); }
let changed = self.viewed.as_ref() != Some(&key.connection_id); let changed = self.viewed.as_ref() != Some(&key.connection_id);
self.viewed = Some(key.connection_id.clone()); self.viewed = Some(key.connection_id.clone());
if changed && self.workflow.auto_enable_microphone && self.entries[index].snapshot.is_connected() { if changed && self.workflow.auto_enable_microphone && self.entries[index].snapshot.is_connected() {
self.revoke(); self.choose_input(Some(key.connection_id.clone())); self.configure_input(index, key, None); self.revoke(); self.choose_input(Some(key.connection_id.clone())); self.configure_input(index, key, None);
} }
Ok(())
}); });
self.publish(); let _ = reply.send(result); self.publish(); let _ = reply.send(result);
} }
@@ -853,6 +855,8 @@ impl Actor {
stopped.result.clone().and_then(|()| { stopped.result.clone().and_then(|()| {
let index = self.index(&stopped.id)?; let index = self.index(&stopped.id)?;
let incarnation = self.entries[index].incarnation.checked_add(1).ok_or(ConnectionError::IdExhausted)?; let incarnation = self.entries[index].incarnation.checked_add(1).ok_or(ConnectionError::IdExhausted)?;
self.entries[index].snapshot.status = CoreStatus::Starting;
self.publish();
let worker = self.spawn_worker(&stopped.id, stopped.slot, incarnation)?; let worker = self.spawn_worker(&stopped.id, stopped.slot, incarnation)?;
self.entries[index].worker = Some(worker); self.entries[index].worker = Some(worker);
self.entries[index].incarnation = incarnation; self.entries[index].incarnation = incarnation;
+3
View File
@@ -283,6 +283,9 @@ async fn failed_worker_restart_reports_failure_and_recovers_after_slot_unlock()
let failed = snapshots.borrow().get(&first.connection_id).unwrap().clone(); let failed = snapshots.borrow().get(&first.connection_id).unwrap().clone();
assert_eq!(failed.status, CoreStatus::Failed); assert_eq!(failed.status, CoreStatus::Failed);
assert_eq!(failed.state, ConnectionState::Disconnected); assert_eq!(failed.state, ConnectionState::Disconnected);
let (reply, viewed) = oneshot::channel();
actor.operation(Operation::View(failed.key.clone(), reply));
viewed.await.unwrap().unwrap();
assert!(actor.entries[actor.checked(&other).unwrap()].worker.as_ref().unwrap().core.request(Command::ProfileGet).await.is_ok()); assert!(actor.entries[actor.checked(&other).unwrap()].worker.as_ref().unwrap().core.request(Command::ProfileGet).await.is_ok());
blocker.shutdown().await.unwrap(); blocker.shutdown().await.unwrap();
+13 -1
View File
@@ -177,7 +177,19 @@ async fn run(config:AppConfig,runtime:Weak<AppRuntime>,mut commands:mpsc::Receiv
ShellAction::Navigate(destination)=>{close_recording_panel(&ctx,&mut state).await;state.snapshot.destination=destination;dirty=true;}, ShellAction::Navigate(destination)=>{close_recording_panel(&ctx,&mut state).await;state.snapshot.destination=destination;dirty=true;},
ShellAction::Back=>{close_recording_panel(&ctx,&mut state).await;state.selected=None;state.detail_target=None;state.snapshot.detail=Detail::default();dirty=true;}, ShellAction::Back=>{close_recording_panel(&ctx,&mut state).await;state.selected=None;state.detail_target=None;state.snapshot.detail=Detail::default();dirty=true;},
ShellAction::LeaveRecordingDetail=>{close_recording_panel(&ctx,&mut state).await;dirty=true;}, ShellAction::LeaveRecordingDetail=>{close_recording_panel(&ctx,&mut state).await;dirty=true;},
ShellAction::Select(target)=>{if let Some(key)=&target.session{ctx.require_key(key,false)?;}state.selected=Some(target.clone());if let Some(key)=&target.session{match target.entity{Entity::Connection=>{close_recording_panel(&ctx,&mut state).await;ctx.connected.connections.view(key).await.map_err(context::connection_error)?;},Entity::Channel{id}=>{ctx.connected.connections.select_channel(key,id).await.map_err(context::connection_error)?;},_=>{}}}dirty=true;}, ShellAction::Select(target)=>{
let result=match (&target.session,&target.entity){
(Some(key),Entity::Connection)=>ctx.connected.connections.view(key).await.map_err(context::connection_error),
(Some(key),Entity::Channel{id})=>ctx.connected.connections.select_channel(key,*id).await.map_err(context::connection_error),
(Some(key),_)=>ctx.require_key(key,false),
(None,_)=>Ok(()),
};
match result {
Ok(())=>{if matches!(target.entity,Entity::Connection){close_recording_panel(&ctx,&mut state).await;}state.selected=Some(target);},
Err(error)=>{state.snapshot.error=error.message.clone();state.snapshot.last_error=Some(error);}
}
dirty=true;
},
ShellAction::Expand(target)=>{match (&target.session,target.entity){ ShellAction::Expand(target)=>{match (&target.session,target.entity){
(Some(key),Entity::Channel{id})=>{let item=(key.connection_id.clone(),id);if !state.expanded.remove(&item){state.expanded.insert(item);}}, (Some(key),Entity::Channel{id})=>{let item=(key.connection_id.clone(),id);if !state.expanded.remove(&item){state.expanded.insert(item);}},
(None,Entity::ContactGroup{online})=>{let pref=if online{"contactsOnlineExpanded"}else{"contactsOfflineExpanded"};let sender=events.clone();jobs.spawn(async move{let result=ctx.mutate(move|p|{let next=p.prefs.get()[pref]!=true;p.prefs.set(serde_json::json!({(pref):next}))?;Ok(())}).await.map(|_|events::WorkflowResult::default());let _=sender.send(ServiceEvent::Workflow(result)).await;});}, (None,Entity::ContactGroup{online})=>{let pref=if online{"contactsOnlineExpanded"}else{"contactsOfflineExpanded"};let sender=events.clone();jobs.spawn(async move{let result=ctx.mutate(move|p|{let next=p.prefs.get()[pref]!=true;p.prefs.set(serde_json::json!({(pref):next}))?;Ok(())}).await.map(|_|events::WorkflowResult::default());let _=sender.send(ServiceEvent::Workflow(result)).await;});},
+12 -2
View File
@@ -61,8 +61,18 @@ impl AppState {
self.snapshot.catalog=c;let connections=ctx.connected.connections.snapshot(); self.snapshot.catalog=c;let connections=ctx.connected.connections.snapshot();
self.snapshot.tabs=connections.connections.iter().map(|connection|{ self.snapshot.tabs=connections.connections.iter().map(|connection|{
let target=tab_target(connection); let target=tab_target(connection);
let mut operations=if connection.is_connected(){vec![Operation::Disconnect,Operation::UseMicrophone,Operation::SetNickname,Operation::SetAway,Operation::ServerChat,Operation::RecordingOpen,Operation::CaptureChoose]}else{vec![Operation::Connect,Operation::RestartCore]};operations.push(Operation::CloseConnection); use crate::app::connections::CoreStatus;
Tab{title:target.name.clone(),selected:connections.viewed_id.as_deref()==Some(&connection.key.connection_id),microphone_owner:connections.input_id.as_deref()==Some(&connection.key.connection_id),connected:connection.is_connected(),unread:ctx.notifications.lock().ok().and_then(|n|n.unread_count(&connection.key).ok()).unwrap_or(0).min(usize::MAX as u64) as usize,actions:actions(&target,&operations,&c),target} use Operation::*;
let (operations,caption):(&[Operation],Option<&str>)=match connection.status {
CoreStatus::Ready if connection.is_connected()=>(&[Disconnect,UseMicrophone,SetNickname,SetAway,ServerChat,RecordingOpen,CaptureChoose,CloseConnection],None),
CoreStatus::Ready=>(&[Connect,RestartCore,CloseConnection],None),
CoreStatus::Starting=>(&[],Some("ui.starting.core")),
CoreStatus::Stopping=>(&[],Some("native.core.stopping")),
CoreStatus::Stopped=>(&[RestartCore,CloseConnection],Some("ui.the.core.stopped")),
CoreStatus::Failed=>(&[RestartCore,CloseConnection],Some("ui.core.unavailable")),
};
let title=caption.map_or_else(||target.name.clone(),|caption|format!("{} · {}",target.name,c.text(caption)));
Tab{title,selected:connections.viewed_id.as_deref()==Some(&connection.key.connection_id),microphone_owner:connections.input_id.as_deref()==Some(&connection.key.connection_id),connected:connection.is_connected(),unread:ctx.notifications.lock().ok().and_then(|n|n.unread_count(&connection.key).ok()).unwrap_or(0).min(usize::MAX as u64) as usize,actions:actions(&target,operations,&c),target}
}).collect(); }).collect();
let viewed=connections.viewed_id.as_deref().and_then(|id|connections.get(id)); let viewed=connections.viewed_id.as_deref().and_then(|id|connections.get(id));
if let Some((connection,server))=viewed.and_then(|connection|connection.server.as_ref().map(|server|(connection,server))) { if let Some((connection,server))=viewed.and_then(|connection|connection.server.as_ref().map(|server|(connection,server))) {
+7 -1
View File
@@ -381,7 +381,13 @@ fn offline_restart_from_tab_menu_reports_completion() {
let row = s.connections.get(&first.connection_id)?; let row = s.connections.get(&first.connection_id)?;
(row.key.session > first.session && row.status == CoreStatus::Ready && !row.is_connected() && bridge.get_status() == "Restarted the core for TeamsPeach.").then(|| row.key.clone()) (row.key.session > first.session && row.status == CoreStatus::Ready && !row.is_connected() && bridge.get_status() == "Restarted the core for TeamsPeach.").then(|| row.key.clone())
}).await?; }).await?;
projection(runtime, ui, &[key, other.clone()], 0).await?; let current=[key,other.clone()];
let tabs=projection(runtime, ui, &current, 0).await?;
use crate::ui::shell::{Entity,ShellAction,Target};
runtime.dispatch_shell(ShellAction::Select(Target{session:Some(first),entity:Entity::Connection,..Target::application()})).map_err(|e|e.message)?;
wait(runtime,"rejected stale tab selection",|s|s.last_error.as_ref().filter(|e|e.code=="target_changed").map(|_|())).await?;
click_tab(ui,tabs[1].0)?;
projection(runtime,ui,&current,1).await?;
manager.request(&other, Command::ProfileGet).await.map_err(|e| e.to_string())?; manager.request(&other, Command::ProfileGet).await.map_err(|e| e.to_string())?;
Ok(()) Ok(())
}).unwrap(); }).unwrap();