feat(worker): approve a unit parent like a single task, orchestrator only for legacy units

This commit is contained in:
mika kuns
2026-10-01 11:25:48 +02:00
parent 9da522b0c9
commit 1f373a5a67
3 changed files with 26 additions and 11 deletions
+5 -3
View File
@@ -697,11 +697,13 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
public Task<MergeResultDto> ApproveReview(string taskId, string targetBranch, bool autostash = false)
=> HubGuard(async () =>
{
bool hasChildren;
// Children already absorbed into the parent's unit branch need no unit merge -- the parent
// merges like a single task. Only legacy units (a Done child still Active) take the orchestrator.
bool legacyUnit;
await using (var ctx = await _dbFactory.CreateDbContextAsync(CancellationToken.None))
hasChildren = await ctx.Tasks.AnyAsync(t => t.ParentTaskId == taskId, CancellationToken.None);
legacyUnit = await UnitBranchService.HasUnabsorbedChildrenAsync(ctx, taskId, CancellationToken.None);
if (hasChildren)
if (legacyUnit)
{
var unitResult = await _planningMergeOrchestrator.StartAsync(taskId, targetBranch ?? "", CancellationToken.None);
if (unitResult.Status == TaskMergeService.StatusBlocked)