feat(FN-5131): add lineage-unlink flag to triage parent deletes

Adds a `lineage-unlink` flag to triage parent deletes (FN-5131), enabling the split-into-subtasks path to break parent-child lineage on deletion. The primary addition is a comprehensive new test covering that split scenario, with minor adjustments to two existing lineage-related test files.

Fusion-Task-Id: FN-5131

Fusion-Task-Lineage: cb720e8f-8c49-42e4-873a-9949f3ba3427
This commit is contained in:
Fusion (runfusion.ai)
2026-05-19 07:20:28 -07:00
committed by gsxdsm
parent a6747c1dfd
commit 2c7ae1c1a4
6 changed files with 162 additions and 8 deletions

View File

@@ -119,7 +119,7 @@ describe("TaskStore lineage child delete/archive guards", () => {
await expect(store.cleanupArchivedTasks()).resolves.toEqual([]);
});
it("idempotent re-delete currently throws not found (pre-FN-5127 merge)", async () => {
it("idempotent re-delete remains a no-op even if a lineage child is attached later", async () => {
const { store, parent } = await createParentAndChild();
await store.deleteTask(parent.id, { removeLineageReferences: true });
const before = (store as any).readTaskFromDb(parent.id, { includeDeleted: true });
@@ -129,7 +129,7 @@ describe("TaskStore lineage child delete/archive guards", () => {
.prepare("UPDATE tasks SET sourceParentTaskId = ?, sourceType = ?, updatedAt = ? WHERE id = ?")
.run(parent.id, "task_refine", new Date().toISOString(), lateChild.id);
await expect(store.deleteTask(parent.id)).rejects.toThrow(`Task ${parent.id} not found`);
await expect(store.deleteTask(parent.id)).resolves.toEqual(expect.objectContaining({ id: parent.id }));
const after = (store as any).readTaskFromDb(parent.id, { includeDeleted: true });
expect(after?.deletedAt).toBe(before.deletedAt);
});