Files
automaton/tasks/complete/move-completed-tasks-to-complete-folder/IMPLEMENTATION.md
T

1.7 KiB

IMPLEMENTATION: move-completed-tasks-to-complete-folder

Summary

When --transition complete is called, the task directory is now moved from tasks/<name>/ to tasks/complete/<name>/. The _task_dir function has a fallback to find completed tasks. --list and --audit exclude completed tasks.

Changes

R1 -- _task_dir fallback (scripts/status.py:236-249)

Added a fallback check: if tasks/<name>/ doesn't exist, check tasks/complete/<name>/. This ensures --task <name>, --transition, --approve, and all other commands that call _task_dir still find completed tasks.

R2 -- cmd_transition moves task directory (scripts/status.py:601-610)

After _write_state(task_path, target), if target == "complete", the function:

  1. Computes the tasks root directory (task_path.parent)
  2. Creates tasks/complete/ if it doesn't exist
  3. Renames task_path to tasks/complete/<name>/
  4. Refuses if a completed task with the same name already exists

R3 -- _all_task_dirs unchanged

_all_task_dirs does NOT scan tasks/complete/. Only --task <name> with fallback can find completed tasks.

R4 -- Tests

tests/test_move_completed.py: 9 tests across 3 classes:

  • TestTaskDirFallback (3 tests): regular path, completed fallback, regular preference
  • TestAllTaskDirsExcludesCompleted (1 test): completed tasks excluded from listing
  • TestCompleteMovesDir (5 tests): move, dir creation, create-task refusal, transition refusal, state read after move

R5 -- Documentation

  • CHANGELOG.md: task 9 entry

Verification

  • python3 -m py_compile scripts/status.py -- OK
  • python3 -m pytest tests/test_move_completed.py -v -- 9 passed
  • python3 -m pytest tests/ -q -- 433 passed (424 + 9 new)