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:
@@ -7,38 +7,42 @@ namespace ClaudeDo.Worker.Tests.UiVm;
|
||||
|
||||
public class TaskRowViewModelPlanningTests
|
||||
{
|
||||
private static TaskRowViewModel MakeRow(TaskStatus status, string? parentTaskId = null)
|
||||
=> new TaskRowViewModel { Id = "t", Status = status, ParentTaskId = parentTaskId };
|
||||
private static TaskRowViewModel MakeRow(
|
||||
TaskStatus status,
|
||||
string? parentTaskId = null,
|
||||
PlanningPhase phase = PlanningPhase.None)
|
||||
=> new TaskRowViewModel { Id = "t", Status = status, ParentTaskId = parentTaskId, PlanningPhase = phase };
|
||||
|
||||
[Fact]
|
||||
public void Draft_Status_SetsIsChildFlag_WhenParentIdIsNotNull()
|
||||
public void IdleChild_IsDraft_WhenParentIdIsNotNull()
|
||||
{
|
||||
var vm = MakeRow(TaskStatus.Draft, "parent-id");
|
||||
var vm = MakeRow(TaskStatus.Idle, parentTaskId: "parent-id");
|
||||
Assert.True(vm.IsChild);
|
||||
Assert.True(vm.IsDraft);
|
||||
Assert.False(vm.IsPlanningParent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Planning_Status_SetsIsPlanningParent()
|
||||
public void ActivePlanning_SetsIsPlanningParent()
|
||||
{
|
||||
var vm = MakeRow(TaskStatus.Planning);
|
||||
var vm = MakeRow(TaskStatus.Idle, phase: PlanningPhase.Active);
|
||||
Assert.True(vm.IsPlanningParent);
|
||||
Assert.False(vm.IsChild);
|
||||
Assert.Equal("PLANNING", vm.PlanningBadge);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Planned_Status_ShowsPlannedBadge()
|
||||
public void FinalizedPlanning_ShowsPlannedBadge()
|
||||
{
|
||||
var vm = MakeRow(TaskStatus.Planned);
|
||||
var vm = MakeRow(TaskStatus.Idle, phase: PlanningPhase.Finalized);
|
||||
Assert.True(vm.IsPlanningParent);
|
||||
Assert.Equal("PLANNED", vm.PlanningBadge);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonPlanningStatus_NoBadge()
|
||||
public void PlainIdle_NoBadge()
|
||||
{
|
||||
var vm = MakeRow(TaskStatus.Manual);
|
||||
var vm = MakeRow(TaskStatus.Idle);
|
||||
Assert.False(vm.IsPlanningParent);
|
||||
Assert.Null(vm.PlanningBadge);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user