From 879e67a95cf994376cbb7e5724a7599c1711b1ec Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 14 Jul 2026 20:42:34 +0000 Subject: fix(tasks): return ErrNativeTaskNotFound from UpdateNativeTask on stale id HandleWidgetTaskUpdate now returns 404 instead of silently succeeding when the widget's cached task id no longer exists, matching every other native_tasks mutator's checkRowsAffected pattern. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01VTUSAEKfsPc6WGDq45yPHD --- internal/store/native_tasks.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'internal/store/native_tasks.go') diff --git a/internal/store/native_tasks.go b/internal/store/native_tasks.go index d4cc896..3bd87cb 100644 --- a/internal/store/native_tasks.go +++ b/internal/store/native_tasks.go @@ -125,12 +125,16 @@ func (s *Store) CreateNativeTask(task models.Task) error { } // UpdateNativeTask updates a native task's content and description. +// Returns ErrNativeTaskNotFound if id doesn't match any row. func (s *Store) UpdateNativeTask(id, content, description string) error { - _, err := s.db.Exec(` + result, err := s.db.Exec(` UPDATE native_tasks SET content = ?, description = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ? `, content, description, id) - return err + if err != nil { + return err + } + return checkRowsAffected(result) } // UpdateNativeTaskDescription updates only a native task's description, leaving content untouched. -- cgit v1.2.3