refactor: port routes_gitops.go self-upgrade to ops.RegisterSelfUpgrade (epic #23725 slice 2b.7) [architect] - #23754
Conversation
…s.RegisterSelfUpgrade (epic #23725 slice 2b.7) Move the two /self-upgrade routes out of the hand-rolled block in setupGitOpsRoutes into a file-scoped ops.RegisterSelfUpgrade function in pkg/api/handlers/ops/registrar.go. Route order and paths are byte-for-byte identical to the previous block, so fiber's first-match semantics and the existing wiring tests are unchanged. A file-scoped registrar is used rather than a monolithic ops.Register because each ops handler (air-gap, manifest, notifications, onboarding, ping, self-upgrade, timeline, token-usage) is wired from a different route file in pkg/api. Individual RegisterXxx functions let each caller wire only what it needs. Signature is domain-local (not handlers.Registrar) because the parent pkg/api/handlers package still imports pkg/api/handlers/ops via ops_aliases.go, so this subpackage cannot import the parent's Deps/Registrar types without an import cycle. Slice 2c unifies signatures once the _aliases.go files are retired. Refs #23725 (slice 2b.7; ops handlers in routes_auth/feedback/public/integrations/api-core still ahead) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: kubestellar-hive[bot] <223556219+Copilot@users.noreply.github.com>
✅ Deploy Preview for kubestellarconsole canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @hivecommons-hive[bot] — thanks for opening this PR!
This is an automated message. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
Refactor
Move the two
/self-upgraderoutes out of the hand-rolled block insetupGitOpsRoutesinto a file-scopedops.RegisterSelfUpgradefunctionin
pkg/api/handlers/ops/registrar.go.Route order and paths are byte-for-byte identical to the previous block,
so fiber's first-match semantics and the existing wiring tests are
unchanged.
Why file-scoped registrars, not a monolithic
ops.RegisterEach ops handler (air-gap, manifest, notifications, onboarding, ping,
self-upgrade, timeline, token-usage) is wired from a different route
file in
pkg/api. A monolithicops.Registerwould either registerroutes not wanted by a given caller or force every caller to import the
whole ops surface. Individual
RegisterXxxfunctions let each callerwire only what it needs.
Why the signature is domain-local (not
handlers.Registrar)The parent
pkg/api/handlerspackage still importspkg/api/handlers/opsthroughops_aliases.go, so this subpackagecannot import the parent's
Deps/Registrartypes without an importcycle. Slice 2c collapses all domain registrars onto a shared signature
once the final
_aliases.gofiles are retired — same pattern followedby slice 2b.6 (#23753).
Diff shape
pkg/api/handlers/ops/registrar.go(new, 37 LOC)pkg/api/routes_gitops.go(4 LOC → 5 LOC for the ported block)Refs #23725 (slice 2b.7; ops handlers in routes_auth / route_group_feedback / route_group_public / routes_integrations / route_group_api_core still ahead)
Filed by architect agent (ACMM L6 — full mode)
— hive: agent=architect backend=copilot model=claude-opus-4.7 copilot=1.0.88