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:
@@ -96,15 +96,20 @@ file static class VmFactory
|
||||
|
||||
public class TasksIslandViewModelPlanningTests
|
||||
{
|
||||
private static TaskRowViewModel MakeRow(string id, TaskStatus status, string? parentId = null, int sortOrder = 0)
|
||||
=> new TaskRowViewModel { Id = id, Status = status, ParentTaskId = parentId };
|
||||
private static TaskRowViewModel MakeRow(
|
||||
string id,
|
||||
TaskStatus status,
|
||||
string? parentId = null,
|
||||
int sortOrder = 0,
|
||||
PlanningPhase phase = PlanningPhase.None)
|
||||
=> new TaskRowViewModel { Id = id, Status = status, ParentTaskId = parentId, PlanningPhase = phase };
|
||||
|
||||
[Fact]
|
||||
public void ToggleExpand_CollapsesChildrenOfPlanningParent()
|
||||
{
|
||||
var parent = MakeRow("p1", TaskStatus.Planning);
|
||||
var child1 = MakeRow("c1", TaskStatus.Draft, "p1");
|
||||
var child2 = MakeRow("c2", TaskStatus.Draft, "p1");
|
||||
var parent = MakeRow("p1", TaskStatus.Idle, phase: PlanningPhase.Active);
|
||||
var child1 = MakeRow("c1", TaskStatus.Idle, "p1");
|
||||
var child2 = MakeRow("c2", TaskStatus.Idle, "p1");
|
||||
|
||||
var (vm, _) = VmFactory.Create([parent, child1, child2]);
|
||||
|
||||
@@ -123,7 +128,7 @@ public class TasksIslandViewModelPlanningTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task OpenPlanningSession_IgnoresNonManualRow()
|
||||
public async Task OpenPlanningSession_IgnoresNonIdleRow()
|
||||
{
|
||||
var row = MakeRow("t1", TaskStatus.Queued);
|
||||
var (vm, worker) = VmFactory.Create([row]);
|
||||
@@ -134,9 +139,9 @@ public class TasksIslandViewModelPlanningTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task OpenPlanningSession_CallsWorkerForManualRow()
|
||||
public async Task OpenPlanningSession_CallsWorkerForIdleRow()
|
||||
{
|
||||
var row = MakeRow("t1", TaskStatus.Manual);
|
||||
var row = MakeRow("t1", TaskStatus.Idle);
|
||||
var (vm, worker) = VmFactory.Create([row]);
|
||||
|
||||
await ((IAsyncRelayCommand<TaskRowViewModel?>)vm.OpenPlanningSessionCommand).ExecuteAsync(row);
|
||||
@@ -147,8 +152,8 @@ public class TasksIslandViewModelPlanningTests
|
||||
[Fact]
|
||||
public void ToggleExpand_ExpandsCollapsedParentAgain()
|
||||
{
|
||||
var parent = MakeRow("p1", TaskStatus.Planned);
|
||||
var child = MakeRow("c1", TaskStatus.Draft, "p1");
|
||||
var parent = MakeRow("p1", TaskStatus.Idle, phase: PlanningPhase.Finalized);
|
||||
var child = MakeRow("c1", TaskStatus.Idle, "p1");
|
||||
|
||||
var (vm, _) = VmFactory.Create([parent, child]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user