Files
fusion/scripts/__tests__/self-healing-docs.test.mjs
Fusion ff4e7cad78 feat(FN-3937): document architecture recovery layers and lifecycle alignmen
Added documentation for Fusion's architecture recovery layers (deadlock self-healing, paused-aware in-review filtering) and aligned lifecycle docs, with a new test validating that the self-healing docs stay in sync with the source code.

Fusion-Task-Id: FN-3937
2026-05-10 15:33:25 -07:00

39 lines
1.6 KiB
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const architecturePath = path.resolve(__dirname, "../../docs/architecture.md");
const taskManagementPath = path.resolve(__dirname, "../../docs/task-management.md");
const architectureDoc = readFileSync(architecturePath, "utf8");
const taskManagementDoc = readFileSync(taskManagementPath, "utf8");
test("architecture self-healing section documents already-merged review recovery layer", () => {
assert.ok(
architectureDoc.includes("recoverAlreadyMergedReviewTasks()"),
"Expected docs/architecture.md to mention recoverAlreadyMergedReviewTasks()",
);
assert.ok(
architectureDoc.includes("Together, `recoverAlreadyMergedReviewTasks()`, `clearStaleBlockedBy()`, and paused-aware in-review scheduling"),
"Expected architecture docs to describe the layered merge-deadlock self-healing defenses",
);
});
test("task lifecycle docs describe preserved failed review state plus already-landed auto-finalization", () => {
assert.ok(
taskManagementDoc.includes("This state is intentionally preserved by recovery (not auto-bounced to `todo`)."),
"Expected task-management docs to preserve failed in-review tasks",
);
assert.match(
taskManagementDoc,
/Self-healing can still auto-finalize retry-exhausted failed review tasks[\s\S]*already landed on the merge target/,
"Expected task-management docs to explain already-landed failed-review auto-finalization",
);
});