carlos / platform Public

console: declare apiinstancemove.go routes in routeDecls

The moves Phase 1 resolve door becomes a declaration under gateMoves,
the MovesEnabled check registerCLIRoutes made around the group call.
registerCLIRoutes, now empty, is deleted along with its call in
NewServer; registerMovesPhase1Routes shrinks to a registerDecls call
over the gate for the tests that turn the switch on late.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 53931f927df4677f37042663c11b12c6d8a52c69 parent ede3a2e
4 files changed, +13 −21
  • internal/console/apiinstancemove.go +4 −5
  • internal/console/authcli.go +0 −13
  • internal/console/routedecls.go +9 −0
  • internal/console/server.go +0 −3

Intent

Human

<task-notification> <task-id>b8irxa405</task-id> <summary>Monitor event: "Task 2 commits landing on design-parity-guard"</summary> <event>ede3a2e0 console: declare apienv.go routes in routeDecls</event> </task-notification>

Attributed to this commit: 1.38 g CO₂e (183,779 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-parity-guard, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/internal/console/apiinstancemove.go b/internal/console/apiinstancemove.go
index 22a01bfac..c56e9e3a0 100644
--- a/internal/console/apiinstancemove.go
+++ b/internal/console/apiinstancemove.go
@@ -29,7 +29,6 @@ import (
"github.com/carlosframework/platform/internal/provision"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
- "github.com/carlosframework/platform/internal/svcrole"
)
// The residence-move doors (issue #331, instance-move spec): the console
@@ -1314,11 +1313,11 @@ func claimConsoleMoveFailed(w http.ResponseWriter, acct *Account, app, host stri
}
}
-// registerMovesPhase1Routes adds the routes that exist only with the switch
-// on. The Instance role stays on resolve only so a service token meets the
-// family's 404 rather than the role gate's 403.
+// registerMovesPhase1Routes registers the gateMoves declarations again,
+// for the tests that turn the switch on after building the server. Removed
+// once those tests call registerDecls themselves.
func (s *Server) registerMovesPhase1Routes() {
- s.cliRoute("POST /api/cli/apps/{account}/{app}/instances/{host}/move/resolve", svcrole.Allow(svcrole.Instance), s.handleAPIInstanceMoveResolve)
+ s.registerDecls(func(d routeDecl) bool { return d.Gate == gateMoves })
}
// errMoveChanged refuses a write whose move is no longer the one the door
diff --git a/internal/console/authcli.go b/internal/console/authcli.go
index 0ca82ea7c..ac82cd51b 100644
--- a/internal/console/authcli.go
+++ b/internal/console/authcli.go
@@ -532,19 +532,6 @@ func (s *Server) cliGateRefused(allow svcrole.Set, h http.HandlerFunc, refused f
}
}
-// registerCLIRoutes registers the route groups not yet declared in
-// routeDecls (routedecls.go, which now holds this file's doors). Called
-// from NewServer.
-func (s *Server) registerCLIRoutes() {
- // With CARLOS_MOVES_PHASE1 on, the three mutations above are
- // operator-only (moveOperatorGate) and a resolve door joins them. Off,
- // that route is never registered, so every request to it answers
- // exactly as it did before Phase 1 (index D13).
- if s.cfg.MovesEnabled {
- s.registerMovesPhase1Routes()
- }
-}
-
// clientIP is who the rate limiter counts against.
//
// X-Forwarded-For is only consulted when the PEER is one we put there: the
diff --git a/internal/console/routedecls.go b/internal/console/routedecls.go
index 1f10e57c2..624893c73 100644
--- a/internal/console/routedecls.go
+++ b/internal/console/routedecls.go
@@ -1080,6 +1080,15 @@ var routeDecls = []routeDecl{
{Pattern: "POST /api/cli/apps/{account}/{app}/environments/{name}/adopt", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIEnvironmentAdopt},
{Pattern: "POST /api/cli/apps/{account}/{app}/environments/{name}/release", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIEnvironmentRelease},
{Pattern: "POST /api/cli/apps/{account}/{app}/environments/fork", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIEnvironmentFork},
+
+ // The moves Phase 1 doors (apiinstancemove.go), registered only with
+ // CARLOS_MOVES_PHASE1 on (gateMoves). With it on, the three move
+ // mutations declared above (request, cut and abort) are operator-only
+ // (moveOperatorGate) and a resolve door joins them. Off, that route is never registered, so every request to it
+ // answers exactly as it did before Phase 1 (index D13). The Instance role
+ // stays on resolve only so a service token meets the family's 404 rather
+ // than the role gate's 403.
+ {Pattern: "POST /api/cli/apps/{account}/{app}/instances/{host}/move/resolve", Kind: kindCLI, Gate: gateMoves, Allow: svcrole.Allow(svcrole.Instance), Handler: (*Server).handleAPIInstanceMoveResolve},
}
// registerDecls is THE loop: every declaration match accepts and whose gate
diff --git a/internal/console/server.go b/internal/console/server.go
index 8911ace2b..50eb7ce40 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -1942,9 +1942,6 @@ func NewServer(cfg Config, st *Store) (*Server, error) {
// after every piece of state above, each declaration whose gate holds
// for this configuration.
s.registerDecls(func(routeDecl) bool { return true })
- // CLI identity: the device-code login `carlos auth login` drives, the
- // approval page, and the tokens an owner can see and kill (authcli.go).
- s.registerCLIRoutes()
// The email API's ten doors (apimail.go, tenant-email task 17) —
// registered separately from registerCLIRoutes because this task's file
// scope is server.go and apimail.go only.