feat(worker): approve a unit parent like a single task, orchestrator only for legacy units
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user