From 256f23c7a00fb6b911fdfcbd0a955caeb30890d7 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Wed, 26 Aug 2026 12:58:41 -0700 Subject: [PATCH] fix(automations): validate create destination projects --- .../automations/AutomationsPage.create-destination.test.tsx | 4 ++-- src/renderer/src/components/automations/AutomationsPage.tsx | 5 +---- .../automations/automation-scoped-list-client.test.ts | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx b/src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx index 8525545668a..d13ab127e21 100644 --- a/src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx +++ b/src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx @@ -152,7 +152,7 @@ describe('AutomationsPage create destination', () => { expect(api.automations.create).not.toHaveBeenCalled() expect(runtimeCreateCalls()).toHaveLength(0) - expect(mocks.editorDialog?.notice?.message).toBeTruthy() + expect(mocks.toastError).toHaveBeenCalled() expect(mocks.editorDialog?.open).toBe(true) }) @@ -169,7 +169,7 @@ describe('AutomationsPage create destination', () => { // A repo with no connection ID is not evidence of local: this one is the // runtime's, and the desktop's Self host cannot hold an automation for it. expect(api.automations.create).not.toHaveBeenCalled() - expect(mocks.editorDialog?.notice?.message).toBeTruthy() + expect(mocks.toastError).toHaveBeenCalled() expect(mocks.editorDialog?.open).toBe(true) }) diff --git a/src/renderer/src/components/automations/AutomationsPage.tsx b/src/renderer/src/components/automations/AutomationsPage.tsx index 85b4ddf5929..882ac49ea2f 100644 --- a/src/renderer/src/components/automations/AutomationsPage.tsx +++ b/src/renderer/src/components/automations/AutomationsPage.tsx @@ -992,9 +992,6 @@ export default function AutomationsPage(): React.JSX.Element { ? getAutomationOwnerTarget(editingAutomation, automationHostTarget) : getAutomationListTarget(settings) const isOrcaForm = createTarget === 'orca' && editingExternalTarget === null - const dialogRepos = isOrcaForm - ? getAutomationCreateRepos(repos, automationDialogTarget) - : getAutomationCreateRepos(repos, { kind: 'local' }) const destinationForProject = useCallback( (projectId: string): AutomationCreateDestination | null => { @@ -1554,7 +1551,7 @@ export default function AutomationsPage(): React.JSX.Element { ) return } - if (isOrcaForm && !dialogRepos.some((repo) => repo.id === draft.projectId)) { + if (isOrcaForm && !editorProjects.some((repo) => repo.id === draft.projectId)) { toast.error( translate( 'auto.components.automations.AutomationsPage.destinationProjectUnavailable', diff --git a/src/renderer/src/components/automations/automation-scoped-list-client.test.ts b/src/renderer/src/components/automations/automation-scoped-list-client.test.ts index 494e0f706cc..c5e2efe1b07 100644 --- a/src/renderer/src/components/automations/automation-scoped-list-client.test.ts +++ b/src/renderer/src/components/automations/automation-scoped-list-client.test.ts @@ -159,7 +159,7 @@ describe('owner-fenced mutations', () => { ) expect(callRuntimeRpc.mock.calls[0]?.[2]).toEqual({ id: 'a1', - updates: { repo: 'repo-ssh' }, + updates: { repo: 'id:repo-ssh' }, expectedOwner: { selector: { kind: 'self' } }, destination: { selector: { kind: 'ssh', targetId: 'ssh-1', targetGeneration: 7 } } })