3.5 KiB
3.5 KiB
Plan — Unify the parent-task model
Spec: docs/superpowers/specs/2026-06-09-unify-parent-task-model-design.md
Subagents: sonnet. Stage files explicitly by path (never git add -A). TDD.
Build with -c Release per project. Commit per task (Conventional Commits).
Task 1 — Single parent-advance path
- Rename
TaskStateService.TryAdvanceImprovementParentAsync→TryAdvanceParentAsync. - Make it advance any
WaitingForChildrenparent →WaitingForReviewwhen all children are terminal, and advance a parent with zero children straight toWaitingForReview. - In
OnChildTerminalAsync: drop theTryCompleteParentAsynccall; keep_chain.OnChildFinishedAsync; call the renamed advance method for all parents. - Tests: extend
WaitingForChildrenLifecycleTests— (a) improvement parent still advances; (b) aWaitingForChildrenparent whose children are a sequential chain advances only after the last one is terminal; (c) zero-children parent advances.
Task 2 — Delete TryCompleteParentAsync
- Remove
TaskRepository.TryCompleteParentAsync(TaskRepository.cs:477-502) and any remaining references. - Update
src/ClaudeDo.Data/CLAUDE.md(drop it from the TaskRepository helper list). - Build Data + Worker; fix references.
Task 3 — Planning finalize enters WaitingForChildren
TaskStateService.FinalizePlanningAsync: in the sameExecuteUpdateAsync, setStatus = WaitingForChildrenalongsidePlanningPhase = Finalized/PlanningFinalizedAt.- Verify
PlanningSessionManager.FinalizeAsyncordering: finalize (→ WaitingForChildren) beforeSetupChainAsyncenqueues child[0]. Adjust only if ordering is wrong. - Tests: finalizing a planning parent with N children leaves it
WaitingForChildren; after the chain completes it isWaitingForReview(notDone); a planning parent with zero finalized children lands inWaitingForReview.
Task 4 — Approve merges the whole unit
WorkerHub.ApproveReview(+ MCPReviewTaskapprove): if the task has children, invokePlanningMergeOrchestrator(parent worktree ifActive+ eachDonechild in order) then transition parent →Done; on child conflict keepWaitingForReviewand surface the conflicting child. If no children, keep the existingTaskMergeService.ApproveAndMergeAsyncpath.- Retire
WorkerHub.MergeAllPlanning+ its UI button/command and any now-dead orchestrator entry that onlyMergeAllPlanningused (keep the orchestrator itself). - Sync test fakes for
IWorkerClient/WorkerHubif signatures changed. - Tests: approving a parent with two
Donechildren merges both then setsDone; a conflicting second child keeps the parent inWaitingForReview.
Task 5 — Cancellable WaitingForChildren parent
- Add
TaskStatus.WaitingForChildrento theCancelAsyncguard. - Test: a parent in
WaitingForChildrencan be cancelled.
Task 6 — Docs
src/ClaudeDo.Worker/CLAUDE.md: addWaitingForChildrento the Status table + transition diagram; document the unified parent flow and approve-merges-unit; removeMergeAllPlanningfrom the Hub method list.src/ClaudeDo.Data/CLAUDE.md: addWaitingForChildrento the TaskEntity status list.- Root
CLAUDE.md: update the "Task status flow" convention line.
Verify
dotnet testfor Worker.Tests + Data.Tests (-c Release).- UI flows (planning finalize → review → approve-merge; improvement parent; retired MergeAllPlanning button) are visual-verification gaps — flag for the user to run the app; do not claim they work from tests alone.