Soft-delete archive system for tasks and workspaces in Toodo
Discovered from README cross-links · today
Deleting tasks and workspaces now archives them, with restore and purge.
What they did
The author implemented soft-delete archiving across the Toodo stack instead of erasing rows. Deleting a task or workspace now sets `archived_at` (schema version 41). Archived items drop out of lists and the dependency DAG, so dependents stop waiting on them, while history, commits, notes, criteria, and links are retained. Reviews (`review_period`) still include archived work, each entry carrying an `archived` flag rendered as an "Archived" chip, and reviews name archived workspaces. A new Settings > Archive section lists archived workspaces and tasks with Restore (`restore_task`, `restore_workspace`) and Delete permanently (`purge_task`, `purge_workspace`, archived items only, confirmed first). Restores that would close a dependency cycle are rejected and the cycle is named. Archiving a workspace is rejected while a run of one of its tasks is queued or active, and its open runtime workspaces are closed. The MCP `delete_task` text, docs (`workflow.md`, `architecture.md`, `agents.md`), and the agent skill were updated to describe archiving.
How it went
Verification was thorough: `cargo test --lib` passed 876 tests (skipping `runtime::plain` `remote_stop_*` tests that hang on this host), clippy with `-D warnings` and `cargo fmt --check` were clean, and `npm run typecheck` plus `npm test` passed 393 tests including a new `archive-panel.test.tsx`. A scratch `toodo-server` was exercised through `/api/rpc` with SQLite checks confirming rows persist with `archived_at` and are hidden, dependents become unblocked, reviews list archived tasks marked `archived`, restore brings the dependency edge back, invalid restores and purges are rejected with next-step guidance, and purge removes rows and review entries. Browser checks at desktop 1280px and phone 390px confirmed the Archive section lists items, permanent delete asks for confirmation, Restore removes the item, and the review shows the Archived chip.
Worth knowing
The `runtime::plain` `remote_stop_*` tests hang on this host and were skipped, so that path is unverified here. Verification relied on a scratch server and manual browser checks rather than a full CI run. The archive/purge behavior is exposed through RPC and MCP text; no migration backfill details for pre-existing rows are described beyond schema version 41.
Wiring
Schema migration adds `archived_at` at version 41. Server RPC endpoints gain `restore_task`, `restore_workspace`, `purge_task`, and `purge_workspace`; delete handlers set `archived_at`. List and DAG queries filter on `archived_at IS NULL`. Review queries include archived rows and project an `archived` boolean. The frontend adds an Archive settings panel calling the restore and purge RPCs with a confirmation dialog, and review entries render the Archived chip. MCP tool text and docs are updated to match. Verification runs `cargo test --lib`, `cargo clippy --all-targets -- -D warnings`, `cargo fmt --check`, `npm run typecheck`, and `npm test`, plus a scratch `toodo-server` exercised through `/api/rpc` with SQLite checks and browser checks at 1280px and 390px.
Try it yourself
In this repo, replace hard deletes of tasks and workspaces with archiving. Add an `archived_at` column (bump schema to 41) and make delete set it instead of removing rows. Exclude archived items from lists and from the dependency DAG so dependents are unblocked, but keep history, commits, notes, criteria, and links. Keep archived work in `review_period` results with an `archived` flag and show an "Archived" chip. Add Settings > Archive listing archived workspaces and tasks with Restore (`restore_task`, `restore_workspace`) and Delete permanently (`purge_task`, `purge_workspace`, archived only, confirmed first). Reject restores that would close a dependency cycle and name the cycle. Reject archiving a workspace while a run of one of its tasks is queued or active, and close its open runtime workspaces. Update MCP `delete_task` text, `workflow.md`, `architecture.md`, `agents.md`, and the agent skill. Add tests including an archive panel test, then run cargo test, clippy, fmt, typecheck, and npm test.