Skip to content

Commit 97dc24e

Browse files
atulmguptaCopilot
andcommitted
refactor(R2d.108): convert mountAIRoutes to AIHandlers struct field-bag
Replace 54 positional `*AI<Name>Handler` parameters on mountAIRoutes with a single `h AIHandlers` struct param. Each struct field is typed as `http.Handler` (interface) so subsequent parallel subpackage carves (R2d.109+) can move concrete AI handler types into per-feature subpkgs without re-touching the mountAIRoutes signature on every carve — only the router.go field assignment changes, which already conflicts on every router-touching carve. Mechanical rewrite: - 54 `aiXxx` body refs -> `h.Xxx` (126 substitutions total via word-boundary regex pass that excluded `aiXxxStubHandler` because word boundaries don't split between `aiChatbot` and `Stub`) - mountAIRoutes signature: 60 lines of positional params collapsed to one `h AIHandlers` param - router.go call site: 54-positional one-liner expanded to struct literal with explicit field names so future field additions don't silently corrupt order - stale Parameters: doc-comment block on mountAIRoutes shortened (the AIHandlers struct fields are self-documenting) Gates green: go build ./..., go vet ./..., go test ./internal/arch ./internal/api ./internal/api/..., archmetrics compare, golangci-lint run ./internal/api/.... Unblocks parallel AI carve fleet (batch 10, ~50 agents) — each agent moves one AI handler to its own subpkg + flips one struct-field type in router.go without ever touching ai_routes.go. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d493c31 commit 97dc24e

2 files changed

Lines changed: 242 additions & 229 deletions

File tree

0 commit comments

Comments
 (0)