fix(merge): conventional merge-commit default and live verify progress
The merge commit message was hand-rolled per caller ("Merge task: <title>",
"Merge <branch>", "Merge subtask") and ignored the task's commit type. Every
caller now passes a blank message and TaskMergeService fills in
CommitMessageBuilder.BuildMerge -> {commitType}(list-slug): merge <title> plus the
ClaudeDo-Task trailer; the merge modal prefills it from GetMergeTargets.
A merge whose list has a verify command holds the MergeTask call for minutes (5m46s
on this repo), during which the modal only disabled its button - no spinner, no
message, so a landed merge looked like a dead app. TaskMergeService now broadcasts
MergeProgress(taskId, phase, elapsedSeconds) for the merging and verifying phases
(re-reported every 30s) plus a WorkerLog line when verify starts; the modal shows a
spinner and the localized phase.
This commit is contained in:
@@ -21,6 +21,12 @@ public sealed partial class MergeModalViewModel : ViewModelBase
|
||||
[ObservableProperty] private string _commitMessage = "";
|
||||
|
||||
[ObservableProperty][NotifyCanExecuteChangedFor(nameof(SubmitCommand))] private bool _isBusy;
|
||||
|
||||
/// What the pending merge is doing right now, fed by the worker's MergeProgress broadcast.
|
||||
/// A merge whose list has a verify command can occupy this call for minutes — without this the
|
||||
/// modal only greys the button out and looks dead.
|
||||
[ObservableProperty] private string? _progressMessage;
|
||||
|
||||
[ObservableProperty] private string? _errorMessage;
|
||||
[ObservableProperty] private string? _warningMessage;
|
||||
[ObservableProperty] private string? _successMessage;
|
||||
@@ -58,6 +64,10 @@ public sealed partial class MergeModalViewModel : ViewModelBase
|
||||
ErrorMessage = Loc.T("vm.merge.workerOfflineBranches");
|
||||
return;
|
||||
}
|
||||
// The worker owns the default message — only it knows the task's commit type and the
|
||||
// list name the scope is slugged from. The locale string stays as the offline fallback.
|
||||
if (!string.IsNullOrWhiteSpace(targets.DefaultCommitMessage))
|
||||
CommitMessage = targets.DefaultCommitMessage;
|
||||
foreach (var b in targets.LocalBranches) Branches.Add(b);
|
||||
SelectedBranch = Branches.Contains(targets.DefaultBranch)
|
||||
? targets.DefaultBranch
|
||||
@@ -81,6 +91,10 @@ public sealed partial class MergeModalViewModel : ViewModelBase
|
||||
ErrorMessage = null;
|
||||
WarningMessage = null;
|
||||
SuccessMessage = null;
|
||||
// Subscribed only for the duration of the call: the worker's broadcast reaches every
|
||||
// client, and a transient VM left on that event would outlive its window.
|
||||
ProgressMessage = Loc.T("vm.merge.progressMerging");
|
||||
_worker.MergeProgressEvent += OnMergeProgress;
|
||||
try
|
||||
{
|
||||
var result = await _worker.MergeTaskAsync(
|
||||
@@ -133,10 +147,28 @@ public sealed partial class MergeModalViewModel : ViewModelBase
|
||||
}
|
||||
finally
|
||||
{
|
||||
_worker.MergeProgressEvent -= OnMergeProgress;
|
||||
ProgressMessage = null;
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMergeProgress(string taskId, string phase, int elapsedSeconds)
|
||||
{
|
||||
if (taskId != TaskId) return;
|
||||
ProgressMessage = phase switch
|
||||
{
|
||||
MergePhaseVerifying => Loc.T("vm.merge.progressVerifying", FormatElapsed(elapsedSeconds)),
|
||||
_ => Loc.T("vm.merge.progressMerging"),
|
||||
};
|
||||
}
|
||||
|
||||
/// Mirrors TaskMergeService.PhaseVerifying — a hub payload token, not a display string.
|
||||
private const string MergePhaseVerifying = "verifying";
|
||||
|
||||
private static string FormatElapsed(int seconds) =>
|
||||
TimeSpan.FromSeconds(Math.Max(0, seconds)).ToString(@"mm\:ss");
|
||||
|
||||
[RelayCommand]
|
||||
private void Cancel() => CloseAction?.Invoke();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user