feat(FN-5434): silence queued-status stale-clear branch in self-healing

Fixes a stale queued-status recovery branch in self-healing and updates the corresponding test assertions to match the corrected behavior.

Fusion-Task-Id: FN-5434
This commit is contained in:
Fusion (runfusion.ai)
2026-05-21 11:13:01 -07:00
committed by gsxdsm
parent 933cea434a
commit e0d8600ae6
2 changed files with 12 additions and 5 deletions

View File

@@ -6148,11 +6148,12 @@ describe("clearStaleBlockedBy", () => {
const manager = new SelfHealingManager(store, { rootDir: "/tmp/test-project" });
const recovered = await manager.clearStaleBlockedBy();
expect(recovered).toBe(1);
// FN-5434: stale queued-status cleanup remains stateful but is no longer logged/count-recovered.
expect(recovered).toBe(0);
expect(store.updateTask).toHaveBeenCalledWith("FN-3170", { blockedBy: null, overlapBlockedBy: null, status: null });
expect(store.logEntry).toHaveBeenCalledWith(
expect(store.logEntry).not.toHaveBeenCalledWith(
"FN-3170",
"Auto-recovered: cleared stale queued status — all dependencies satisfied",
expect.stringContaining("cleared stale queued status"),
);
manager.stop();
});
@@ -6239,6 +6240,10 @@ describe("FN-4538 overlapBlockedBy self-healing", () => {
await manager.clearStaleBlockedBy();
expect(store.updateTask).toHaveBeenCalledWith("FN-TARGET", { blockedBy: null, status: "queued" });
expect(store.logEntry).toHaveBeenCalledWith(
"FN-TARGET",
"Auto-recovered: preserved queued status — still blocked by file scope overlap with FN-ACTIVE",
);
expect(store.updateTask).not.toHaveBeenCalledWith("FN-TARGET", expect.objectContaining({ status: null }));
manager.stop();
});

View File

@@ -3458,10 +3458,12 @@ export class SelfHealingManager {
await this.store.updateTask(task.id, { blockedBy: null, status: "queued" });
await this.store.logEntry(task.id, `Auto-recovered: preserved queued status — still blocked by file scope overlap with ${task.overlapBlockedBy}`);
} else {
// FN-5434: routine scheduler↔self-healing queued-status churn should stay silent; keep state cleanup only.
await this.store.updateTask(task.id, { blockedBy: null, overlapBlockedBy: null, status: null });
await this.store.logEntry(task.id, "Auto-recovered: cleared stale queued status — all dependencies satisfied");
}
recovered++;
if (hasActiveOverlapBlocker) {
recovered++;
}
} catch (err: unknown) {
const errorMessage = err instanceof Error ? err.message : String(err);
log.error(`Failed to clear stale queued status for ${task.id}: ${errorMessage}`);