fix(web): confirm automation deletion (#3129)
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
---
|
||||
created: 2026-08-28
|
||||
status: done
|
||||
requirements:
|
||||
- REQ-OFFICE-AUTOMATIONS-SETTINGS-001
|
||||
system_design:
|
||||
- ../../specs/office/system-design/automations-settings-01.md
|
||||
- ../../specs/office/system-design/automations-settings-02.md
|
||||
legacy_specs: []
|
||||
---
|
||||
|
||||
# Implementation Plan: Automation deletion confirmation
|
||||
|
||||
## Overview
|
||||
|
||||
Add one shared confirmation surface to both automation deletion entry points in
|
||||
Settings. The list and editor keep their existing mutation and navigation
|
||||
ownership, while the shared dialog prevents accidental deletion and gives the
|
||||
same desktop, keyboard, and phone outcome.
|
||||
|
||||
## Scope
|
||||
|
||||
### In scope
|
||||
|
||||
- Confirmation before deleting an automation from the workspace list.
|
||||
- Confirmation before deleting an automation from the automation editor.
|
||||
- Localized dialog title and permanent-deletion warning in all supported locales.
|
||||
- Desktop and mobile browser coverage for cancel and confirm behavior.
|
||||
|
||||
### Out of scope
|
||||
|
||||
- Changes to the automation delete API or backend lifecycle.
|
||||
- Confirmation for deleting individual automation runs or triggers.
|
||||
- Changes to the settings unsaved-changes save coordinator.
|
||||
|
||||
## Technical approach
|
||||
|
||||
- Add `apps/web/components/automations/automation-delete-confirm-dialog.tsx`,
|
||||
wrapping the existing `@kandev/ui/alert-dialog` primitives. The component
|
||||
receives the automation name and an async confirmation callback; it does not
|
||||
own API or routing state.
|
||||
- Keep the list page responsible for the selected row and call its existing
|
||||
`useAutomations.remove` mutation only after confirmation.
|
||||
- Keep the editor's existing `useRemoveAutomation` callback responsible for
|
||||
deletion and redirect, with `EditorFooter` becoming the dialog trigger.
|
||||
- Add the dialog copy to the five complete automation catalogs and preserve
|
||||
the current `automations:delete` action label. Keep the pseudo catalog in
|
||||
sync with the English catalog.
|
||||
|
||||
### Mobile design contract
|
||||
|
||||
- Desktop outcome: the list trash action and editor Delete button open a
|
||||
blocking confirmation; Confirm/Delete performs the existing deletion result.
|
||||
- Mobile entry point: the same visible trash/Delete control remains available;
|
||||
tapping it opens the shared alert dialog.
|
||||
- Nearest shipped exemplars: `quick-chat-delete-dialog.tsx` for the existing
|
||||
short destructive alert-dialog anatomy and
|
||||
`settings/mobile-agent-profile-delete.spec.ts` for settings deletion focus
|
||||
and 44px touch-target checks.
|
||||
- Hierarchy and surface: title, named automation warning, then Cancel and
|
||||
Delete in the existing centered `AlertDialog`; the content is short, so a
|
||||
bottom drawer would add no value to the blocking decision.
|
||||
- Scroll and safe area: the intrinsic alert dialog is viewport-contained, has
|
||||
no internal scroll owner, and uses full-width touch-sized footer actions on
|
||||
phone-sized viewports.
|
||||
- State: list/editor mutation, routing, and error handling remain shared with
|
||||
desktop; only the dialog presentation is responsive.
|
||||
- Mobile proof: a `mobile-*.spec.ts` flow opens the editor on a Pixel 5,
|
||||
verifies cancel leaves the automation intact, then confirms deletion and
|
||||
verifies the list destination and backend-visible removal.
|
||||
|
||||
## Tests
|
||||
|
||||
- `AC-OFFICE-AUTOMATIONS-SETTINGS-001.9` and `.001.10`: extend
|
||||
`apps/web/e2e/tests/automations-settings.spec.ts` to cover the editor
|
||||
dialog, cancellation, and confirmation; add a list-row confirmation check.
|
||||
- `AC-OFFICE-AUTOMATIONS-SETTINGS-001.11`: add
|
||||
`apps/web/e2e/tests/settings/mobile-automations-settings.spec.ts` using the
|
||||
`mobile-chrome` project, including viewport containment and touch hit-area
|
||||
assertions.
|
||||
- Run the automation catalog and specification checks after the implementation.
|
||||
|
||||
## E2E tests
|
||||
|
||||
- Desktop Chromium: `tests/automations-settings.spec.ts`, deletion from the
|
||||
editor and list.
|
||||
- Mobile Chrome: `tests/settings/mobile-automations-settings.spec.ts`,
|
||||
deletion from the editor with cancel and confirm paths.
|
||||
|
||||
## Work orders
|
||||
|
||||
- [x] [Task 01: Add automation deletion confirmation](task-01-add-confirmation.md)
|
||||
|
||||
## Verification results
|
||||
|
||||
- Passed `pnpm --filter @kandev/web run typecheck`.
|
||||
- Passed `pnpm --filter @kandev/web run lint`.
|
||||
- Passed `pnpm --filter @kandev/web run i18n:check` for all five complete
|
||||
catalogs and the pseudo catalog.
|
||||
- Passed focused Chromium E2E: 2 tests.
|
||||
- Passed focused mobile Chrome E2E: 1 test.
|
||||
- Passed focused automation unit tests: 6 tests, including failed-deletion
|
||||
dialog retention and controlled dialog behavior.
|
||||
- Passed specification tests and all-file specification lint.
|
||||
- Passed `git diff --check`.
|
||||
|
||||
## Risks
|
||||
|
||||
- The editor participates in the shared unsaved-settings navigation guard;
|
||||
confirmation must not bypass that guard until the delete mutation itself
|
||||
succeeds.
|
||||
- The list action is inside a clickable table row, so opening the dialog must
|
||||
continue to stop row navigation.
|
||||
- The production E2E build must be refreshed after frontend changes.
|
||||
@@ -0,0 +1,111 @@
|
||||
---
|
||||
id: "01-add-confirmation"
|
||||
title: "Add automation deletion confirmation"
|
||||
status: done
|
||||
wave: 1
|
||||
depends_on: []
|
||||
plan: "plan.md"
|
||||
requirements:
|
||||
- REQ-OFFICE-AUTOMATIONS-SETTINGS-001
|
||||
acceptance_criteria:
|
||||
- AC-OFFICE-AUTOMATIONS-SETTINGS-001.9
|
||||
- AC-OFFICE-AUTOMATIONS-SETTINGS-001.10
|
||||
- AC-OFFICE-AUTOMATIONS-SETTINGS-001.11
|
||||
system_design:
|
||||
- ../../specs/office/system-design/automations-settings-01.md
|
||||
- ../../specs/office/system-design/automations-settings-02.md
|
||||
---
|
||||
|
||||
# Task 01: Add automation deletion confirmation
|
||||
|
||||
## Summary
|
||||
|
||||
Place a shared, localized alert-dialog confirmation between both Settings
|
||||
automation deletion controls and the existing delete mutation. Preserve the
|
||||
list-row removal and editor redirect outcomes, and prove the phone path with a
|
||||
mobile Playwright flow.
|
||||
|
||||
## In scope
|
||||
|
||||
- Shared automation deletion confirmation component using the existing alert
|
||||
dialog primitives.
|
||||
- List-page selected-automation state and editor confirmation trigger.
|
||||
- Five-locale dialog title and warning copy.
|
||||
- Desktop and mobile E2E coverage for cancellation and confirmation.
|
||||
|
||||
## Out of scope
|
||||
|
||||
- Backend/API changes.
|
||||
- Automation run or trigger deletion behavior.
|
||||
- New settings save-coordinator behavior.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Both list-row and editor deletion actions open the named confirmation before
|
||||
any delete mutation; cancel or dismissal leaves the automation in place.
|
||||
- Confirming performs the existing deletion flow once, removes the list row or
|
||||
returns the editor to the automation list, and shows the same result on phone.
|
||||
- The phone dialog remains viewport-contained and its Cancel/Delete controls
|
||||
have at least 44px active hitbox height.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
(cd apps && pnpm --filter @kandev/web run i18n:check)
|
||||
(cd apps/web && pnpm e2e:run --project chromium tests/automations-settings.spec.ts -- --grep "delete automation")
|
||||
(cd apps/web && pnpm e2e:run --project mobile-chrome tests/settings/mobile-automations-settings.spec.ts)
|
||||
(python3 scripts/lint-spec-files.test.py)
|
||||
(python3 scripts/lint-spec-files.py --all)
|
||||
(git diff --check -- docs/specs docs/plans)
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/web/components/automations/automation-delete-confirm-dialog.tsx`
|
||||
- `apps/web/components/automations/automations-list-page.tsx`
|
||||
- `apps/web/components/automations/automations-table.tsx`
|
||||
- `apps/web/components/automations/automation-editor.tsx`
|
||||
- `apps/web/src/locales/{en,pt-pt,zh-cn,zh-hk,zh-tw}/automations.json`
|
||||
- `apps/web/src/locales/pseudo/automations.json`
|
||||
- `apps/web/e2e/pages/automations-page.ts`
|
||||
- `apps/web/e2e/tests/automations-settings.spec.ts`
|
||||
- `apps/web/e2e/tests/settings/mobile-automations-settings.spec.ts`
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
||||
## Risks
|
||||
|
||||
- A controlled dialog must not leave stale selected automation state after a
|
||||
cancel, successful delete, or live list refresh.
|
||||
- The mobile project only discovers files named `mobile-*.spec.ts`.
|
||||
|
||||
## Parallelism
|
||||
|
||||
`sequential`
|
||||
|
||||
## Inputs
|
||||
|
||||
- `docs/specs/office/requirements/automations-settings.md`, AC 001.9-001.11.
|
||||
- `docs/specs/office/system-design/automations-settings-01.md`, Deletion confirmation.
|
||||
- Existing `quick-chat-delete-dialog.tsx` and settings mobile deletion coverage.
|
||||
|
||||
## Results
|
||||
|
||||
- Added the shared AlertDialog confirmation and wired it to list-row and editor
|
||||
deletion controls without changing the existing delete API or redirect.
|
||||
- Added localized title and permanent-deletion warning copy to all supported
|
||||
catalogs, including pseudo-locale coverage.
|
||||
- Added desktop cancellation/confirmation coverage and mobile viewport,
|
||||
overflow, and touch-target coverage.
|
||||
- Passed `pnpm --filter @kandev/web run typecheck`.
|
||||
- Passed `pnpm --filter @kandev/web run lint`.
|
||||
- Passed `pnpm --filter @kandev/web run i18n:check`.
|
||||
- Passed focused Chromium E2E: 2 tests.
|
||||
- Passed focused mobile Chrome E2E: 1 test.
|
||||
- Added unit regression coverage for failed deletion keeping the confirmation
|
||||
open, and for the dialog not closing before the async confirmation settles.
|
||||
- Passed `python3 scripts/lint-spec-files.test.py` and
|
||||
`python3 scripts/lint-spec-files.py --all`.
|
||||
- Passed `git diff --check`.
|
||||
@@ -27,6 +27,9 @@ Users want to schedule an agent to run a prompt on a cron (or on a GitHub PR eve
|
||||
- **AC-OFFICE-AUTOMATIONS-SETTINGS-001.6:** When the selected executor profile's type does not support multi-repo, the picker renders as today's single dropdown (registered/discovered repos, or "Auto").
|
||||
- **AC-OFFICE-AUTOMATIONS-SETTINGS-001.7:** The Executor Profile picker disables executor profiles that don't support multi-repo whenever two or more repositories are currently selected, with the same disabled-reason text as the task-creation dialog, so a user cannot silently strand a multi-repository automation on an incompatible executor.
|
||||
- **AC-OFFICE-AUTOMATIONS-SETTINGS-001.8:** Automations created via the WS API directly (bypassing the editor) may still combine an incompatible executor with multiple repository IDs; this is a client-side authoring guard, not a backend rejection. Task launch on an incompatible executor fails the same way manual multi-repo task creation would.
|
||||
- **AC-OFFICE-AUTOMATIONS-SETTINGS-001.9:** When a user initiates automation deletion from the workspace automation list or the automation editor, the settings UI shall show a confirmation dialog that identifies the automation and states that the deletion cannot be undone.
|
||||
- **AC-OFFICE-AUTOMATIONS-SETTINGS-001.10:** When the user dismisses or cancels the deletion confirmation, the automation shall remain and no delete request shall be made. When the user confirms, the UI shall perform one deletion and preserve the existing result for that entry point: remove the list item or return the editor to the workspace automation list.
|
||||
- **AC-OFFICE-AUTOMATIONS-SETTINGS-001.11:** On a phone viewport, the deletion confirmation shall remain inside the viewport and expose reachable Cancel and Delete actions with touch-sized hit areas, while preserving the same deletion outcome as the desktop flow.
|
||||
|
||||
## System design
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ This design preserves the technical source detail for `REQ-OFFICE-AUTOMATIONS-SE
|
||||
|
||||
| Requirement | Design section |
|
||||
| --- | --- |
|
||||
| `REQ-OFFICE-AUTOMATIONS-SETTINGS-001` | [Migrated source detail](#migrated-source-detail) |
|
||||
| `REQ-OFFICE-AUTOMATIONS-SETTINGS-001` | [Migrated source detail](#migrated-source-detail), [Deletion confirmation](automations-settings-02.md#deletion-confirmation) |
|
||||
|
||||
## Migrated source detail
|
||||
|
||||
|
||||
@@ -17,10 +17,30 @@ This design preserves the technical source detail for `REQ-OFFICE-AUTOMATIONS-SE
|
||||
|
||||
| Requirement | Design section |
|
||||
| --- | --- |
|
||||
| `REQ-OFFICE-AUTOMATIONS-SETTINGS-001` | [Migrated source detail](#migrated-source-detail) |
|
||||
| `REQ-OFFICE-AUTOMATIONS-SETTINGS-001` | [Migrated source detail](#migrated-source-detail), [Deletion confirmation](#deletion-confirmation) |
|
||||
|
||||
## Migrated source detail
|
||||
|
||||
## Deletion confirmation
|
||||
|
||||
The workspace automation list and the automation editor share an
|
||||
`AutomationDeleteConfirmDialog` built on the existing `@kandev/ui/alert-dialog`
|
||||
primitive. The dialog owns the warning copy and accessible Cancel/Delete
|
||||
actions; its caller owns the selected automation and the mutation callback.
|
||||
|
||||
The list page records the row selected by its action cell and calls
|
||||
`useAutomations.remove` only from the dialog's confirmation callback. The editor
|
||||
opens the same dialog from `EditorFooter` and keeps the existing
|
||||
`useRemoveAutomation` callback, including its navigation-blocker bypass and
|
||||
redirect, behind confirmation. Closing or cancelling the dialog only clears its
|
||||
open state.
|
||||
|
||||
The modal remains short and viewport-contained on phones, so a centered alert
|
||||
dialog is preferred over a drawer. Its footer actions use the existing
|
||||
responsive alert-dialog layout, full-width touch-sized controls on coarse
|
||||
pointers, and the destructive action styling already used by automation run
|
||||
deletion.
|
||||
|
||||
## Migration
|
||||
|
||||
Withdrawing `execution_mode` is a behaviour change for existing installs, and the size of it is easy to understate. `task` was the **default**, so this is not an exotic minority: every automation created before this change that nobody explicitly set to `run` was producing a visible kanban card, and after upgrade it will not. The automations feature has been in the product since 2026-05-22, long enough for that to be somebody's working setup rather than a hypothetical.
|
||||
|
||||
Reference in New Issue
Block a user