MotirBuilding in public
MOTIR · moooon
onMotir
You’re viewing a public project. Anyone can view it — no account needed. Sign in to submit, upvote, or comment on requests.View-only — you can’t edit work items
MOTIR-791

2.8 Delete a work item — permanent delete with subtree cascade (Jira parity)

Done
Description

Gap (verified 2026-06-15): work-item CRUD shipped archive (soft-delete via archivedAt, built in 1.4.4 / MOTIR-47) but never a hard/permanent delete — there is no deleteWorkItem service, no DELETE /api/work-items/[id] route, no UI delete. The workItemsService.ts:1472 comment ("a destructive tree-delete is a separate, explicit action") states the intent but no code implements it.

Mirror (Jira): Jira has BOTH — archive (soft, restorable, admin-gated, parent→subtask cascade) AND delete (permanent, "Delete Issues" project permission, deletes a parent's subtasks with it). Motir has archive only; permanent delete is the missing half. Per "the plan IS the complete product", this is a planning gap to fill, not a tier cut.

This story adds permanent delete of a work item with subtree cascade, Jira-parity: a destructive, permission-gated, irreversible delete that removes the item + all its descendants + their links, with a clear confirm (cascade count, "can't be undone") and an audit trail. Exposed in the UI (detail / list / board) AND over the MCP (delete_work_item).

Pairs with 7.8.14 (which adds MCP update + archive + unarchive). Archive stays the default reversible removal; delete is the explicit permanent one.

Why

User feedback (2026-06-15): "did you check if we have an archived status and if hard delete is supported? check the mirror product (Jira)." Verified: archive yes (soft, no cascade), hard delete no — Jira has it, so plan it.

Sources

Jira archive-vs-delete: support.atlassian.com/jira-software-cloud/docs/archive-an-issue, confluence.atlassian.com/adminjiraserver/archiving-an-issue-968669980.html (archive soft+restorable, cascades to subtasks; delete permanent, "Delete Issues" permission).

Context refs

  • lib/services/workItemsService.ts (archiveWorkItem ~1475; no delete); workItemRepository (tree/descendants reads, e.g. forest CTE; archive, no delete); app/api/work-items/[id]/ (no DELETE handler); kind-parent tree triggers (1.4.2); revision/activity (1.4.6/5.5)
  • destructive-confirm precedent: 5.3.6 custom-field delete-with-count confirm