test(FN-4564): complete Step 3 — add self-healing rebound coverage

Fusion-Task-Id: FN-4564
Fusion-Task-Lineage: 1a0c186a-1eb1-496a-aa8d-1bdf2254bb20
This commit is contained in:
Fusion
2026-05-14 23:11:35 -07:00
committed by gsxdsm
parent 75bebda873
commit c11389a75e

View File

@@ -70,6 +70,38 @@ describe("reliability interactions: self-healing", () => {
expect(recovered).toBe(0);
});
it.each([
"Refusing to start coding agent in incomplete worktree: /tmp/wt",
"Refusing to start coding agent in unregistered git worktree: /tmp/wt",
])("recoverMissingWorktreeReviewFailures rebounds review tasks for '%s'", async (error) => {
const taskId = "WT";
const tasks = new Map<string, Task>([[
taskId,
makeTask(taskId, {
column: "in-review",
paused: false,
status: "failed",
error,
worktree: "/tmp/wt",
branch: "fusion/wt",
steps: [{ id: "s1", title: "Step", status: "done" }] as any,
}),
]]);
const store = makeStore(tasks);
const mgr = new SelfHealingManager(store, { rootDir: process.cwd(), getExecutingTaskIds: () => new Set() });
const recovered = await mgr.recoverMissingWorktreeReviewFailures();
expect(recovered).toBe(1);
expect(tasks.get(taskId)?.column).toBe("todo");
expect(tasks.get(taskId)?.worktree ?? null).toBeNull();
expect(tasks.get(taskId)?.branch ?? null).toBeNull();
expect(store.logEntry).toHaveBeenCalledWith(
taskId,
expect.stringContaining("Auto-recovered: retry/verification session targeted missing worktree"),
);
});
it.skipIf(!hasGit)("recoverAlreadyMergedReviewTasks can still finalize from real git state", async () => {
const fx = await makeReliabilityFixture({ taskId: "FN-4361-SH-GIT" });
fixtures.push(fx);