Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(admin): preserve recurrence across workspace archives

Tinec1e7ce1c2b9
diff --git a/apps/api/src/task/recurrence/create-next-occurrence.ts b/apps/api/src/task/recurrence/create-next-occurrence.ts
index 7800997da..7791cc5c3 100644
--- a/apps/api/src/task/recurrence/create-next-occurrence.ts
+++ b/apps/api/src/task/recurrence/create-next-occurrence.ts
@@ -1,4 +1,3 @@
-import { projectInActiveWorkspace } from "../../workspace/archive/active-workspace-sql";
import { and, asc, eq, isNotNull } from "drizzle-orm";
import db from "../../database";
import { columnTable, taskTable } from "../../database/schema";
@@ -22,7 +21,6 @@ async function createInCurrentProject(
and(
eq(taskTable.id, taskId),
isNotNull(taskTable.recurrence),
- projectInActiveWorkspace(taskTable.projectId),
taskIsCompleted,
),
)
diff --git a/apps/docs/core/operations/administration.mdx b/apps/docs/core/operations/administration.mdx
index 3d8310262..d79307939 100644
--- a/apps/docs/core/operations/administration.mdx
+++ b/apps/docs/core/operations/administration.mdx
@@ -63,7 +63,7 @@ The only owner can't be removed or given another role. Transfer ownership to som
Choose **Archive workspace** from the workspace's actions menu to pause it without deleting data. Archived workspaces stay visible in the administration directory with an **Archived** badge. Members cannot access them, and they disappear from the workspace switcher. Open boards close their realtime connections and show an archived state.
-Archiving also pauses integrations, notifications, reminders, public project links, calendar feeds, and access through API keys and MCP. Existing memberships, invitations, and data remain. Choose **Restore workspace** to make it available again.
+Archiving also pauses integrations, notifications, reminders, public project links, calendar feeds, and access through API keys and MCP. Existing memberships, invitations, and data remain. A recurring task completed before archiving still creates its next occurrence; members can access it after restore. Choose **Restore workspace** to make it available again.
### Delete a workspace
diff --git a/tests/api-integration/workspace-archive-access.test.ts b/tests/api-integration/workspace-archive-access.test.ts
index f75714be1..08fb10b59 100644
--- a/tests/api-integration/workspace-archive-access.test.ts
+++ b/tests/api-integration/workspace-archive-access.test.ts
@@ -281,7 +281,7 @@ describe("an archived workspace's integrations", () => {
expect(stored.metadata).toBe(metadata);
});
- it("leaves recurring tasks intact while archived", async () => {
+ it("continues a completed recurring task after its workspace is archived", async () => {
const { workspace, project, task } = await seed();
await db
.update(schema.taskTable)
@@ -292,15 +292,21 @@ describe("an archived workspace's integrations", () => {
})
.where(eq(schema.taskTable.id, task.id));
await setArchived(workspace.id, true);
- expect(await createNextOccurrence(task.id, null)).toBeNull();
+ const next = await createNextOccurrence(task.id, null);
+ expect(next).toMatchObject({
+ projectId: project.id,
+ status: "to-do",
+ recurrence: { frequency: "weekly", interval: 1, timeZone: "UTC" },
+ dueDate: new Date("2026-11-02T12:00:00Z"),
+ });
const tasks = await db
.select()
.from(schema.taskTable)
.where(eq(schema.taskTable.projectId, project.id));
- expect(tasks).toHaveLength(1);
- expect(tasks[0].recurrence).not.toBeNull();
+ expect(tasks).toHaveLength(2);
+ expect(tasks.find((entry) => entry.id === task.id)?.recurrence).toBeNull();
await setArchived(workspace.id, false);
- expect(await createNextOccurrence(task.id, null)).not.toBeNull();
+ expect(await createNextOccurrence(task.id, null)).toBeNull();
});
it("are skipped by webhook and sync lookups", async () => {