From b380a03e19e345fa7f78e710f330de50b329c658 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Thu, 9 Apr 2026 17:39:21 -0700 Subject: [PATCH] Fix CI test failures Remove the has_unbacked_linked_worktree filter that was too aggressively hiding threads whose folder_paths included linked worktree paths not yet discovered by git state. Since threads are already correctly grouped via their main_worktree_paths column, this filter was unnecessary and caused threads belonging to open workspace roots and closed worktree workspaces to be hidden. Update test_git_worktree_added_live_updates_sidebar to expect the thread visible from the start (the chip name is derived from the path heuristic even before git discovery). Fix test_worktree_add_key_collision_removes_duplicate_workspace to switch back to workspace A before the collision, since the collision code keeps the active workspace and drops the incoming duplicate. --- crates/sidebar/src/sidebar.rs | 15 --------------- crates/sidebar/src/sidebar_tests.rs | 13 +++++++++++-- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index 8624e8683201a242be6521a67c8992bf9c1206a8..55629db7e35a6219963d50eefd7aa3b599fa710e 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -1024,18 +1024,6 @@ impl Sidebar { } }; - let main_path_list = group_key.path_list(); - - // Skip threads whose folder_paths include a linked worktree - // that hasn't been discovered by any workspace's git state. - let has_unbacked_linked_worktree = |row: &ThreadMetadata| -> bool { - let main_paths = main_path_list.paths(); - row.folder_paths.paths().iter().any(|path| { - let is_main = main_paths.iter().any(|mp| mp.as_path() == path.as_path()); - !is_main && !linked_to_main.contains_key(&**path) - }) - }; - // Main code path: one query per group via main_worktree_paths. // The main_worktree_paths column is set on all new threads and // points to the group's canonical paths regardless of which @@ -1048,9 +1036,6 @@ impl Sidebar { if !seen_session_ids.insert(row.session_id.clone()) { continue; } - if has_unbacked_linked_worktree(&row) { - continue; - } let workspace = resolve_workspace(&row); threads.push(make_thread_entry(row, workspace)); } diff --git a/crates/sidebar/src/sidebar_tests.rs b/crates/sidebar/src/sidebar_tests.rs index 7f375de9fc6fbdb84ff50b3f9125df4f09ceb838..420eae134e11309e4d1cc90c45335f7fce76bb22 100644 --- a/crates/sidebar/src/sidebar_tests.rs +++ b/crates/sidebar/src/sidebar_tests.rs @@ -2808,6 +2808,14 @@ async fn test_worktree_add_key_collision_removes_duplicate_workspace(cx: &mut Te }); cx.run_until_parked(); + // Switch back to workspace A so it's the active workspace when the collision happens. + let workspace_a = + multi_workspace.read_with(cx, |mw, _| mw.workspaces().next().unwrap().clone()); + multi_workspace.update_in(cx, |mw, window, cx| { + mw.activate(workspace_a, window, cx); + }); + cx.run_until_parked(); + // Save a thread against workspace B [/project-a, /project-b]. save_named_thread_metadata("thread-b", "Thread B", &project_b, cx).await; @@ -3594,13 +3602,14 @@ async fn test_git_worktree_added_live_updates_sidebar(cx: &mut TestAppContext) { multi_workspace.update_in(cx, |_, _window, cx| cx.notify()); cx.run_until_parked(); - // Thread is not visible yet — the linked worktree hasn't been - // discovered by any workspace's git state. + // Thread is visible because its main_worktree_paths match the group. + // The chip name is derived from the path even before git discovery. assert_eq!( visible_entries_as_strings(&sidebar, cx), vec![ // "v [project]", + " Worktree Thread {rosewood}", ] );