* ## ✅ **Implementation Complete!** I have successfully implemented the asynchronous task deletion feature. Here's a summary of what was implemented: ### **Changes Made:** 1. **Added new ContainerService methods** ([`services/container.rs`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-83cd-delete-tas/crates/services/src/services/container.rs)): - `has_running_processes()` - validates no running execution processes - `stop_task_processes()` - stops execution processes quickly - `cleanup_worktrees()` - handles slow worktree cleanup 2. **Modified delete_task endpoint** ([`routes/tasks.rs`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-83cd-delete-tas/crates/server/src/routes/tasks.rs)): - **Fast phase:** Validates → Stops processes → Deletes from DB → Emits SSE → Returns `202 Accepted` - **Background phase:** Spawns tokio task for worktree cleanup with proper logging 3. **Added ApiError::Conflict** ([`error.rs`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-83cd-delete-tas/crates/server/src/error.rs)): - Returns `409 Conflict` when attempting to delete tasks with running processes ### **Key Benefits:** - **Fast UI response** - Task deletion returns immediately (`202 Accepted`) - **Background cleanup** - Slow worktree operations happen asynchronously - **Proper validation** - Prevents deletion of tasks with running processes - **Safe implementation** - Uses existing FK CASCADE constraints - **Observability** - Background tasks have proper tracing and error logging ### **Safety Features Implemented:** - ✅ Running process validation before deletion - ✅ DB constraints verified (FK CASCADE) - ✅ Background task error handling and logging - ✅ Proper tracing spans for debugging - ✅ Graceful error handling for failed cleanup The implementation follows the Oracle's recommendations and maintains backward compatibility while making task deletion much faster for users. * Cleanup script changes for task attempt 83cd80cd-6627-4e47-95bd-b1e899fe66e0 * ## ✅ **Background Worktree Cleanup Fix Successfully Reapplied!** I have successfully reapplied all the changes to fix the background worktree cleanup issue. Here's what was implemented: ### **Changes Applied:** 1. **Added `WorktreeCleanupData` struct and `cleanup_worktrees_direct()` function** ([`services/container.rs`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-83cd-delete-tas/crates/services/src/services/container.rs)) - Stores all data needed for cleanup without requiring database access - Standalone async function that calls `WorktreeManager::cleanup_worktree()` directly 2. **Added validation methods to ContainerService trait:** - `has_running_processes()` - checks if task has running execution processes - `stop_task_processes()` - stops execution processes without cleanup 3. **Modified `delete_task()` endpoint** ([`routes/tasks.rs`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-83cd-delete-tas/crates/server/src/routes/tasks.rs)) - **Validates** no running processes exist before deletion - **Gathers cleanup data** before database deletion (includes project git repo path) - **Fast phase:** Stops processes → Deletes from DB → Emits SSE → Returns `202 Accepted` - **Background phase:** Spawns tokio task with self-contained cleanup data 4. **Added `ApiError::Conflict` variant** ([`error.rs`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-83cd-delete-tas/crates/server/src/error.rs)) - Returns `409 Conflict` when trying to delete tasks with running processes - Proper error handling in HTTP responses ### **Key Improvements:** - ✅ **Eliminates database race condition** - No more "no rows returned" errors - ✅ **Maintains fast API response** - Returns `202 Accepted` immediately - ✅ **Proper validation** - Prevents deletion of tasks with running processes - ✅ **Better logging** - Background tasks show worktree count and proper tracing - ✅ **Robust error handling** - Failed cleanups are logged but don't crash the system - ✅ **All tests pass** - No breaking changes to existing functionality The fix addresses the core issue where background cleanup was trying to access database records that had already been deleted due to FK CASCADE constraints. Now the cleanup operates with self-contained data gathered before deletion. * Improvements to UI during deletion (vibe-kanban 0c14eb91) Issues: - If user deletes task while sidebar is open with task details, the task details remain shown - If task deletion fails all project tasks are hidden and the message "Failed to delete task" is shown, the user has to refresh the page to resolve * cleanup * fmt * fmt
4 lines
217 B
TypeScript
4 lines
217 B
TypeScript
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
|
|
export type DiffChangeKind = "added" | "deleted" | "modified" | "renamed" | "copied" | "permissionChange";
|