fix(sidebar): retain legacy SSH folder rows

This commit is contained in:
Brennan Benson
2026-08-10 20:44:32 -07:00
parent 70132eca4c
commit 1cf1ea2dac
2 changed files with 27 additions and 2 deletions
@@ -6,7 +6,9 @@ import { getExecutionHostLabel } from '../../../../shared/execution-host'
import { projectHostSetupProjectionFromRepos } from '../../../../shared/project-host-setup-projection'
import {
ALL_GROUP_META,
buildProjectGroupSidebarIndex,
buildRows,
findProjectGroupForFolderWorkspace,
getGroupKeyForWorktree,
getGroupKeysForWorktree,
getLineageGroupKey,
@@ -3154,11 +3156,12 @@ describe('project groups', () => {
})
})
it('renders folder workspaces under their owning folder-backed Project Group', () => {
it('renders a legacy SSH folder under its unambiguous local-stamped Project Group', () => {
const group: ProjectGroup = {
id: 'group-root',
name: 'Platform',
parentPath: '/monorepo',
executionHostId: 'local',
parentGroupId: null,
createdFrom: 'folder-scan',
tabOrder: 0,
@@ -3172,6 +3175,8 @@ describe('project groups', () => {
projectGroupId: group.id,
name: 'Refund fix',
folderPath: '/monorepo',
connectionId: 'builder',
executionHostId: 'ssh:builder',
linkedTask: null,
comment: '',
isArchived: false,
@@ -3218,6 +3223,13 @@ describe('project groups', () => {
groupDepth: 1
}
])
const collidingGroup = { ...group, executionHostId: 'runtime:env-1' }
expect(
findProjectGroupForFolderWorkspace(
buildProjectGroupSidebarIndex([group, collidingGroup]),
folderWorkspace
)
).toBeUndefined()
})
it('preserves nested Project Group depth for folder workspace rows', () => {
@@ -205,7 +205,20 @@ export function findProjectGroupForFolderWorkspace(
: workspace.connectionId === null
? LOCAL_EXECUTION_HOST_ID
: undefined)
return findProjectGroupForSidebarOwner(index, workspace.projectGroupId, ownerHostId)
const exact = findProjectGroupForSidebarOwner(index, workspace.projectGroupId, ownerHostId)
if (
exact ||
!workspace.connectionId ||
ownerHostId !== toSshExecutionHostId(workspace.connectionId)
) {
return exact
}
const legacyGroup = index.byUnambiguousId.get(workspace.projectGroupId)
return legacyGroup !== undefined &&
legacyGroup.connectionId === undefined &&
getProjectGroupOwnerHostId(legacyGroup) === LOCAL_EXECUTION_HOST_ID
? legacyGroup
: undefined
}
export function getAmbiguousFolderWorkspaceSidebarIds(