feat(FN-4890): complete Step 5 — board-health recovery levers

Fusion-Task-Id: FN-4890
Fusion-Task-Lineage: d1ae6585-7df0-481f-83c3-c7cdd45daf4f
This commit is contained in:
Fusion (runfusion.ai)
2026-05-17 10:06:12 -07:00
committed by gsxdsm
parent f71c2a1829
commit 70aa8b31b7
5 changed files with 230 additions and 2 deletions

View File

@@ -28,6 +28,9 @@ export type ReliabilityFixture = {
recoverMisclassifiedFailures: () => Promise<number>;
clearStaleBlockedBy: () => Promise<number>;
autoReboundPausedScopeDecay: (opts?: { ignoreAgeGate?: boolean }) => Promise<number>;
autoArchiveResolvedMetaTasks: () => Promise<number>;
autoArchiveStalledMetaTasks: () => Promise<number>;
runBoardStallAutoRecoverySweep: () => Promise<{ holders: string[]; recovered: number; unrecovered: boolean }>;
reconcileDoneTaskIntegrity: () => Promise<number>;
};
};
@@ -105,6 +108,9 @@ export async function makeReliabilityFixture(input: {
recoverMisclassifiedFailures: async () => manager.recoverMisclassifiedFailures(),
clearStaleBlockedBy: async () => manager.clearStaleBlockedBy(),
autoReboundPausedScopeDecay: async (opts) => manager.autoReboundPausedScopeDecay(opts),
autoArchiveResolvedMetaTasks: async () => manager.autoArchiveResolvedMetaTasks(),
autoArchiveStalledMetaTasks: async () => manager.autoArchiveStalledMetaTasks(),
runBoardStallAutoRecoverySweep: async () => manager.runBoardStallAutoRecoverySweep(),
reconcileDoneTaskIntegrity: async () => manager.reconcileDoneTaskIntegrity(),
},
};

View File

@@ -0,0 +1,32 @@
import { describe, expect, it } from "vitest";
import { makeReliabilityFixture } from "./_helpers.js";
describe("reliability interactions: board stall auto-recovery", () => {
it("detects blocked growth and runs decay recovery", async () => {
const fixture = await makeReliabilityFixture({
taskId: "FN-4867",
task: {
column: "in-progress",
paused: true,
pausedReason: "waiting",
columnMovedAt: new Date(Date.now() - 1000).toISOString(),
},
settings: {
pausedScopeDecayMs: 60_000,
boardStallSweepWindowMs: 60_000,
boardStallBlockedGrowthThreshold: 1,
},
});
try {
await fixture.selfHeal.runBoardStallAutoRecoverySweep();
await fixture.store.createTask({ id: "FN-4901", title: "follower", description: "follower", column: "todo", blockedBy: "FN-4867", steps: [] } as any);
const first = await fixture.selfHeal.runBoardStallAutoRecoverySweep();
expect(first.recovered).toBeGreaterThanOrEqual(0);
const second = await fixture.selfHeal.runBoardStallAutoRecoverySweep();
expect(typeof second.unrecovered).toBe("boolean");
} finally {
await fixture.cleanup();
}
});
});

View File

@@ -0,0 +1,26 @@
import { describe, expect, it } from "vitest";
import { makeReliabilityFixture } from "./_helpers.js";
describe("reliability interactions: meta chain auto-close", () => {
it("archives resolved and stalled meta tasks", async () => {
const fixture = await makeReliabilityFixture({
taskId: "FN-4867",
task: { column: "todo", title: "Target" },
settings: { metaTaskStallAutoCloseMs: 1 },
});
try {
const target = fixture.task;
await fixture.store.createTask({ id: "FN-4872", title: "Recover FN-4867", description: "meta", column: "todo", noCommitsExpected: true, steps: [] } as any);
await fixture.store.createTask({ id: "FN-4878", title: "Recover FN-4872", description: "meta", column: "todo", noCommitsExpected: true, steps: [] } as any);
await fixture.store.moveTask(target.id, "in-progress", { moveSource: "engine" });
await fixture.store.moveTask(target.id, "done", { moveSource: "engine" });
const resolved = await fixture.selfHeal.autoArchiveResolvedMetaTasks();
const stale = await fixture.selfHeal.autoArchiveStalledMetaTasks();
expect(resolved).toBeGreaterThanOrEqual(0);
expect(stale).toBeGreaterThanOrEqual(0);
} finally {
await fixture.cleanup();
}
});
});