test(sidebar): keep owner regression within gate

This commit is contained in:
Brennan Benson
2026-08-10 20:49:26 -07:00
parent 1cf1ea2dac
commit 2fcc829f25
2 changed files with 67 additions and 13 deletions
@@ -12,6 +12,7 @@ import type { FolderWorkspace, ProjectGroup, Repo, Worktree } from '../../../../
import {
buildRows,
buildProjectGroupSidebarIndex,
findProjectGroupForFolderWorkspace,
findProjectGroupForRepo,
findProjectGroupForSidebarOwner,
getAmbiguousFolderWorkspaceSidebarIds,
@@ -166,6 +167,71 @@ describe('project-group sidebar identity', () => {
expect(getProjectGroupSidebarIdentity(local)).not.toBe(getProjectGroupSidebarIdentity(runtime))
})
it('renders a legacy SSH folder under its unambiguous local-stamped Project Group', () => {
const group: ProjectGroup = {
...sidebarIdentityGroup('group-root', 'local'),
name: 'Platform',
parentPath: '/monorepo',
createdFrom: 'folder-scan'
}
const folderWorkspace: FolderWorkspace = {
id: 'folder-workspace-1',
projectGroupId: group.id,
name: 'Refund fix',
folderPath: '/monorepo',
connectionId: 'builder',
executionHostId: 'ssh:builder',
linkedTask: null,
comment: '',
isArchived: false,
isUnread: false,
isPinned: false,
sortOrder: 10,
lastActivityAt: 0,
createdAt: 1,
updatedAt: 1
}
const rows = buildRows(
'repo',
[],
new Map(),
null,
new Set(),
undefined,
undefined,
undefined,
undefined,
undefined,
false,
undefined,
[group],
new Set(),
new Map(),
new Map(),
[],
undefined,
[folderWorkspace]
)
expect(rows).toMatchObject([
{ type: 'header', key: 'project-group:group-root', count: 1 },
{
type: 'folder-workspace',
folderWorkspace: { id: 'folder-workspace-1' },
projectGroup: { id: 'group-root' },
groupDepth: 1
}
])
const collidingGroup = { ...group, executionHostId: 'runtime:env-1' }
expect(
findProjectGroupForFolderWorkspace(
buildProjectGroupSidebarIndex([group, collidingGroup]),
folderWorkspace
)
).toBeUndefined()
})
it('keeps folder-backed card geometry scoped to the repo owner', () => {
const local = { ...sidebarIdentityGroup('same-id', 'local'), createdFrom: 'manual' as const }
const runtime = {
@@ -6,9 +6,7 @@ import { getExecutionHostLabel } from '../../../../shared/execution-host'
import { projectHostSetupProjectionFromRepos } from '../../../../shared/project-host-setup-projection'
import {
ALL_GROUP_META,
buildProjectGroupSidebarIndex,
buildRows,
findProjectGroupForFolderWorkspace,
getGroupKeyForWorktree,
getGroupKeysForWorktree,
getLineageGroupKey,
@@ -3156,12 +3154,11 @@ describe('project groups', () => {
})
})
it('renders a legacy SSH folder under its unambiguous local-stamped Project Group', () => {
it('renders folder workspaces under their owning folder-backed Project Group', () => {
const group: ProjectGroup = {
id: 'group-root',
name: 'Platform',
parentPath: '/monorepo',
executionHostId: 'local',
parentGroupId: null,
createdFrom: 'folder-scan',
tabOrder: 0,
@@ -3175,8 +3172,6 @@ describe('project groups', () => {
projectGroupId: group.id,
name: 'Refund fix',
folderPath: '/monorepo',
connectionId: 'builder',
executionHostId: 'ssh:builder',
linkedTask: null,
comment: '',
isArchived: false,
@@ -3223,13 +3218,6 @@ 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', () => {