diff --git a/.changeset/workspace-merge-test-mock-export.md b/.changeset/workspace-merge-test-mock-export.md new file mode 100644 index 0000000000..8dc86cf892 --- /dev/null +++ b/.changeset/workspace-merge-test-mock-export.md @@ -0,0 +1,7 @@ +--- +"@runfusion/fusion": patch +--- + +summary: Repair four red workspace-merge tests caused by a stale module mock. +category: internal +dev: `project-engine.test.ts` mocks `../merge/merger-ai.js` with a hand-written factory that had not kept up with the module's exports: `WorkspaceMergeDispatchSupersededError` was missing. Production imports it, so the merge-queue drain threw "No is defined on the mock" before reaching the behaviour under test, and the four Phase C hardening cases failed on a resolved promise and a missing `updateTask` call rather than on what they assert. No product change; the factory now provides the class and carries a note to keep it in step with merger-ai's exported errors. diff --git a/packages/engine/src/__tests__/project-engine.test.ts b/packages/engine/src/__tests__/project-engine.test.ts index bf136ae54f..866dc89392 100644 --- a/packages/engine/src/__tests__/project-engine.test.ts +++ b/packages/engine/src/__tests__/project-engine.test.ts @@ -136,12 +136,26 @@ vi.mock("../merge/merger-ai.js", () => { this.name = "WorkspaceFinalizeBlockedError"; } } + /* + FNXC:WorkspaceMerge 2026-08-19-04:00: + Production imports this error from merger-ai, so a factory that omits it makes the merge-queue + drain throw "No is defined on the mock" BEFORE reaching the behaviour under test — the + four Phase C hardening cases then saw a resolved promise and no updateTask call, failing for a + reason unrelated to what they assert. Keep this list in step with merger-ai's exported errors. + */ + class WorkspaceMergeDispatchSupersededError extends Error { + constructor(public readonly taskId: string) { + super(`Workspace merge dispatch lease was superseded before finalization for ${taskId}`); + this.name = "WorkspaceMergeDispatchSupersededError"; + } + } return { runAiMerge: mocks.runAiMerge, landWorkspaceTask: mocks.landWorkspaceTask, WorkspaceRepoLandBusyError, WorkspacePartialLandError, WorkspaceFinalizeBlockedError, + WorkspaceMergeDispatchSupersededError, }; });