fix(automations): validate create destination projects

This commit is contained in:
Brennan Benson
2026-08-26 12:58:41 -07:00
parent 5a59bc5bc4
commit 256f23c7a0
3 changed files with 4 additions and 7 deletions
@@ -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)
})
@@ -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',
@@ -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 } }
})