refactor(data): retire legacy TaskStatus values and backfill existing rows

Slice 6 of the worker state and queue consolidation refactor.

* Drop Manual, Planning, Planned, Draft, Waiting from the TaskStatus enum
  and from the EF value converter; only the lifecycle values remain
  (Idle, Queued, Running, Done, Failed, Cancelled).
* Add migration RetireLegacyTaskStatus that rewrites existing rows:
  manual/draft -> idle, planning -> idle+planning_phase=active,
  planned -> idle+planning_phase=finalized, waiting -> queued+blocked_by
  derived from sort_order via a CTE with LAG().
* Reroute every call site that compared/set legacy values to the new
  three-field model (Status + PlanningPhase + BlockedByTaskId), including
  the planning repo helpers, MCP services, the planning chain coordinator,
  and the UI view-models. TaskRowViewModel now exposes PlanningPhase to
  drive the planning badge.
* Refresh Worker/CLAUDE.md and Data/CLAUDE.md, the docs/plan.md status
  section, and the planning verification notes in docs/open.md.
This commit is contained in:
Mika Kuns
2026-04-27 15:28:55 +02:00
parent ff7c239959
commit dc3fc443b4
37 changed files with 306 additions and 229 deletions

View File

@@ -101,7 +101,7 @@ public sealed class PlanningMergeOrchestratorTests : IDisposable
ctx.Tasks.Add(new TaskEntity
{
Id = parentId, ListId = listId, Title = "plan", CreatedAt = DateTime.UtcNow,
Status = TaskStatus.Planned, SortOrder = 0,
Status = TaskStatus.Idle, PlanningPhase = PlanningPhase.Finalized, SortOrder = 0,
});
var subA = Guid.NewGuid().ToString();
@@ -169,7 +169,7 @@ public sealed class PlanningMergeOrchestratorTests : IDisposable
ctx.Tasks.Add(new TaskEntity
{
Id = parentId, ListId = listId, Title = "plan", CreatedAt = DateTime.UtcNow,
Status = TaskStatus.Planned, SortOrder = 0,
Status = TaskStatus.Idle, PlanningPhase = PlanningPhase.Finalized, SortOrder = 0,
});
var subA = Guid.NewGuid().ToString();
var subB = Guid.NewGuid().ToString();
@@ -232,7 +232,7 @@ public sealed class PlanningMergeOrchestratorTests : IDisposable
using var ctx = db.CreateContext();
// Planning stays in Planned — NOT flipped to Done.
Assert.Equal(TaskStatus.Planned, ctx.Tasks.Single(t => t.Id == parentId).Status);
Assert.Equal(PlanningPhase.Finalized, ctx.Tasks.Single(t => t.Id == parentId).PlanningPhase);
// Earlier successful merge stays merged.
Assert.Equal(WorktreeState.Merged, ctx.Worktrees.Single(w => w.TaskId == subA).State);
// Conflicted subtask's worktree stays Active (abort doesn't flip it).
@@ -280,7 +280,7 @@ public sealed class PlanningMergeOrchestratorTests : IDisposable
Assert.Contains(runningSub, ex.Message);
using var ctx = db.CreateContext();
Assert.Equal(TaskStatus.Planned, ctx.Tasks.Single(t => t.Id == parentId).Status);
Assert.Equal(PlanningPhase.Finalized, ctx.Tasks.Single(t => t.Id == parentId).PlanningPhase);
Assert.Empty(spy);
}
@@ -337,7 +337,7 @@ public sealed class PlanningMergeOrchestratorTests : IDisposable
ctx.Tasks.Add(new TaskEntity
{
Id = parentId, ListId = listId, Title = "plan", CreatedAt = DateTime.UtcNow,
Status = TaskStatus.Planned, SortOrder = 0,
Status = TaskStatus.Idle, PlanningPhase = PlanningPhase.Finalized, SortOrder = 0,
});
var running = Guid.NewGuid().ToString();
ctx.Tasks.Add(new TaskEntity