refactor(merge): single IMergeCoordinator replaces the 5 conflict seams
The RequestConflictResolution Func was declared on 5 VMs and hand-threaded shell->details->merge-section->diff->merge-modal. Replaced with a DI-singleton IMergeCoordinator (MergeCoordinator holder; shell wires its Handler at composition, breaking the shell<->island cycle). Invokers (MergeModal, DetailsIsland, WorktreesOverview) depend on the interface; the two pass-through VMs (DiffModal, MergeSection) drop the seam entirely. No behavior change; conflict-seam + batch tests rewired to assert via the coordinator.
This commit is contained in:
@@ -30,8 +30,9 @@ public class WorktreesOverviewBatchMergeTests
|
||||
Assert.False(row.IsConflict);
|
||||
}
|
||||
|
||||
private static WorktreesOverviewModalViewModel NewVm() =>
|
||||
new(new ClaudeDo.Ui.Services.WorkerClient("http://127.0.0.1:1/hub"), () => null!);
|
||||
private static WorktreesOverviewModalViewModel NewVm(IMergeCoordinator? merge = null) =>
|
||||
new(new ClaudeDo.Ui.Services.WorkerClient("http://127.0.0.1:1/hub"), () => null!,
|
||||
merge ?? new ClaudeDo.Ui.Services.MergeCoordinator());
|
||||
|
||||
private static MergeResultDto Merged() => new("merged", System.Array.Empty<string>(), null);
|
||||
private static MergeResultDto Conflict() => new("conflict", new[] { "f.cs" }, null);
|
||||
@@ -137,13 +138,15 @@ public class WorktreesOverviewBatchMergeTests
|
||||
[Fact]
|
||||
public void ResolveConflict_invokes_seam_with_task_and_target()
|
||||
{
|
||||
var vm = NewVm();
|
||||
(string Task, string Target)? captured = null;
|
||||
var coordinator = new ClaudeDo.Ui.Services.MergeCoordinator
|
||||
{
|
||||
Handler = (taskId, target) => { captured = (taskId, target); return System.Threading.Tasks.Task.CompletedTask; },
|
||||
};
|
||||
var vm = NewVm(coordinator);
|
||||
vm.SelectedTarget = "release";
|
||||
var row = ActiveRow("x"); row.MergeOutcome = BatchMergeOutcome.Conflict;
|
||||
|
||||
(string Task, string Target)? captured = null;
|
||||
vm.RequestConflictResolution = (taskId, target) => { captured = (taskId, target); return System.Threading.Tasks.Task.CompletedTask; };
|
||||
|
||||
vm.ResolveConflictCommand.Execute(row);
|
||||
|
||||
Assert.Equal(("x", "release"), captured);
|
||||
|
||||
Reference in New Issue
Block a user