test(FN-4962): stabilize recovery test expectations and typing

Fusion-Task-Id: FN-4962
Fusion-Task-Lineage: de4ce54b-c5e4-40f9-a048-677adac3e1a0
This commit is contained in:
Fusion (runfusion.ai)
2026-05-17 15:50:05 -07:00
committed by gsxdsm
parent d5ed2cd2b4
commit 0e4fda59b8
3 changed files with 10 additions and 8 deletions

View File

@@ -44,7 +44,7 @@ describe("reliability interactions: worktree metadata reconcile", () => {
});
it("defers while task is in executingTaskIds (recoverOrphaned/resume interaction)", async () => {
const store = makeStore([task("FN-1", { column: "in-review", worktree: "/missing", branch: null })]);
const store = makeStore([task("FN-1", { column: "in-review", worktree: "/missing", branch: undefined })]);
vi.spyOn(worktreePoolModule, "getRegisteredWorktreeBranchMap").mockResolvedValue(new Map([["fusion/fn-1", "/live"]]));
const manager = new SelfHealingManager(store, {
@@ -58,7 +58,7 @@ describe("reliability interactions: worktree metadata reconcile", () => {
});
it("rebinds exactly once after deferred pass (acquireTaskWorktree interaction)", async () => {
const store = makeStore([task("FN-2", { column: "todo", worktree: "/missing", branch: null })]);
const store = makeStore([task("FN-2", { column: "todo", worktree: "/missing", branch: undefined })]);
vi.spyOn(worktreePoolModule, "getRegisteredWorktreeBranchMap").mockResolvedValue(new Map([["fusion/fn-2", "/live"]]));
let executing = true;
@@ -87,7 +87,7 @@ describe("reliability interactions: worktree metadata reconcile", () => {
});
it("skips done tasks during periodic reconcile (completion fan-out owns done lifecycle)", async () => {
const store = makeStore([task("FN-3", { column: "done", worktree: "/missing", branch: null })]);
const store = makeStore([task("FN-3", { column: "done", worktree: "/missing", branch: undefined })]);
vi.spyOn(worktreePoolModule, "getRegisteredWorktreeBranchMap").mockResolvedValue(new Map([["fusion/fn-3", "/live"]]));
const manager = new SelfHealingManager(store, { rootDir: "/repo" });

View File

@@ -129,7 +129,7 @@ describeIfGit("SelfHealingManager recoverAlreadyMergedReviewTasks (real git)", (
expect(task.mergeDetails?.mergeConfirmed).toBe(true);
expect(existsSync(worktreePath)).toBe(false);
expect(git(repo, "git worktree list")).not.toContain(worktreePath);
expect((store as any).recordRunAuditEvent).toHaveBeenCalledTimes(2);
expect((store as any).recordRunAuditEvent).toHaveBeenCalledTimes(3);
expect((store as any).recordRunAuditEvent).toHaveBeenCalledWith(
expect.objectContaining({
domain: "database",

View File

@@ -108,8 +108,10 @@ describe("self-healing worktree metadata reconcile", () => {
git(livePath, "add feature.txt");
git(livePath, "commit -m 'feature commit'");
await store.moveTask(task.id, "todo");
await store.moveTask(task.id, "in-progress");
await store.moveTask(task.id, "in-review");
await store.updateTask(task.id, {
column: "in-review",
worktree: stalePath,
branch: null,
});
@@ -143,9 +145,9 @@ describe("self-healing worktree metadata reconcile", () => {
describe("reconcileTaskWorktreeMetadata matrix", () => {
it("skips done/archived and executing tasks", async () => {
const tasks = [
makeSlimTask("FN-100", { column: "done", worktree: "/missing", branch: null }),
makeSlimTask("FN-101", { column: "archived", worktree: "/missing", branch: null }),
makeSlimTask("FN-102", { column: "todo", worktree: "/missing", branch: null }),
makeSlimTask("FN-100", { column: "done", worktree: "/missing", branch: undefined }),
makeSlimTask("FN-101", { column: "archived", worktree: "/missing", branch: undefined }),
makeSlimTask("FN-102", { column: "todo", worktree: "/missing", branch: undefined }),
];
const store = Object.assign(new EventEmitter(), {