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:
29
src/ClaudeDo.Ui/Services/IMergeCoordinator.cs
Normal file
29
src/ClaudeDo.Ui/Services/IMergeCoordinator.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ClaudeDo.Ui.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Single entry point for handing a conflicting merge to the in-app 3-pane resolver.
|
||||
/// Replaces the per-VM <c>RequestConflictResolution</c> Func seams that used to be
|
||||
/// hand-threaded shell → details → merge-section → diff → merge-modal. The shell wires
|
||||
/// <see cref="MergeCoordinator.Handler"/> once at composition; invokers depend only on
|
||||
/// this interface (injected via DI).
|
||||
/// </summary>
|
||||
public interface IMergeCoordinator
|
||||
{
|
||||
Task ResolveConflictAsync(string taskId, string targetBranch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DI singleton holding the resolver entry. The holder breaks the shell↔island construction
|
||||
/// cycle: islands depend on the interface, the shell sets <see cref="Handler"/> after it is built.
|
||||
/// </summary>
|
||||
public sealed class MergeCoordinator : IMergeCoordinator
|
||||
{
|
||||
/// Set once at composition to the shell's resolver entry. Null (headless/tests) ⇒ no-op.
|
||||
public Func<string, string, Task>? Handler { get; set; }
|
||||
|
||||
public Task ResolveConflictAsync(string taskId, string targetBranch) =>
|
||||
Handler?.Invoke(taskId, targetBranch) ?? Task.CompletedTask;
|
||||
}
|
||||
Reference in New Issue
Block a user