From 8cffddc399a0a10eb48175e065efd23880d49e04 Mon Sep 17 00:00:00 2001 From: kimi Date: Sun, 22 Mar 2026 18:07:33 -0400 Subject: [PATCH] docs: add docstrings to src/dashboard/routes/tasks.py Add proper docstrings to all public methods in the tasks module: - HTMX partials: tasks_pending, tasks_active, tasks_completed - Task action endpoints: approve_task, veto_task, pause_task, cancel_task, retry_task, modify_task Fixes #939 --- src/dashboard/routes/tasks.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dashboard/routes/tasks.py b/src/dashboard/routes/tasks.py index 93669b5c..69f2fc72 100644 --- a/src/dashboard/routes/tasks.py +++ b/src/dashboard/routes/tasks.py @@ -145,6 +145,7 @@ async def tasks_page(request: Request): @router.get("/tasks/pending", response_class=HTMLResponse) async def tasks_pending(request: Request): + """Return HTMX partial for pending approval tasks.""" with _get_db() as db: rows = db.execute( "SELECT * FROM tasks WHERE status='pending_approval' ORDER BY created_at DESC" @@ -164,6 +165,7 @@ async def tasks_pending(request: Request): @router.get("/tasks/active", response_class=HTMLResponse) async def tasks_active(request: Request): + """Return HTMX partial for active (approved/running/paused) tasks.""" with _get_db() as db: rows = db.execute( "SELECT * FROM tasks WHERE status IN ('approved','running','paused') ORDER BY created_at DESC" @@ -183,6 +185,7 @@ async def tasks_active(request: Request): @router.get("/tasks/completed", response_class=HTMLResponse) async def tasks_completed(request: Request): + """Return HTMX partial for completed/vetoed/failed tasks (last 50).""" with _get_db() as db: rows = db.execute( "SELECT * FROM tasks WHERE status IN ('completed','vetoed','failed') ORDER BY completed_at DESC LIMIT 50" @@ -241,26 +244,31 @@ async def create_task_form( @router.post("/tasks/{task_id}/approve", response_class=HTMLResponse) async def approve_task(request: Request, task_id: str): + """Approve a pending task and move it to active queue.""" return await _set_status(request, task_id, "approved") @router.post("/tasks/{task_id}/veto", response_class=HTMLResponse) async def veto_task(request: Request, task_id: str): + """Veto a task, marking it as rejected.""" return await _set_status(request, task_id, "vetoed") @router.post("/tasks/{task_id}/pause", response_class=HTMLResponse) async def pause_task(request: Request, task_id: str): + """Pause a running or approved task.""" return await _set_status(request, task_id, "paused") @router.post("/tasks/{task_id}/cancel", response_class=HTMLResponse) async def cancel_task(request: Request, task_id: str): + """Cancel a task (marks as vetoed).""" return await _set_status(request, task_id, "vetoed") @router.post("/tasks/{task_id}/retry", response_class=HTMLResponse) async def retry_task(request: Request, task_id: str): + """Retry a failed/vetoed task by moving it back to approved.""" return await _set_status(request, task_id, "approved") @@ -271,6 +279,7 @@ async def modify_task( title: str = Form(...), description: str = Form(""), ): + """Update task title and description.""" with _get_db() as db: db.execute( "UPDATE tasks SET title=?, description=? WHERE id=?", -- 2.43.0