fix(worker): block approve of a planning parent with an unfinished child, surface git stderr on ff failure
This commit is contained in:
@@ -1013,6 +1013,20 @@ public sealed class TaskMergeService
|
||||
if (task.Status != TaskStatus.WaitingForReview)
|
||||
return Blocked("task is not waiting for review");
|
||||
|
||||
// A plan lands whole or not at all -- same rule (and message) as PlanningMergeOrchestrator.StartAsync,
|
||||
// which a unit-branch parent no longer passes through.
|
||||
if (task.PlanningPhase != PlanningPhase.None)
|
||||
{
|
||||
using var ctx = _dbFactory.CreateDbContext();
|
||||
var notDone = await ctx.Tasks.AsNoTracking()
|
||||
.Where(c => c.ParentTaskId == taskId && c.Status != TaskStatus.Done)
|
||||
.OrderBy(c => c.SortOrder)
|
||||
.Select(c => new { c.Id, c.Status })
|
||||
.FirstOrDefaultAsync(ct);
|
||||
if (notDone is not null)
|
||||
return Blocked($"subtask {notDone.Id} is not Done (status {notDone.Status})");
|
||||
}
|
||||
|
||||
// An interactive child of a unit lands in the unit branch, not on the target; the parent's
|
||||
// own approve merges the unit. A failed fast-forward keeps the child in review.
|
||||
if (task.ParentTaskId is not null && _unitBranch is not null)
|
||||
|
||||
Reference in New Issue
Block a user