chore(FN-4350): import dependency content from fusion/fn-4326

Squash-imported the working tree of fusion/fn-4326 as a single commit so this branch carries the dep's content without inheriting its individual commits. If the dep is later squash-merged to main, this commit's patch-id should match the merge and rebase cleanly.

Fusion-Task-Id: FN-4350
Fusion-Task-Lineage: 11fff2c2-1cd1-4562-9b01-032a15217479
This commit is contained in:
gsxdsm
2026-05-13 11:57:14 -07:00
parent bb0d6118e2
commit f378874c14
11 changed files with 423 additions and 24 deletions

View File

@@ -0,0 +1,52 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { createTaskStoreTestHarness } from "./store-test-helpers.js";
describe("TaskStore moveTask preserveStatus", () => {
const harness = createTaskStoreTestHarness();
beforeEach(harness.beforeEach);
afterEach(harness.afterEach);
it("clears status/error by default when moving in-progress to todo", async () => {
const task = await harness.store().createTask({ description: "preserveStatus default clear" });
await harness.store().moveTask(task.id, "todo");
await harness.store().moveTask(task.id, "in-progress");
await harness.store().updateTask(task.id, {
status: "failed",
error: "boom",
});
const moved = await harness.store().moveTask(task.id, "todo");
expect(moved.status).toBeUndefined();
expect(moved.error).toBeUndefined();
});
it("preserves status/error when preserveStatus is true on in-progress to todo", async () => {
const task = await harness.store().createTask({ description: "preserveStatus true in-progress" });
await harness.store().moveTask(task.id, "todo");
await harness.store().moveTask(task.id, "in-progress");
await harness.store().updateTask(task.id, {
status: "failed",
error: "branch conflict",
});
const moved = await harness.store().moveTask(task.id, "todo", { preserveStatus: true });
expect(moved.status).toBe("failed");
expect(moved.error).toBe("branch conflict");
});
it("preserves status/error on in-review to todo when preserveStatus is true", async () => {
const task = await harness.store().createTask({ description: "preserveStatus true in-review" });
await harness.store().moveTask(task.id, "todo");
await harness.store().moveTask(task.id, "in-progress");
await harness.store().moveTask(task.id, "in-review");
await harness.store().updateTask(task.id, {
status: "failed",
error: "recovery exhausted",
});
const moved = await harness.store().moveTask(task.id, "todo", { preserveStatus: true });
expect(moved.status).toBe("failed");
expect(moved.error).toBe("recovery exhausted");
});
});