fix(worker): block approve of a planning parent with an unfinished child, surface git stderr on ff failure

This commit is contained in:
mika kuns
2026-10-01 11:36:45 +02:00
parent a353897345
commit acd188bca9
5 changed files with 40 additions and 3 deletions
@@ -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)