Files
vibe-kanban/backend/.sqlx/query-94a21be956c9451a8b117d25ffd4e5ee75bba0aa032139572cf87651e2856f3a.json
Louis Knight-Webb 0bdb2840c0 Remove task attempt activity (vibe-kanban) (#242)
* ## Summary

I have successfully completed the task to remove the task attempt activity functionality from the codebase. Here's what was accomplished:

###  **Completed Work:**

1. **Database Migration**: Created `backend/migrations/20250717000000_drop_task_attempt_activities.sql` to drop the `task_attempt_activities` table and its indexes

2. **Backend Cleanup**:
   - Deleted `backend/src/models/task_attempt_activity.rs` model file
   - Removed imports and exports from `backend/src/models/mod.rs`
   - Cleaned up all references in `backend/src/routes/task_attempts.rs`:
     - Removed `get_task_attempt_activities` and `create_task_attempt_activity` functions
     - Removed the API route endpoints
     - Removed activity creation calls in process stop handlers
   - Updated `backend/src/services/process_service.rs` to remove activity creation
   - Updated `backend/src/execution_monitor.rs` to remove activity creation throughout the execution flow
   - Removed type exports from `backend/src/bin/generate_types.rs`

3. **Frontend Cleanup**:
   - Regenerated TypeScript types (TaskAttemptActivity types automatically removed)
   - Removed `getActivities` API function from `frontend/src/lib/api.ts`
   - Deleted `frontend/src/components/tasks/TaskActivityHistory.tsx` component
   - Updated `frontend/src/lib/types.ts` to remove activity references
   - Updated `frontend/src/components/context/TaskDetailsContextProvider.tsx` to fetch only processes (no activities)
   - Updated `frontend/src/components/tasks/TaskFollowUpSection.tsx` to determine follow-up eligibility based on completed coding agent processes instead of activities

4. **Build Verification**: Both backend (Rust) and frontend (TypeScript) build successfully

### ⚠️ **Remaining Issue:**

There's one SQL query in `backend/src/models/task.rs` that still references the `task_attempt_activities` table. The query has become malformed during the editing process. This needs to be fixed to complete the task.

The functionality has been successfully removed with no compilation errors in the main application code. The only remaining work is to fix the SQL query that determines task status based on execution process states rather than activities.

* update queries

* clippy

* prettier

* mark task as failed or killed

* sql rebase fixes
2025-07-17 14:56:44 +01:00

87 lines
4.6 KiB
JSON

{
"db_name": "SQLite",
"query": "SELECT \n t.id AS \"id!: Uuid\",\n t.project_id AS \"project_id!: Uuid\",\n t.title,\n t.description,\n t.status AS \"status!: TaskStatus\",\n t.parent_task_attempt AS \"parent_task_attempt: Uuid\", \n t.created_at AS \"created_at!: DateTime<Utc>\",\n t.updated_at AS \"updated_at!: DateTime<Utc>\",\n CASE \n WHEN ip.task_id IS NOT NULL THEN true \n ELSE false \n END AS \"has_in_progress_attempt!: i64\",\n CASE \n WHEN ma.task_id IS NOT NULL THEN true \n ELSE false \n END AS \"has_merged_attempt!: i64\",\n CASE \n WHEN fa.task_id IS NOT NULL THEN true \n ELSE false \n END AS \"has_failed_attempt!: i64\",\n latest_executor_attempts.executor AS \"latest_attempt_executor\"\n FROM tasks t\n\n -- in-progress if any running setupscript/codingagent\n LEFT JOIN (\n SELECT DISTINCT ta.task_id\n FROM task_attempts ta\n JOIN execution_processes ep \n ON ta.id = ep.task_attempt_id\n WHERE ep.status = 'running'\n AND ep.process_type IN ('setupscript','codingagent')\n ) ip \n ON t.id = ip.task_id\n\n -- merged if merge_commit not null\n LEFT JOIN (\n SELECT DISTINCT task_id\n FROM task_attempts\n WHERE merge_commit IS NOT NULL\n ) ma \n ON t.id = ma.task_id\n\n -- failed if latest attempt has a failed setupscript/codingagent\n LEFT JOIN (\n SELECT sub.task_id\n FROM (\n SELECT\n ta.task_id,\n ep.status,\n ep.process_type,\n ROW_NUMBER() OVER (\n PARTITION BY ta.task_id \n ORDER BY ta.created_at DESC\n ) AS rn\n FROM task_attempts ta\n JOIN execution_processes ep \n ON ta.id = ep.task_attempt_id\n WHERE ep.process_type IN ('setupscript','codingagent')\n ) sub\n WHERE sub.rn = 1\n AND sub.status IN ('failed','killed')\n ) fa\n ON t.id = fa.task_id\n\n -- get the executor of the latest attempt\n LEFT JOIN (\n SELECT task_id, executor\n FROM (\n SELECT task_id, executor, created_at,\n ROW_NUMBER() OVER (PARTITION BY task_id ORDER BY created_at DESC) AS rn\n FROM task_attempts\n ) latest_attempts\n WHERE rn = 1\n ) latest_executor_attempts \n ON t.id = latest_executor_attempts.task_id\n\n WHERE t.project_id = $1\n ORDER BY t.created_at DESC;\n ",
"describe": {
"columns": [
{
"name": "id!: Uuid",
"ordinal": 0,
"type_info": "Blob"
},
{
"name": "project_id!: Uuid",
"ordinal": 1,
"type_info": "Blob"
},
{
"name": "title",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "description",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "status!: TaskStatus",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "parent_task_attempt: Uuid",
"ordinal": 5,
"type_info": "Blob"
},
{
"name": "created_at!: DateTime<Utc>",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "updated_at!: DateTime<Utc>",
"ordinal": 7,
"type_info": "Text"
},
{
"name": "has_in_progress_attempt!: i64",
"ordinal": 8,
"type_info": "Integer"
},
{
"name": "has_merged_attempt!: i64",
"ordinal": 9,
"type_info": "Integer"
},
{
"name": "has_failed_attempt!: i64",
"ordinal": 10,
"type_info": "Integer"
},
{
"name": "latest_attempt_executor",
"ordinal": 11,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
true,
false,
false,
true,
false,
true,
false,
false,
false,
false,
false,
true
]
},
"hash": "94a21be956c9451a8b117d25ffd4e5ee75bba0aa032139572cf87651e2856f3a"
}