From 6a11d3033ad329a730848698d9fa8ddd2cb5563e Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 10 Nov 2026 15:23:14 +0000 Subject: [PATCH] fix: explain why a fork folder deploy can leave a lasting conflict (#12323) --- .../lib/components/CompareWorkspaces.svelte | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/frontend/src/lib/components/CompareWorkspaces.svelte b/frontend/src/lib/components/CompareWorkspaces.svelte index 4ce7fb1504..65f338c76c 100644 --- a/frontend/src/lib/components/CompareWorkspaces.svelte +++ b/frontend/src/lib/components/CompareWorkspaces.svelte @@ -854,12 +854,41 @@ if (result.success) { deploymentStatus[statusKey] = { status: 'deployed' } + if (kind === 'folder' && !removes) { + warnOnAddedFolderOwners(path, workspaceFrom, workspaceToDeployTo) + } } else { deploymentStatus[statusKey] = { status: 'failed', error: result.error } sendUserToast(`Failed to deploy ${statusKey}: ${result.error}`, 'error') } } + // A non-admin can't drop their own ownership of a folder (the folder UPDATE policy + // rejects a row they don't own), so updateFolder keeps them as an owner. The folder then + // never matches its source, and the conflict comes back on every compare unless we say why. + async function warnOnAddedFolderOwners(path: string, workspaceFrom: string, workspaceTo: string) { + const name = path.replace(/^f\//, '') + try { + const [source, target, me] = await Promise.all([ + FolderService.getFolder({ workspace: workspaceFrom, name }), + FolderService.getFolder({ workspace: workspaceTo, name }), + UserService.whoami({ workspace: workspaceTo }) + ]) + const owner = `u/${me.username}` + if (!me.is_admin && target.owners.includes(owner) && !source.owners.includes(owner)) { + sendUserToast( + `${path} still differs in ${workspaceTo}: it kept ${owner} as owner, because a non-admin can't remove their own ownership of a folder. To clear it, make ${owner} owner of ${path} in ${workspaceFrom} too, or deploy as an admin of ${workspaceTo}.`, + 'warning', + [], + undefined, + 15000 + ) + } + } catch { + // The deploy itself succeeded; the next compare still shows the difference. + } + } + let deploymentErrorMessage = $state('') // The override acknowledges the outdated items listed next to it, not the // selection, so it holds while every outdated item is one the user ticked it