fix(FN-1952): preserve explicit non-cleanup archive
This commit is contained in:
@@ -6114,7 +6114,7 @@ Task with acceptance criteria
|
|||||||
await store.archiveTask(task.id, false);
|
await store.archiveTask(task.id, false);
|
||||||
|
|
||||||
const dir = join(rootDir, ".fusion", "tasks", task.id);
|
const dir = join(rootDir, ".fusion", "tasks", task.id);
|
||||||
expect(existsSync(dir)).toBe(false);
|
expect(existsSync(dir)).toBe(true);
|
||||||
|
|
||||||
await store.cleanupArchivedTasks();
|
await store.cleanupArchivedTasks();
|
||||||
|
|
||||||
@@ -6130,7 +6130,7 @@ Task with acceptance criteria
|
|||||||
await store.archiveTask(task.id, false);
|
await store.archiveTask(task.id, false);
|
||||||
|
|
||||||
const cleaned1 = await store.cleanupArchivedTasks();
|
const cleaned1 = await store.cleanupArchivedTasks();
|
||||||
expect(cleaned1).toEqual([]);
|
expect(cleaned1).toContain(task.id);
|
||||||
|
|
||||||
const cleaned2 = await store.cleanupArchivedTasks();
|
const cleaned2 = await store.cleanupArchivedTasks();
|
||||||
expect(cleaned2).toHaveLength(0);
|
expect(cleaned2).toHaveLength(0);
|
||||||
@@ -6458,7 +6458,7 @@ Task with acceptance criteria
|
|||||||
expect(existsSync(dir)).toBe(false);
|
expect(existsSync(dir)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("archiveTask(false) still removes active task storage", async () => {
|
it("archiveTask(false) preserves directory for explicit non-cleanup archives", async () => {
|
||||||
const task = await store.createTask({ description: "No cleanup" });
|
const task = await store.createTask({ description: "No cleanup" });
|
||||||
await store.moveTask(task.id, "todo");
|
await store.moveTask(task.id, "todo");
|
||||||
await store.moveTask(task.id, "in-progress");
|
await store.moveTask(task.id, "in-progress");
|
||||||
@@ -6469,7 +6469,7 @@ Task with acceptance criteria
|
|||||||
expect(archived.column).toBe("archived");
|
expect(archived.column).toBe("archived");
|
||||||
|
|
||||||
const dir = join(rootDir, ".fusion", "tasks", task.id);
|
const dir = join(rootDir, ".fusion", "tasks", task.id);
|
||||||
expect(existsSync(dir)).toBe(false);
|
expect(existsSync(dir)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("default cleanup parameter removes active task storage", async () => {
|
it("default cleanup parameter removes active task storage", async () => {
|
||||||
|
|||||||
@@ -2950,14 +2950,19 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
|
|||||||
action: "Task archived",
|
action: "Task archived",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cleanup) {
|
if (!cleanup) {
|
||||||
const cleanedBranches = await this.cleanupBranchForTask(task);
|
await this.atomicWriteTaskJson(dir, task);
|
||||||
if (cleanedBranches.length > 0) {
|
if (this.isWatching) this.taskCache.set(id, { ...task });
|
||||||
task.log.push({
|
this.emit("task:moved", { task, from: "done" as Column, to: "archived" as Column });
|
||||||
timestamp: new Date().toISOString(),
|
return task;
|
||||||
action: `Cleaned up branch: ${cleanedBranches.join(", ")}`,
|
}
|
||||||
});
|
|
||||||
}
|
const cleanedBranches = await this.cleanupBranchForTask(task);
|
||||||
|
if (cleanedBranches.length > 0) {
|
||||||
|
task.log.push({
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
action: `Cleaned up branch: ${cleanedBranches.join(", ")}`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry = await this.taskToArchiveEntry(task, task.columnMovedAt);
|
const entry = await this.taskToArchiveEntry(task, task.columnMovedAt);
|
||||||
|
|||||||
Reference in New Issue
Block a user