feat(FN-3932): add orphaned finalize-reset autostash safeguard in merger

The merger gains a safeguard that automatically stashes work when a finalize-reset leaves orphaned records, preventing merge-state corruption. Core exports the new orphan record type, project-engine wires the safeguard, and documentation traces the provenance flow; tests were added for the recovery

Fusion-Task-Id: FN-3932
This commit is contained in:
Fusion
2026-05-10 14:19:53 -07:00
committed by gsxdsm
parent 06daea7e3d
commit bcb4107a1a
11 changed files with 241 additions and 28 deletions

View File

@@ -51,6 +51,9 @@ describe("stash recovery routes", () => {
createdAt: null,
changedPaths: ["file.txt"],
classification: "live",
sourcePhase: "finalize-reset",
detectedByTaskId: "FN-1234",
detectedAt: "2026-05-10T00:00:00.000Z",
},
]);
@@ -58,6 +61,7 @@ describe("stash recovery routes", () => {
expect(res.status).toBe(200);
expect(res.body.count).toBe(1);
expect(res.body.records[0].sha).toBe("abcdef1");
expect(res.body.records[0].sourcePhase).toBe("finalize-reset");
});
it("returns diff + truncated flag", async () => {