From 967335dfcf83a400c4bc662baf27009e4d30b971 Mon Sep 17 00:00:00 2001 From: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com> Date: Fri, 26 Sep 2025 00:22:35 +0200 Subject: [PATCH] chore: apply requested changes --- packages/tm-core/src/storage/api-storage.ts | 13 ++++++++++--- .../src/storage/file-storage/file-storage.ts | 10 +++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/tm-core/src/storage/api-storage.ts b/packages/tm-core/src/storage/api-storage.ts index cfcffeb8..b62c1e92 100644 --- a/packages/tm-core/src/storage/api-storage.ts +++ b/packages/tm-core/src/storage/api-storage.ts @@ -511,6 +511,14 @@ export class ApiStorage implements IStorage { } const oldStatus = existingTask.status; + if (oldStatus === newStatus) { + return { + success: true, + oldStatus, + newStatus, + taskId + }; + } // Update the task/subtask status await this.retryOperation(() => @@ -520,9 +528,8 @@ export class ApiStorage implements IStorage { }) ); - // For subtasks, we might want to auto-adjust parent status - // but in API storage, we'd need to query for the parent and its other subtasks - // This is left as future enhancement since API storage handles relationships differently + // Note: Parent status auto-adjustment is handled by the backend API service + // which has its own business logic for managing task relationships return { success: true, diff --git a/packages/tm-core/src/storage/file-storage/file-storage.ts b/packages/tm-core/src/storage/file-storage/file-storage.ts index 516348ce..1fdecb7c 100644 --- a/packages/tm-core/src/storage/file-storage/file-storage.ts +++ b/packages/tm-core/src/storage/file-storage/file-storage.ts @@ -391,12 +391,12 @@ export class FileStorage implements IStorage { const subs = parentTask.subtasks; let parentNewStatus = parentTask.status; if (subs.length > 0) { - const allDone = subs.every((s) => (s.status || 'pending') === 'done'); - const anyInProgress = subs.some( - (s) => (s.status || 'pending') === 'in-progress' - ); + const norm = (s: any) => (s.status || 'pending'); + const allDone = subs.every((s) => norm(s) === 'done'); + const anyInProgress = subs.some((s) => norm(s) === 'in-progress'); + const anyDone = subs.some((s) => norm(s) === 'done'); if (allDone) parentNewStatus = 'done'; - else if (anyInProgress) parentNewStatus = 'in-progress'; + else if (anyInProgress || anyDone) parentNewStatus = 'in-progress'; } // Always bump updatedAt; update status only if changed