Files
odysseus/tests/test_task_session_folder.py
T
danielroytel 5d3e3c7053 feat(tasks): assign folder='Tasks' at creation + backfill migration (#2834)
* feat: assign folder='Tasks' to task sessions at creation

Task sessions (LLM, action, research) now set folder='Tasks' on their
DbSession row, matching the pattern used by the Assistant folder. This
enables sidebar lens filtering without changing existing session
behaviour.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add backfill script for task session folders

One-shot script to set folder='Tasks' on existing [Task]/[Research]
sessions that predate the folder assignment in task_scheduler.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: replace standalone backfill script with automatic migration

Convert scripts/backfill_task_folders.py into _migrate_backfill_task_folders()
in core/database.py, called from init_db(). The migration is idempotent (only
touches rows where folder IS NULL/empty) and runs automatically on upgrade,
so operators no longer need a manual step to tag pre-existing task sessions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-07 15:33:17 +02:00

28 lines
1.1 KiB
Python

"""Task sessions must be assigned folder='Tasks' at creation time."""
import inspect
from src.task_scheduler import TaskScheduler
def test_llm_task_session_gets_tasks_folder():
"""_execute_llm_task must create sessions with folder='Tasks'."""
source = inspect.getsource(TaskScheduler._execute_llm_task)
assert 'folder="Tasks"' in source or "folder='Tasks'" in source, (
"LLM task session creation must set folder='Tasks'"
)
def test_action_task_session_gets_tasks_folder():
"""_deliver_task_result must create sessions with folder='Tasks'."""
source = inspect.getsource(TaskScheduler._deliver_task_result)
assert 'folder="Tasks"' in source or "folder='Tasks'" in source, (
"Action task session delivery must set folder='Tasks'"
)
def test_research_task_session_gets_tasks_folder():
"""_execute_research_task must create sessions with folder='Tasks'."""
source = inspect.getsource(TaskScheduler._execute_research_task)
assert 'folder="Tasks"' in source or "folder='Tasks'" in source, (
"Research task session creation must set folder='Tasks'"
)