test(FN-4410): complete Step 4 — cross-task escalation coverage
Fusion-Task-Id: FN-4410 Fusion-Task-Lineage: 306d4fe0-d024-49dd-86b4-fb98d4ceff59
This commit is contained in:
@@ -5751,6 +5751,26 @@ describe("SelfHealingManager reclaimSelfOwnedBranchConflicts", () => {
|
||||
expect(store.listTasks).toHaveBeenNthCalledWith(2, { column: "in-progress", slim: true });
|
||||
});
|
||||
|
||||
it("escalates live-foreign conflicts to in-review failed", async () => {
|
||||
(store.listTasks as any)
|
||||
.mockResolvedValueOnce([{ id: "FN-503", checkedOutBy: null, branch: "fusion/fn-503", worktree: "/tmp/fn-503" }])
|
||||
.mockResolvedValueOnce([]);
|
||||
vi.spyOn(branchConflictModule, "inspectBranchConflict").mockResolvedValueOnce({
|
||||
kind: "live-foreign",
|
||||
livePath: "/tmp/fn-503",
|
||||
error: new Error("foreign branch owner"),
|
||||
} as any);
|
||||
|
||||
const recovered = await manager.reclaimSelfOwnedBranchConflicts();
|
||||
expect(recovered).toBe(0);
|
||||
expect(store.updateTask).toHaveBeenCalledWith("FN-503", expect.objectContaining({
|
||||
status: "failed",
|
||||
paused: true,
|
||||
pausedReason: "branch-conflict-unrecoverable",
|
||||
}));
|
||||
expect(store.moveTask).toHaveBeenCalledWith("FN-503", "in-review");
|
||||
});
|
||||
|
||||
it("escalates unrecoverable reclaim failures to in-review failed", async () => {
|
||||
(store.listTasks as any)
|
||||
.mockResolvedValueOnce([{ id: "FN-502", checkedOutBy: null, branch: "fusion/fn-502", worktree: "/tmp/fn-502" }])
|
||||
|
||||
@@ -1347,7 +1347,13 @@ export class SelfHealingManager {
|
||||
startPoint: task.baseCommitSha ?? task.mergeDetails?.mergeTargetBranch ?? "main",
|
||||
});
|
||||
|
||||
if (inspection.kind !== "reclaimable" || inspection.taskAttributedCommitCount <= 0) {
|
||||
if (inspection.kind === "stale" || inspection.kind === "stale-resolved") {
|
||||
continue;
|
||||
}
|
||||
if (inspection.kind === "live-foreign") {
|
||||
throw inspection.error;
|
||||
}
|
||||
if (inspection.taskAttributedCommitCount <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user