mirror of
https://github.com/coleam00/Archon.git
synced 2026-01-11 17:16:57 -05:00
fix: include_archived flag now works correctly in task listing
- Add include_archived parameter to TaskService.list_tasks() - Service now conditionally applies archived filter based on parameter - Add 'archived' field to task DTO for client visibility - Update API endpoints to pass include_archived down to service - Remove redundant client-side filtering in API layer - Fix type hints in integration tests (dict[str, Any] | None) - Use pytest.skip() instead of return for proper test reporting These fixes address the functional bug identified by CodeRabbit where archived tasks couldn't be retrieved even when explicitly requested.
This commit is contained in:
@@ -190,7 +190,8 @@ class TaskService:
|
||||
project_id: str = None,
|
||||
status: str = None,
|
||||
include_closed: bool = False,
|
||||
exclude_large_fields: bool = False
|
||||
exclude_large_fields: bool = False,
|
||||
include_archived: bool = False
|
||||
) -> tuple[bool, dict[str, Any]]:
|
||||
"""
|
||||
List tasks with various filters.
|
||||
@@ -200,6 +201,7 @@ class TaskService:
|
||||
status: Filter by status
|
||||
include_closed: Include done tasks
|
||||
exclude_large_fields: If True, excludes sources and code_examples fields
|
||||
include_archived: If True, includes archived tasks
|
||||
|
||||
Returns:
|
||||
Tuple of (success, result_dict)
|
||||
@@ -239,9 +241,12 @@ class TaskService:
|
||||
query = query.neq("status", "done")
|
||||
filters_applied.append("exclude done tasks")
|
||||
|
||||
# Filter out archived tasks using is null or is false
|
||||
query = query.or_("archived.is.null,archived.is.false")
|
||||
filters_applied.append("exclude archived tasks (null or false)")
|
||||
# Filter out archived tasks only if not including them
|
||||
if not include_archived:
|
||||
query = query.or_("archived.is.null,archived.is.false")
|
||||
filters_applied.append("exclude archived tasks (null or false)")
|
||||
else:
|
||||
filters_applied.append("include all tasks (including archived)")
|
||||
|
||||
logger.info(f"Listing tasks with filters: {', '.join(filters_applied)}")
|
||||
|
||||
@@ -295,6 +300,7 @@ class TaskService:
|
||||
"feature": task.get("feature"),
|
||||
"created_at": task["created_at"],
|
||||
"updated_at": task["updated_at"],
|
||||
"archived": task.get("archived", False),
|
||||
}
|
||||
|
||||
if not exclude_large_fields:
|
||||
|
||||
Reference in New Issue
Block a user