From 2fcc829f25ba530c04e45187bbaf6e10b353457e Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 10 Aug 2026 20:49:26 -0700 Subject: [PATCH] test(sidebar): keep owner regression within gate --- .../sidebar/project-group-header-dom.test.ts | 66 +++++++++++++++++++ .../sidebar/worktree-list-groups.test.ts | 14 +--- 2 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/renderer/src/components/sidebar/project-group-header-dom.test.ts b/src/renderer/src/components/sidebar/project-group-header-dom.test.ts index 74b6e72a57d..d3d9e6ca88d 100644 --- a/src/renderer/src/components/sidebar/project-group-header-dom.test.ts +++ b/src/renderer/src/components/sidebar/project-group-header-dom.test.ts @@ -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 = { diff --git a/src/renderer/src/components/sidebar/worktree-list-groups.test.ts b/src/renderer/src/components/sidebar/worktree-list-groups.test.ts index 21dd8e2e482..c5a7f9606b2 100644 --- a/src/renderer/src/components/sidebar/worktree-list-groups.test.ts +++ b/src/renderer/src/components/sidebar/worktree-list-groups.test.ts @@ -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', () => {