From bc1714b6f0f29df377ae59181b8fdac8d13ed153 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 10 Aug 2026 14:00:28 -0700 Subject: [PATCH] fix(sidebar): reconcile folder updates by owner --- ...-same-id-folder-workspace-identity.test.ts | 34 +++++++++++++++++++ src/renderer/src/store/slices/repos.ts | 4 ++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/store/slices/repos-same-id-folder-workspace-identity.test.ts b/src/renderer/src/store/slices/repos-same-id-folder-workspace-identity.test.ts index 42481cd3cc3..15b8b164734 100644 --- a/src/renderer/src/store/slices/repos-same-id-folder-workspace-identity.test.ts +++ b/src/renderer/src/store/slices/repos-same-id-folder-workspace-identity.test.ts @@ -238,4 +238,38 @@ describe('same-id cross-host folder workspace identity', () => { updates: { name: 'Updated' } }) }) + + it('reconciles a failed same-id update from the selected owner row', async () => { + const local = makeFolder({ name: 'Local current', executionHostId: 'local' }) + const ssh = makeFolder({ + name: 'SSH current', + folderPath: '/remote/folder', + connectionId: 'builder' + }) + const list = vi.fn().mockResolvedValue([ + { ...local, name: 'Local persisted' }, + { ...ssh, name: 'SSH persisted' } + ]) + const update = vi.fn().mockResolvedValue(null) + const store = createTestStore() + store.setState({ + projectGroups: [ + makeGroup({ executionHostId: 'local' }), + makeGroup({ connectionId: 'builder', parentPath: '/remote' }) + ], + folderWorkspaces: [local, ssh] + }) + vi.stubGlobal('window', { api: { folderWorkspaces: { list, update } } }) + + await expect( + store + .getState() + .updateFolderWorkspace('same-id', { name: 'Rejected' }, { executionHostId: 'ssh:builder' }) + ).resolves.toBe(false) + + expect(store.getState().folderWorkspaces.map((workspace) => workspace.name)).toEqual([ + 'Local current', + 'SSH persisted' + ]) + }) }) diff --git a/src/renderer/src/store/slices/repos.ts b/src/renderer/src/store/slices/repos.ts index 989b99744a7..2bdefea9989 100644 --- a/src/renderer/src/store/slices/repos.ts +++ b/src/renderer/src/store/slices/repos.ts @@ -1347,7 +1347,9 @@ async function reconcileFailedFolderWorkspaceUpdate(args: { return } const refreshed = catalog.folderWorkspaces.find( - (workspace) => workspace.id === args.folderWorkspaceId + (workspace) => + workspace.id === args.folderWorkspaceId && + getFolderWorkspaceHostId(workspace, args.get().projectGroups) === args.ownerHostId ) args.set((state) => ({ folderWorkspaces: refreshed