feat(data): add Idle/Cancelled status, PlanningPhase enum, BlockedByTaskId field

Slice 1 of the worker-state-and-queue-consolidation refactor — additive only,
no caller changes. Introduces the new orthogonal status model:

- TaskStatus gains canonical Idle and Cancelled values; legacy values
  (Manual, Planning, Planned, Draft, Waiting) stay around until slice 6.
- New PlanningPhase enum (None/Active/Finalized) for parent tasks.
- New BlockedByTaskId FK on TaskEntity for sequential chain ordering;
  ON DELETE SET NULL so orphaned children become pickable.
- EF migration adds planning_phase and blocked_by_task_id columns plus
  the idx_tasks_blocked_by index. Also picks up an unrelated drift in
  app_settings.default_permission_mode that had been changed in code
  (commit 14cc9fb) without a migration.
This commit is contained in:
Mika Kuns
2026-04-27 10:25:53 +02:00
parent 43af17e546
commit 7b737e6717
4 changed files with 174 additions and 22 deletions

View File

@@ -2,17 +2,31 @@ namespace ClaudeDo.Data.Models;
public enum TaskStatus
{
Manual,
// Lifecycle (canonical values).
Idle,
Queued,
Running,
Done,
Failed,
Cancelled,
// Legacy values — kept for backwards compatibility while the worker
// layer is migrated to (Status, PlanningPhase, BlockedByTaskId).
// Removed in slice 6 of the worker-state-and-queue-consolidation refactor.
Manual,
Planning,
Planned,
Draft,
Waiting,
}
public enum PlanningPhase
{
None,
Active,
Finalized,
}
public sealed class TaskEntity
{
public required string Id { get; init; }
@@ -20,6 +34,8 @@ public sealed class TaskEntity
public required string Title { get; set; }
public string? Description { get; set; }
public TaskStatus Status { get; set; } = TaskStatus.Manual;
public PlanningPhase PlanningPhase { get; set; } = PlanningPhase.None;
public string? BlockedByTaskId { get; set; }
public DateTime? ScheduledFor { get; set; }
public string? Result { get; set; }
public string? LogPath { get; set; }