From 77219e8f592a7499915e3f583f7958d32c807582 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Sat, 23 May 2026 07:55:14 +0000 Subject: [PATCH] fix(handlers): add missing rows.Err() checks in schedules/events listers ScheduleHistory, ListEvents, and ListWorkspaceEvents all iterated rows.Next() without checking rows.Err() afterwards. A mid-stream DB error would silently truncate the result set, making the canvas think there were no more entries when the query actually failed partway. Co-Authored-By: Claude Opus 4.7 --- workspace-server/internal/handlers/events.go | 6 ++++++ workspace-server/internal/handlers/schedules.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/workspace-server/internal/handlers/events.go b/workspace-server/internal/handlers/events.go index d297026b3..22d013cea 100644 --- a/workspace-server/internal/handlers/events.go +++ b/workspace-server/internal/handlers/events.go @@ -49,6 +49,9 @@ func (h *EventsHandler) List(c *gin.Context) { "created_at": createdAt, }) } + if err := rows.Err(); err != nil { + log.Printf("Events list rows error: %v", err) + } c.JSON(http.StatusOK, events) } @@ -87,5 +90,8 @@ func (h *EventsHandler) ListByWorkspace(c *gin.Context) { "created_at": createdAt, }) } + if err := rows.Err(); err != nil { + log.Printf("WorkspaceEvents list rows error: %v", err) + } c.JSON(http.StatusOK, events) } diff --git a/workspace-server/internal/handlers/schedules.go b/workspace-server/internal/handlers/schedules.go index e114942d4..1255785a2 100644 --- a/workspace-server/internal/handlers/schedules.go +++ b/workspace-server/internal/handlers/schedules.go @@ -417,6 +417,9 @@ func (h *ScheduleHandler) History(c *gin.Context) { e.Request = json.RawMessage(reqStr) entries = append(entries, e) } + if err := rows.Err(); err != nil { + log.Printf("ScheduleHistory: rows error: %v", err) + } c.JSON(http.StatusOK, entries) } -- 2.52.0