fix(sdlc): route conflict with SDLCGenerateHandler shadowing SDLC routes
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

SDLCGenerateHandler was using r.Route() to create a sub-router at
/projects/{id}/sdlc/features/{slug}, which shadowed SDLCHandler's
nested routes like /features/{slug}/artifacts/{type}/approve.

Changed to direct route registration to avoid chi route conflicts.
This fixes 404 errors on SDLC feature and artifact endpoints.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
jordan 2026-02-08 11:27:41 -07:00
parent 4486042155
commit 00f55f7f6f

View File

@ -24,10 +24,12 @@ func NewSDLCGenerateHandler(generateSvc *service.SDLCGenerateService) *SDLCGener
} }
// Mount registers the generate endpoint on the router. // Mount registers the generate endpoint on the router.
// Note: Uses direct route to avoid conflict with /projects/{id}/sdlc in sdlc.go.
// Creating a Route() group at /projects/{id}/sdlc/features/{slug} shadows
// the SDLCHandler's nested routes like /features/{slug}/artifacts/{type}/approve.
func (h *SDLCGenerateHandler) Mount(r api.Router) { func (h *SDLCGenerateHandler) Mount(r api.Router) {
r.Route("/projects/{id}/sdlc/features/{slug}", func(r chi.Router) { r.With(auth.RequireScope(auth.ScopeProjectsExecute, auth.ScopeAdmin)).
r.With(auth.RequireScope(auth.ScopeProjectsExecute, auth.ScopeAdmin)).Post("/generate", h.Generate) Post("/projects/{id}/sdlc/features/{slug}/generate", h.Generate)
})
} }
// GenerateRequest is the request body for POST /projects/{id}/sdlc/features/{slug}/generate. // GenerateRequest is the request body for POST /projects/{id}/sdlc/features/{slug}/generate.