mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 18:37:24 +00:00
Merge pull request #514 from nwparker/lc2/reg12-cloud-delete-kept
fix(cloud): REG-12 a cloud delete destroys the sandbox or fails visibly with Try again (never "Deleted" while kept)
This commit is contained in:
@@ -8,7 +8,14 @@ import {
|
||||
} from '../../shared/ephemeral-vm-runtime-store'
|
||||
import type { EphemeralVmRuntimeRecord } from '../../shared/ephemeral-vm-runtimes'
|
||||
import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope'
|
||||
import { RecipeWorkspaceRemovalError } from '../../shared/recipe-host-removal'
|
||||
import {
|
||||
CLOUD_DELETE_NOT_SENT,
|
||||
CLOUD_DELETE_NOT_SENT_IN_USE,
|
||||
CLOUD_DELETE_NOT_SENT_NO_DESTROY,
|
||||
CLOUD_DELETE_NOT_SENT_UNCHECKED,
|
||||
isCloudDeleteNotSentError,
|
||||
RecipeWorkspaceRemovalError
|
||||
} from '../../shared/recipe-host-removal'
|
||||
import { mapRuntimeError } from '../runtime/rpc/errors'
|
||||
import {
|
||||
describeRecipeWorkspaceEnvironments,
|
||||
@@ -268,3 +275,86 @@ describe('recipe workspace removal on the provisioning host', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('Orca Cloud: Delete destroys the sandbox or fails visibly, never "kept" (REG-12)', () => {
|
||||
const cloud: Partial<EphemeralVmRuntimeRecord> = {
|
||||
recipe: { id: 'cloud', name: 'Orca Cloud', create: 'orca-cloud create', provider: 'orca-cloud' }
|
||||
}
|
||||
const removedCheckout = (ports: ReturnType<typeof makePorts>) =>
|
||||
ports.call.mock.calls.some(([, method]) => method === 'worktree.rm')
|
||||
|
||||
it('the worktree list fails: an error, and nothing was deleted (no checkout removal, no destroy)', async () => {
|
||||
seed('orca-worktree', cloud)
|
||||
const ports = makePorts({ 'worktree.list': failed('runtime_unavailable') })
|
||||
await expect(removeRecipeWorkspace(root, params, ports)).rejects.toMatchObject({
|
||||
code: CLOUD_DELETE_NOT_SENT,
|
||||
message: CLOUD_DELETE_NOT_SENT_UNCHECKED
|
||||
})
|
||||
expect(removedCheckout(ports)).toBe(false)
|
||||
expect(ports.cleanup).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('a truncated list is no proof either', async () => {
|
||||
seed('orca-worktree', cloud)
|
||||
const ports = makePorts({ 'worktree.list': ok({ truncated: true, worktrees: [] }) })
|
||||
await expect(removeRecipeWorkspace(root, params, ports)).rejects.toMatchObject({
|
||||
message: CLOUD_DELETE_NOT_SENT_UNCHECKED
|
||||
})
|
||||
expect(removedCheckout(ports)).toBe(false)
|
||||
expect(ports.cleanup).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('other workspaces still on the sandbox: an error naming that, nothing deleted', async () => {
|
||||
seed('orca-worktree', cloud)
|
||||
const ports = makePorts({
|
||||
'worktree.list': ok({
|
||||
worktrees: [...onlyMain.worktrees, { id: 'repo::/workspace/repo-other' }]
|
||||
})
|
||||
})
|
||||
await expect(removeRecipeWorkspace(root, params, ports)).rejects.toMatchObject({
|
||||
message: CLOUD_DELETE_NOT_SENT_IN_USE
|
||||
})
|
||||
expect(removedCheckout(ports)).toBe(false)
|
||||
expect(ports.cleanup).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('a sandbox nothing would destroy: refused up front, nothing deleted', async () => {
|
||||
seed('orca-worktree', { ...cloud, cleanupStatus: 'disabled' })
|
||||
const ports = makePorts()
|
||||
await expect(removeRecipeWorkspace(root, params, ports)).rejects.toMatchObject({
|
||||
message: CLOUD_DELETE_NOT_SENT_NO_DESTROY
|
||||
})
|
||||
expect(ports.call).not.toHaveBeenCalled()
|
||||
expect(ports.cleanup).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('a "cleaned" record without a destroy still never reads as deleted (guard)', async () => {
|
||||
seed('orca-worktree', cloud)
|
||||
const ports = makePorts({}, 'disabled')
|
||||
await expect(removeRecipeWorkspace(root, params, ports)).rejects.toMatchObject({
|
||||
message: CLOUD_DELETE_NOT_SENT_NO_DESTROY
|
||||
})
|
||||
})
|
||||
|
||||
it('a sandbox that is this workspace’s alone is destroyed, and only then reports success', async () => {
|
||||
seed('orca-worktree', cloud)
|
||||
const ports = makePorts()
|
||||
await expect(removeRecipeWorkspace(root, params, ports)).resolves.toMatchObject({
|
||||
removed: true,
|
||||
host: { state: 'destroyed' }
|
||||
})
|
||||
expect(removedCheckout(ports)).toBe(true)
|
||||
expect(ports.cleanup).toHaveBeenCalledWith('vm-a')
|
||||
})
|
||||
|
||||
it('the not-sent errors are recognized for Try again', () => {
|
||||
for (const copy of [
|
||||
CLOUD_DELETE_NOT_SENT_UNCHECKED,
|
||||
CLOUD_DELETE_NOT_SENT_IN_USE,
|
||||
CLOUD_DELETE_NOT_SENT_NO_DESTROY
|
||||
]) {
|
||||
expect(isCloudDeleteNotSentError(`Error: ${copy}`)).toBe(true)
|
||||
}
|
||||
expect(isCloudDeleteNotSentError('Environment destroy failed.')).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -8,6 +8,10 @@ import {
|
||||
import type { EphemeralVmRuntimeRecord } from '../../shared/ephemeral-vm-runtimes'
|
||||
import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope'
|
||||
import {
|
||||
CLOUD_DELETE_NOT_SENT,
|
||||
CLOUD_DELETE_NOT_SENT_IN_USE,
|
||||
CLOUD_DELETE_NOT_SENT_NO_DESTROY,
|
||||
CLOUD_DELETE_NOT_SENT_UNCHECKED,
|
||||
RecipeWorkspaceRemovalError,
|
||||
type RecipeEnvironmentDescription,
|
||||
type RecipeHostRemovalState
|
||||
@@ -167,6 +171,13 @@ export async function removeRecipeWorkspace(
|
||||
throw new Error('Recipe workspace ownership changed. Refresh and try again.')
|
||||
}
|
||||
const environmentId = runtime.runtimeEnvironmentId
|
||||
const isOrcaCloud = runtime.recipe?.provider === 'orca-cloud'
|
||||
if (isOrcaCloud && (runtime.recipe?.destroyDisabled || runtime.cleanupStatus === 'disabled')) {
|
||||
// REG-12: nothing would destroy the sandbox, so refuse before touching anything.
|
||||
throw new RecipeWorkspaceRemovalError(CLOUD_DELETE_NOT_SENT, CLOUD_DELETE_NOT_SENT_NO_DESTROY, {
|
||||
runtimeId: runtime.id
|
||||
})
|
||||
}
|
||||
const { destroyHost: _destroyHost, ...forwarded } = params
|
||||
let checkoutResult: Record<string, unknown> = {}
|
||||
// A provisioned root is the VM's primary checkout, protected from ordinary Git deletion.
|
||||
@@ -177,6 +188,31 @@ export async function removeRecipeWorkspace(
|
||||
"This workspace's environment is asleep. Open the workspace to wake it, then delete it again."
|
||||
)
|
||||
}
|
||||
// Other workspaces on the same environment keep it alive; no answer is not proof it's empty.
|
||||
const otherWorkspaces = async (): Promise<unknown[] | undefined> => {
|
||||
const listed = await ports.call(environmentId, 'worktree.list', {})
|
||||
const parsedList = listed.ok ? Worktrees.safeParse(listed.result).data : undefined
|
||||
return parsedList && parsedList.truncated !== true
|
||||
? parsedList.worktrees.filter(
|
||||
(worktree) =>
|
||||
worktree.isMainWorktree !== true &&
|
||||
worktree.removing !== true &&
|
||||
worktree.id !== params.worktree.slice(3)
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
// REG-12: deleting an Orca Cloud workspace means deleting its sandbox, so prove the sandbox is
|
||||
// its alone before touching anything. A refusal then really deleted nothing (Try again is safe).
|
||||
if (isOrcaCloud) {
|
||||
const others = await otherWorkspaces()
|
||||
if (!others || others.length > 0) {
|
||||
throw new RecipeWorkspaceRemovalError(
|
||||
CLOUD_DELETE_NOT_SENT,
|
||||
others ? CLOUD_DELETE_NOT_SENT_IN_USE : CLOUD_DELETE_NOT_SENT_UNCHECKED,
|
||||
{ runtimeId: runtime.id }
|
||||
)
|
||||
}
|
||||
}
|
||||
const response = await ports.call(environmentId, 'worktree.rm', {
|
||||
...forwarded,
|
||||
hostId: 'local',
|
||||
@@ -202,20 +238,13 @@ export async function removeRecipeWorkspace(
|
||||
}
|
||||
checkoutResult = { ...removed, removed: true }
|
||||
}
|
||||
// Other workspaces on the same environment keep it alive; no answer is not proof it's empty.
|
||||
const listed = await ports.call(environmentId, 'worktree.list', {})
|
||||
const parsedList = listed.ok ? Worktrees.safeParse(listed.result).data : undefined
|
||||
const remaining =
|
||||
parsedList && parsedList.truncated !== true
|
||||
? parsedList.worktrees.filter(
|
||||
(worktree) =>
|
||||
worktree.isMainWorktree !== true &&
|
||||
worktree.removing !== true &&
|
||||
worktree.id !== params.worktree.slice(3)
|
||||
)
|
||||
: undefined
|
||||
if (!remaining || remaining.length > 0) {
|
||||
return { ...checkoutResult, removed: true, host: { runtimeId: runtime.id, state: 'kept' } }
|
||||
// A recipe VM shared by several workspaces stays while others live on it. (Orca Cloud proved
|
||||
// its sandbox was this workspace's alone above, so its delete always goes on to destroy.)
|
||||
if (!isOrcaCloud) {
|
||||
const remaining = await otherWorkspaces()
|
||||
if (!remaining || remaining.length > 0) {
|
||||
return { ...checkoutResult, removed: true, host: { runtimeId: runtime.id, state: 'kept' } }
|
||||
}
|
||||
}
|
||||
}
|
||||
const cleaned = await orderDestroy(() => ports.cleanup(runtime.id))
|
||||
@@ -226,6 +255,12 @@ export async function removeRecipeWorkspace(
|
||||
{ runtimeId: runtime.id }
|
||||
)
|
||||
}
|
||||
if (isOrcaCloud && cleaned.cleanupStatus === 'disabled') {
|
||||
// Guard only (checked up front): a "cleaned" record without a destroy is never "Deleted".
|
||||
throw new RecipeWorkspaceRemovalError(CLOUD_DELETE_NOT_SENT, CLOUD_DELETE_NOT_SENT_NO_DESTROY, {
|
||||
runtimeId: runtime.id
|
||||
})
|
||||
}
|
||||
return {
|
||||
...checkoutResult,
|
||||
removed: true,
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
// @vitest-environment happy-dom
|
||||
// REG-12: an Orca Cloud delete that failed before any sandbox delete was sent offers Try again.
|
||||
import type React from 'react'
|
||||
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
CLOUD_DELETE_NOT_SENT_IN_USE,
|
||||
CLOUD_DELETE_NOT_SENT_NO_DESTROY,
|
||||
CLOUD_DELETE_NOT_SENT_UNCHECKED
|
||||
} from '../../../../../../shared/recipe-host-removal'
|
||||
|
||||
const shown = vi.hoisted((): { title: string; description: React.ReactNode; duration: number } => ({
|
||||
title: '',
|
||||
description: null,
|
||||
duration: 0
|
||||
}))
|
||||
vi.mock('sonner', () => {
|
||||
const show = (title: string, options: { description: React.ReactNode; duration: number }) => {
|
||||
shown.title = title
|
||||
shown.description = options.description
|
||||
shown.duration = options.duration
|
||||
}
|
||||
return {
|
||||
toast: Object.assign(vi.fn(show), { error: vi.fn(show), info: vi.fn(show), dismiss: vi.fn() })
|
||||
}
|
||||
})
|
||||
|
||||
import { showDeleteWorktreeFailureToast } from './delete-worktree-failure-toast'
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
function showFor(error: string, onRetry = vi.fn()) {
|
||||
showDeleteWorktreeFailureToast({
|
||||
error,
|
||||
canForceDelete: false,
|
||||
forceDeleteReason: null,
|
||||
onViewChanges: vi.fn(),
|
||||
onForceDelete: vi.fn(),
|
||||
onDeleteAnyway: vi.fn(),
|
||||
onRetry,
|
||||
worktreeId: 'wt-cloud',
|
||||
worktreeName: 'ik-actions'
|
||||
})
|
||||
render(<>{shown.description}</>)
|
||||
return onRetry
|
||||
}
|
||||
|
||||
describe('delete failure toast: Try again', () => {
|
||||
it('offers Try again when no sandbox delete was sent, and it re-runs the delete', () => {
|
||||
const onRetry = showFor(`Error: ${CLOUD_DELETE_NOT_SENT_UNCHECKED}`)
|
||||
expect(shown.title).toBe("Couldn't delete ik-actions")
|
||||
expect(
|
||||
screen.getByText("Orca couldn't check the sandbox, so nothing was deleted.")
|
||||
).toBeTruthy()
|
||||
// It stays until the user acts: deleting must not silently time out.
|
||||
expect(shown.duration).toBe(Infinity)
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Try again' }))
|
||||
expect(onRetry).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
it('names the case: others still on the sandbox, or no delete went through', () => {
|
||||
showFor(CLOUD_DELETE_NOT_SENT_IN_USE)
|
||||
expect(
|
||||
screen.getByText(
|
||||
'Other workspaces still run in this sandbox, so nothing was deleted. Delete them first.'
|
||||
)
|
||||
).toBeTruthy()
|
||||
expect(screen.getByRole('button', { name: 'Try again' })).toBeTruthy()
|
||||
cleanup()
|
||||
showFor(CLOUD_DELETE_NOT_SENT_NO_DESTROY)
|
||||
expect(screen.getByText("The delete didn't go through, so nothing was deleted.")).toBeTruthy()
|
||||
})
|
||||
|
||||
it('does not offer it for other failures (a retry could repeat a partial destroy)', () => {
|
||||
showFor('Environment destroy failed. The environment may still be running.')
|
||||
expect(screen.queryByRole('button', { name: 'Try again' })).toBeNull()
|
||||
})
|
||||
})
|
||||
+62
-7
@@ -5,6 +5,12 @@ import { useTranslate } from '@/i18n/use-translate'
|
||||
import { DeleteNestedWorktreesDialog } from './DeleteNestedWorktreesDialog'
|
||||
import { WorktreeForceDeleteButton } from './WorktreeForceDeleteButton'
|
||||
import { isNestedWorktreeRemovalError } from '../../../../../../shared/worktree/nested-removal'
|
||||
import {
|
||||
CLOUD_DELETE_NOT_SENT_IN_USE,
|
||||
CLOUD_DELETE_NOT_SENT_NO_DESTROY,
|
||||
isCloudDeleteNotSentError
|
||||
} from '../../../../../../shared/recipe-host-removal'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { composeWorktreeHostIdentity } from '../../../../../../shared/worktree/host-qualified-identity'
|
||||
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
|
||||
import {
|
||||
@@ -26,6 +32,8 @@ type DeleteWorktreeFailureToastOptions = {
|
||||
onForceDelete: () => void
|
||||
onAlwaysForceDelete?: () => Promise<void>
|
||||
onDeleteAnyway: () => void
|
||||
/** REG-12: a delete that failed before any sandbox delete was sent offers Try again. */
|
||||
onRetry?: () => void
|
||||
worktreeId: string
|
||||
executionHostId?: ExecutionHostId | null
|
||||
worktreeName: string
|
||||
@@ -52,6 +60,7 @@ function DeleteWorktreeFailureToastBody({
|
||||
onForceDelete,
|
||||
onAlwaysForceDelete,
|
||||
onDeleteAnyway,
|
||||
onRetry,
|
||||
toastId,
|
||||
nestedRemovalTarget,
|
||||
worktreeName,
|
||||
@@ -65,6 +74,7 @@ function DeleteWorktreeFailureToastBody({
|
||||
onForceDelete: () => void
|
||||
onAlwaysForceDelete?: () => Promise<void>
|
||||
onDeleteAnyway: () => void
|
||||
onRetry?: () => void
|
||||
toastId: string
|
||||
nestedRemovalTarget?: WorktreeRemovalTarget
|
||||
worktreeName: string
|
||||
@@ -79,6 +89,10 @@ function DeleteWorktreeFailureToastBody({
|
||||
toast.dismiss(toastId)
|
||||
onDeleteAnyway()
|
||||
}
|
||||
const retry = (): void => {
|
||||
toast.dismiss(toastId)
|
||||
onRetry?.()
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-3">
|
||||
@@ -106,6 +120,11 @@ function DeleteWorktreeFailureToastBody({
|
||||
onAlwaysForceDelete={onAlwaysForceDelete}
|
||||
/>
|
||||
) : null}
|
||||
{onRetry ? (
|
||||
<Button type="button" variant="outline" size="sm" onClick={retry}>
|
||||
{t('auto.components.sidebar.delete.worktree.failure.tryAgain', 'Try again')}
|
||||
</Button>
|
||||
) : null}
|
||||
{canWaiveArchiveHook ? (
|
||||
<Button type="button" variant="destructive" size="sm" onClick={deleteAnyway}>
|
||||
{t('auto.components.sidebar.delete.worktree.failure.archive.waiver', 'Delete Anyway')}
|
||||
@@ -116,6 +135,38 @@ function DeleteWorktreeFailureToastBody({
|
||||
)
|
||||
}
|
||||
|
||||
/** REG-12: an Orca Cloud delete refused before anything was deleted, in design-squad's copy. */
|
||||
function cloudDeleteNotSentCopy(
|
||||
worktreeName: string,
|
||||
error: string
|
||||
): { title: string; description: string; isDestructive: boolean } {
|
||||
const description = error.includes(CLOUD_DELETE_NOT_SENT_IN_USE)
|
||||
? translate(
|
||||
'auto.components.sidebar.delete.worktree.failure.cloudInUse',
|
||||
'Other workspaces still run in this sandbox, so nothing was deleted. Delete them first.'
|
||||
)
|
||||
: error.includes(CLOUD_DELETE_NOT_SENT_NO_DESTROY)
|
||||
? translate(
|
||||
'auto.components.sidebar.delete.worktree.failure.cloudNoDestroy',
|
||||
"The delete didn't go through, so nothing was deleted."
|
||||
)
|
||||
: translate(
|
||||
'auto.components.sidebar.delete.worktree.failure.cloudUnchecked',
|
||||
"Orca couldn't check the sandbox, so nothing was deleted."
|
||||
)
|
||||
return {
|
||||
title: translate(
|
||||
'auto.components.sidebar.delete.worktree.failure.cloudTitle',
|
||||
"Couldn't delete {{name}}",
|
||||
{
|
||||
name: worktreeName
|
||||
}
|
||||
),
|
||||
description,
|
||||
isDestructive: true
|
||||
}
|
||||
}
|
||||
|
||||
export function showDeleteWorktreeFailureToast({
|
||||
error,
|
||||
canForceDelete,
|
||||
@@ -127,24 +178,24 @@ export function showDeleteWorktreeFailureToast({
|
||||
onForceDelete,
|
||||
onAlwaysForceDelete,
|
||||
onDeleteAnyway,
|
||||
onRetry,
|
||||
worktreeId,
|
||||
executionHostId,
|
||||
worktreeName,
|
||||
nestedRemovalTarget,
|
||||
onNestedDeleted
|
||||
}: DeleteWorktreeFailureToastOptions): void {
|
||||
const toastCopy = getDeleteWorktreeToastCopy(
|
||||
worktreeName,
|
||||
forceDeleteReason,
|
||||
error,
|
||||
lockReason ?? null
|
||||
)
|
||||
const toastCopy = isCloudDeleteNotSentError(error)
|
||||
? cloudDeleteNotSentCopy(worktreeName, error)
|
||||
: getDeleteWorktreeToastCopy(worktreeName, forceDeleteReason, error, lockReason ?? null)
|
||||
const showToast = toastCopy.isDestructive ? toast.error : toast.info
|
||||
const id = deleteWorktreeFailureToastId({
|
||||
id: worktreeId,
|
||||
executionHostId: executionHostId ?? null
|
||||
})
|
||||
const nestedTarget = isNestedWorktreeRemovalError(error) ? nestedRemovalTarget : undefined
|
||||
// Only where nothing was destroyed yet: then trying again is safe (REG-12).
|
||||
const retryable = onRetry && isCloudDeleteNotSentError(error) ? onRetry : undefined
|
||||
|
||||
// Custom content gives multiline errors their own line instead of squeezing them into Sonner’s action/title row.
|
||||
showToast(toastCopy.title, {
|
||||
@@ -164,6 +215,7 @@ export function showDeleteWorktreeFailureToast({
|
||||
onForceDelete={onForceDelete}
|
||||
onAlwaysForceDelete={onAlwaysForceDelete}
|
||||
onDeleteAnyway={onDeleteAnyway}
|
||||
onRetry={retryable}
|
||||
toastId={id}
|
||||
nestedRemovalTarget={nestedTarget}
|
||||
worktreeName={worktreeName}
|
||||
@@ -171,7 +223,10 @@ export function showDeleteWorktreeFailureToast({
|
||||
/>
|
||||
),
|
||||
// A toast offering a destructive choice must not expire before the user reads the reason.
|
||||
duration: canForceDelete || canWaiveArchiveHook === true || nestedTarget ? Infinity : 10000,
|
||||
duration:
|
||||
canForceDelete || canWaiveArchiveHook === true || nestedTarget || retryable
|
||||
? Infinity
|
||||
: 10000,
|
||||
dismissible: true
|
||||
})
|
||||
}
|
||||
|
||||
+2
@@ -63,6 +63,8 @@ export function runWorktreeDeleteWithToast(
|
||||
// Waive archive-hook failure only after explicit refusal review; force alone does not imply consent.
|
||||
onDeleteAnyway: () =>
|
||||
retryFromToast({ force: options.force === true, allowFailedArchiveHook: true }),
|
||||
// Nothing was destroyed yet (an Orca Cloud delete that couldn't go out): the same delete again.
|
||||
onRetry: () => retryFromToast({ force: options.force === true }),
|
||||
// The explicit Force Delete retry may waive an unverified PTY-stop proof.
|
||||
onForceDelete: () =>
|
||||
retryFromToast({
|
||||
|
||||
@@ -7454,7 +7454,12 @@
|
||||
"failure": {
|
||||
"archive": {
|
||||
"waiver": "Delete Anyway"
|
||||
}
|
||||
},
|
||||
"tryAgain": "Try again",
|
||||
"cloudInUse": "Other workspaces still run in this sandbox, so nothing was deleted. Delete them first.",
|
||||
"cloudNoDestroy": "The delete didn't go through, so nothing was deleted.",
|
||||
"cloudUnchecked": "Orca couldn't check the sandbox, so nothing was deleted.",
|
||||
"cloudTitle": "Couldn't delete {{name}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -29,3 +29,25 @@ export class RecipeWorkspaceRemovalError extends Error {
|
||||
this.data = data
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* REG-12: an Orca Cloud workspace's delete either destroys its sandbox or fails visibly. It never
|
||||
* reports success while the sandbox is kept (another workspace on it, or no proof it is empty).
|
||||
*/
|
||||
export const CLOUD_DELETE_NOT_SENT = 'cloud_delete_not_sent'
|
||||
// Main sends these as the error message; the toast shows the translated copy for each (design-squad).
|
||||
export const CLOUD_DELETE_NOT_SENT_UNCHECKED =
|
||||
"Orca couldn't check the sandbox, so nothing was deleted."
|
||||
export const CLOUD_DELETE_NOT_SENT_IN_USE =
|
||||
'Other workspaces still run in this sandbox, so nothing was deleted. Delete them first.'
|
||||
export const CLOUD_DELETE_NOT_SENT_NO_DESTROY =
|
||||
"The delete didn't go through, so nothing was deleted."
|
||||
|
||||
/** The removal failed before any sandbox delete was sent: retrying is safe and may succeed. */
|
||||
export function isCloudDeleteNotSentError(message: string): boolean {
|
||||
return [
|
||||
CLOUD_DELETE_NOT_SENT_UNCHECKED,
|
||||
CLOUD_DELETE_NOT_SENT_IN_USE,
|
||||
CLOUD_DELETE_NOT_SENT_NO_DESTROY
|
||||
].some((copy) => message.includes(copy))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user