feat(worker): surface rebase and worktree-maintenance progress on OperationProgress

RebaseOthersAfterMergeAsync now broadcasts a "rebasing" phase with i/n over the
WaitingForReview branches it checks, so the merge/continue_merge callers stop
showing the stalled "Merging…" phase while the best-effort rebase loop runs
(rebase still runs before the verify gate; a failed rebase still leaves the
merge itself successful). WorktreeMaintenanceService gained an optional
HubBroadcaster to report the same i/n shape per worktree during
cleanup/reset, with no new UI surface (deliberately out of scope). Both
review-action viewmodels now also listen on OperationProgressEvent (which
carries the total that the elapsed-seconds-only MergeProgressEvent drops) to
render "Rebasing other worktrees… (i/n)".
This commit is contained in:
mika kuns
2026-08-21 13:33:02 +02:00
parent dcda067b48
commit 42de97e16a
8 changed files with 183 additions and 9 deletions
@@ -64,6 +64,7 @@ public sealed class TaskMergeService
// Phase tokens for the OperationProgress broadcast — stable identifiers, localized by the UI.
public const string PhaseMerging = "merging";
public const string PhaseVerifying = "verifying";
public const string PhaseRebasing = "rebasing";
public const string PreviewClean = "clean";
public const string PreviewConflict = "conflict";
@@ -296,9 +297,15 @@ public sealed class TaskMergeService
var tasks = await new TaskRepository(ctx).GetByListIdAsync(list.Id, ct);
candidates = tasks.Where(t => t.Id != mergedTask.Id && t.Status == TaskStatus.WaitingForReview).ToList();
}
if (candidates.Count == 0) return;
foreach (var candidate in candidates)
await RebaseOneIfOverlappingAsync(candidate, targetBranch, newTargetTip, landedFiles, ct);
// Runs where the stalled "Merging…" phase would otherwise sit unchanged in the UI while
// this loop does real (if best-effort) work — see the correction note in the task spec.
for (var i = 0; i < candidates.Count; i++)
{
await _broadcaster.OperationProgress(mergedTask.Id, PhaseRebasing, i + 1, candidates.Count);
await RebaseOneIfOverlappingAsync(candidates[i], targetBranch, newTargetTip, landedFiles, ct);
}
}
private async Task RebaseOneIfOverlappingAsync(