From 95aafb7136a6738cccf07f2fc3323c13e4697665 Mon Sep 17 00:00:00 2001 From: Aliaksei Karneyeu Date: Fri, 6 Mar 2026 11:43:03 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20labels=20field=20type:=20[]string=20?= =?UTF-8?q?=E2=86=92=20[]LabelInput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The queue-processor sends labels as an array of objects matching TypeScript's CreateLabelInput interface, e.g.: labels: [{"name":"RSS"}] The Go struct had this declared as []string, causing an unmarshal error whenever an RSS feed job arrived: json: cannot unmarshal object into Go struct field JobData.labels of type string Fix both JobData (incoming jobs) and savePageJobData (outgoing jobs) to use []LabelInput{Name, Color, Description}, matching the TS types exactly. Co-Authored-By: Claude Opus 4.6 --- .../internal/handler/handler.go | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/packages/content-fetch-go/internal/handler/handler.go b/packages/content-fetch-go/internal/handler/handler.go index 15d389eee..5f4db9f2c 100644 --- a/packages/content-fetch-go/internal/handler/handler.go +++ b/packages/content-fetch-go/internal/handler/handler.go @@ -24,6 +24,14 @@ import ( "github.com/redis/go-redis/v9" ) +// LabelInput mirrors the TS CreateLabelInput interface. +// Labels are sent as objects (e.g. {"name":"RSS"}), not plain strings. +type LabelInput struct { + Name string `json:"name"` + Color *string `json:"color,omitempty"` + Description *string `json:"description,omitempty"` +} + // UserConfig mirrors the TS UserConfig interface. type UserConfig struct { ID string `json:"id"` @@ -31,13 +39,13 @@ type UserConfig struct { Folder *string `json:"folder,omitempty"` } -// JobData mirrors the TS JobData interface exactly. +// JobData mirrors the TS FetchContentJobData interface. type JobData struct { URL string `json:"url"` UserID *string `json:"userId,omitempty"` SaveRequestID string `json:"saveRequestId"` State *string `json:"state,omitempty"` - Labels []string `json:"labels,omitempty"` + Labels []LabelInput `json:"labels,omitempty"` Source *string `json:"source,omitempty"` TaskID *string `json:"taskId,omitempty"` Locale *string `json:"locale,omitempty"` @@ -52,21 +60,21 @@ type JobData struct { // savePageJobData mirrors SavePageJobData from job.ts. type savePageJobData struct { - UserID string `json:"userId"` - URL string `json:"url"` - FinalURL string `json:"finalUrl"` - ArticleSavingRequestID string `json:"articleSavingRequestId"` - State *string `json:"state,omitempty"` - Labels []string `json:"labels,omitempty"` - Source string `json:"source"` - Folder *string `json:"folder,omitempty"` - RSSFeedURL *string `json:"rssFeedUrl,omitempty"` - SavedAt *string `json:"savedAt,omitempty"` - PublishedAt *string `json:"publishedAt,omitempty"` - TaskID *string `json:"taskId,omitempty"` - Title string `json:"title,omitempty"` - ContentType string `json:"contentType,omitempty"` - CacheKey string `json:"cacheKey,omitempty"` + UserID string `json:"userId"` + URL string `json:"url"` + FinalURL string `json:"finalUrl"` + ArticleSavingRequestID string `json:"articleSavingRequestId"` + State *string `json:"state,omitempty"` + Labels []LabelInput `json:"labels,omitempty"` + Source string `json:"source"` + Folder *string `json:"folder,omitempty"` + RSSFeedURL *string `json:"rssFeedUrl,omitempty"` + SavedAt *string `json:"savedAt,omitempty"` + PublishedAt *string `json:"publishedAt,omitempty"` + TaskID *string `json:"taskId,omitempty"` + Title string `json:"title,omitempty"` + ContentType string `json:"contentType,omitempty"` + CacheKey string `json:"cacheKey,omitempty"` } const maxImportAttempts = 1