feat(worker): approve drives the unit merge for parents with children
ApproveReview routes a parent that has children through PlanningMergeOrchestrator (merge parent + each Done child, set parent Done, conflict continue/abort) instead of the parent-only ApproveAndMergeAsync. Childless tasks are unchanged. Removes the now-redundant MergeAllPlanning hub method (UI rewiring follows separately). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -441,6 +441,16 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
public Task<MergeResultDto> ApproveReview(string taskId, string targetBranch)
|
||||
=> HubGuard(async () =>
|
||||
{
|
||||
bool hasChildren;
|
||||
await using (var ctx = await _dbFactory.CreateDbContextAsync(CancellationToken.None))
|
||||
hasChildren = await ctx.Tasks.AnyAsync(t => t.ParentTaskId == taskId, CancellationToken.None);
|
||||
|
||||
if (hasChildren)
|
||||
{
|
||||
await _planningMergeOrchestrator.StartAsync(taskId, targetBranch ?? "", CancellationToken.None);
|
||||
return new MergeResultDto(TaskMergeService.StatusMerged, Array.Empty<string>(), null);
|
||||
}
|
||||
|
||||
var r = await _mergeService.ApproveAndMergeAsync(taskId, targetBranch ?? "", CancellationToken.None);
|
||||
if (r.Status == TaskMergeService.StatusBlocked)
|
||||
throw new HubException(r.ErrorMessage ?? "approve failed");
|
||||
@@ -550,10 +560,6 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
};
|
||||
}, "planning task not found");
|
||||
|
||||
public Task MergeAllPlanning(string planningTaskId, string targetBranch)
|
||||
=> HubGuard(() => _planningMergeOrchestrator.StartAsync(planningTaskId, targetBranch ?? "", CancellationToken.None),
|
||||
"planning task not found");
|
||||
|
||||
public async Task ContinuePlanningMerge(string planningTaskId)
|
||||
{
|
||||
try { await _planningMergeOrchestrator.ContinueAsync(planningTaskId, CancellationToken.None); }
|
||||
|
||||
Reference in New Issue
Block a user