From c69fe4c07d7749b76bd71f3f545d8b7cdfbbb39f Mon Sep 17 00:00:00 2001 From: vikingowl Date: Fri, 24 Apr 2026 13:06:08 +0200 Subject: [PATCH] fix(discovery): route param name collision in ClassifySimilarPair gin panics at startup with: ':aid' in new path '/api/v1/admin/discovery/queue/:aid/similar/:bid/classify' conflicts with existing wildcard ':id' in existing prefix '/api/v1/admin/discovery/queue/:id' Gin's trie requires identical parameter names at the same prefix position. All sibling routes use :id; the tiebreak route was registered with :aid, crashing the server on every deploy since e0b73ac. Prod has been running the pre-tiebreak image (52f3e4c0) the whole time because every Helm upgrade crash-looped and rolled back. Rename :aid to :id in both the route and the handler's c.Param read. :bid is in a different slot and stays. --- backend/internal/domain/discovery/handler.go | 4 ++-- backend/internal/domain/discovery/routes.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/internal/domain/discovery/handler.go b/backend/internal/domain/discovery/handler.go index 2b14b7f..b2a9e9e 100644 --- a/backend/internal/domain/discovery/handler.go +++ b/backend/internal/domain/discovery/handler.go @@ -416,11 +416,11 @@ func (h *Handler) EnrichLLM(c *gin.Context) { } // ClassifySimilarPair runs the LLM duplicate-tiebreaker on the two queue -// rows identified by URL params :aid and :bid. Synchronous, 15s deadline — +// rows identified by URL params :id and :bid. Synchronous, 15s deadline — // the call is short (no scraping) so the operator can click and immediately // see the verdict. func (h *Handler) ClassifySimilarPair(c *gin.Context) { - aID, err := uuid.Parse(c.Param("aid")) + aID, err := uuid.Parse(c.Param("id")) if err != nil { apiErr := apierror.BadRequest("invalid_id", "invalid queue id A") c.JSON(apiErr.Status, apierror.NewResponse(apiErr)) diff --git a/backend/internal/domain/discovery/routes.go b/backend/internal/domain/discovery/routes.go index e884b77..25a518f 100644 --- a/backend/internal/domain/discovery/routes.go +++ b/backend/internal/domain/discovery/routes.go @@ -27,7 +27,7 @@ func RegisterRoutes( // Per-row LLM enrichment (MR 3b). Synchronous — operator waits. admin.POST("/queue/:id/enrich", h.EnrichLLM) // Per-pair AI similarity tiebreak (MR 4). Synchronous; short call. - admin.POST("/queue/:aid/similar/:bid/classify", h.ClassifySimilarPair) + admin.POST("/queue/:id/similar/:bid/classify", h.ClassifySimilarPair) // Manual crawl trigger — subject to hourly rate limit. admin.POST("/crawl-manual", h.Crawl) // Async crawl status polling.