summaryrefslogtreecommitdiff
path: root/internal/store
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-14 20:42:34 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-16 02:44:52 +0000
commit879e67a95cf994376cbb7e5724a7599c1711b1ec (patch)
treeade8c4d65674d486914c2865f2af733c499ae163 /internal/store
parent146034b08446c4bf0099bb41ab5e689d418e6dce (diff)
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTUSAEKfsPc6WGDq45yPHD
Diffstat (limited to 'internal/store')
-rw-r--r--internal/store/native_tasks.go8
1 files changed, 6 insertions, 2 deletions
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.