test(engine): switch mockResolvedValueOnce → mockResolvedValue for resume-verifier overlap

The resume-path verifier in acquireTaskWorktree now also calls
classifyBootstrapMisbinding / reanchorBranchToBase before the
executor's primary contamination check runs. With a once-spy the mock
was depleted by the verifier, leaving the executor path with the real
implementation and the FN-4488 shape regression test no longer
exercised its expected recovery branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-23 02:41:08 -07:00
parent e7088704e6
commit 57f33ea2d2

View File

@@ -109,13 +109,17 @@ describe("branch cross-contamination recovery (FN-4428/FN-4499)", () => {
return {} as any;
}) as any);
vi.spyOn(branchConflicts, "assertCleanBranchAtBase").mockRejectedValueOnce(contamination);
vi.spyOn(branchConflicts, "classifyBootstrapMisbinding").mockResolvedValueOnce({
// Not `mockResolvedValueOnce`: the acquireTaskWorktree resume-path
// verifier (FN-5475 fix) also consults classifyBootstrapMisbinding
// before the executor's primary contamination check runs, so a
// once-spy is exhausted before the executor's call lands.
vi.spyOn(branchConflicts, "classifyBootstrapMisbinding").mockResolvedValue({
isBootstrapMisbinding: true,
ownCommitCount: 0,
foreignCommitCount: 1,
nonAttributedCount: 0,
});
vi.spyOn(branchConflicts, "reanchorBranchToBase").mockResolvedValueOnce({
vi.spyOn(branchConflicts, "reanchorBranchToBase").mockResolvedValue({
previousTipSha: "3333333333333333333333333333333333333333",
newTipSha: "4444444444444444444444444444444444444444",
});