carlos / platform Public

console: nudge door wakes the box without a write (Task 4)

POST .../move/offline/nudge bumps the serial the way every transition
does, writes nothing else and answers 202 with the status view. It takes
the optional move id from Task 3; no move is MV-O24 and anyone but an
operator meets the family's 404. Registered in routedecls, linkedpolicy,
claim-routes.txt, the service-route and claim fixture inventories.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev ae7310ba9ffa63dbbc1df3ef259c947fb19601a0 parent 775fed4
7 files changed, +68 −0
  • internal/console/apiinstancemove_offline.go +18 −0
  • internal/console/apiinstancemove_offline_test.go +39 −0
  • internal/console/claim_invariant_fixtures_test.go +7 −0
  • internal/console/linkedpolicy.go +1 −0
  • internal/console/routedecls.go +1 −0
  • internal/console/svcroutes_test.go +1 −0
  • internal/console/testdata/claim-routes.txt +1 −0
diff --git a/internal/console/apiinstancemove_offline.go b/internal/console/apiinstancemove_offline.go
index 02b93a7ed..61e67d0a0 100644
--- a/internal/console/apiinstancemove_offline.go
+++ b/internal/console/apiinstancemove_offline.go
@@ -36,6 +36,7 @@ import (
// POST .../instances/{host}/move/offline/open landed -> open
// POST .../instances/{host}/move/offline/finish open -> finishing -> cleared
// POST .../instances/{host}/move/offline/abort back to the source
+// POST .../instances/{host}/move/offline/nudge the serial bump alone
// GET .../instances/{host}/move/offline the status view
//
// Every door is moveOperatorGate (the byte-identical 404 for anyone but an
@@ -1355,6 +1356,23 @@ func (s *Server) handleAPIInstanceOfflineAbort(w http.ResponseWriter, r *http.Re
s.offlineAdvance(w, r, d, provision.OfflineAbort(mv.ID))
}
+// handleAPIInstanceOfflineNudge announces the move again without moving it
+// (plan 2026-11-15-offline-move-run, Task 4): the serial bump every
+// transition makes, so a box that missed the last one acts now and not on
+// its timed pass. It writes nothing else and answers 202 with the status
+// view.
+func (s *Server) handleAPIInstanceOfflineNudge(w http.ResponseWriter, r *http.Request) {
+ d, ok := s.offlineGate(w, r)
+ if !ok {
+ return
+ }
+ if _, ok := s.offlineInFlight(w, d); !ok || !s.offlineExpects(w, r, d) {
+ return
+ }
+ s.bumpSerial(r.Context())
+ writeJSON(w, http.StatusAccepted, s.offlineViewOf(r.Context(), d.rec))
+}
+
// ---- status ----
// offlineReportView is a report as the status view carries it: every field
diff --git a/internal/console/apiinstancemove_offline_test.go b/internal/console/apiinstancemove_offline_test.go
index 64da11a4c..273f17d0f 100644
--- a/internal/console/apiinstancemove_offline_test.go
+++ b/internal/console/apiinstancemove_offline_test.go
@@ -465,6 +465,7 @@ var offlineRoutes = []struct{ method, path, body string }{
{http.MethodPost, "/open", ""},
{http.MethodPost, "/finish", ""},
{http.MethodPost, "/abort", ""},
+ {http.MethodPost, "/nudge", ""},
}
// Every door is the operator's: a member's token and an Instance-role
@@ -1711,3 +1712,41 @@ func TestOfflineDoorsTheMovesOwnIDIsNoID(t *testing.T) {
w.ok("/abort", "", provision.OfflineReverting)
same("/abort", "")
}
+
+// The nudge door (plan 2026-11-15-offline-move-run, Task 4) announces the
+// move again: it bumps the serial exactly as a transition does, writes
+// nothing else, and answers 202 with the status view. It takes the move's
+// id as the other doors do. With no move it is MV-O24, and an operator's
+// alone (TestOfflineDoorsAreOperatorOnly).
+func TestOfflineNudgeDoor(t *testing.T) {
+ w := newOfflineWorld(t, oneEach...)
+ w.refused(http.MethodPost, "/nudge", "", http.StatusConflict, offlineHost+" has no offline move in flight")
+ w.start()
+ w.stopped(nil, "ie-box")
+ others := func() map[string]string {
+ state := bucketState(t, w.fx.rel)
+ delete(state, "control/serial")
+ return state
+ }
+ for _, body := range []string{"", "{}", withID("", w.id)} {
+ before, serial := others(), serialBytes(t, w.fx.rel)
+ code, out := w.req(http.MethodPost, "/nudge", body)
+ if code != http.StatusAccepted {
+ t.Fatalf("nudge %q = %d %s", body, code, out)
+ }
+ if _, _, status := rawReq(t, http.MethodGet, w.base, w.token, ""); out != status {
+ t.Fatalf("nudge %q answered\n%s\nwant the status view\n%s", body, out, status)
+ }
+ if serialBytes(t, w.fx.rel) == serial {
+ t.Fatalf("nudge %q did not bump the serial", body)
+ }
+ if after := others(); fmt.Sprint(after) != fmt.Sprint(before) {
+ t.Fatalf("nudge %q wrote more than the serial", body)
+ }
+ }
+ if rec := w.record(); rec.Move.State != provision.OfflineStopping || rec.Move.ID != w.id {
+ t.Fatalf("record after nudges: %+v", rec.Move)
+ }
+ // Another move's id: MV-O35, and not even the serial moves.
+ w.refused(http.MethodPost, "/nudge", withID("", otherMoveID(t)), http.StatusConflict, "the record carries a different offline move")
+}
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go
index 3407a47ad..dcd213d97 100644
--- a/internal/console/claim_invariant_fixtures_test.go
+++ b/internal/console/claim_invariant_fixtures_test.go
@@ -1985,6 +1985,13 @@ var claimFixtures = map[string]claimFixture{
status: http.StatusConflict,
msg: claimOfflineMoveUnsupportedMsg,
}},
+ "route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/nudge": {refused: &claimRefusalFixture{
+ apps: claimRefs("bab/titogo"),
+ setup: func(t *testing.T, cx *claimCase) { cx.offlineMove(t, provision.OfflineStopping) },
+ do: claimRefusedAPI(http.MethodPost, "/api/cli/apps/bab/titogo/instances/acme.go.tito.io/move/offline/nudge", ""),
+ status: http.StatusConflict,
+ msg: claimOfflineMoveUnsupportedMsg,
+ }},
"route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/open": {refused: &claimRefusalFixture{
apps: claimRefs("bab/titogo"),
setup: func(t *testing.T, cx *claimCase) { cx.offlineMove(t, provision.OfflineLanded) },
diff --git a/internal/console/linkedpolicy.go b/internal/console/linkedpolicy.go
index 6a3a7ff0e..5afc5efe5 100644
--- a/internal/console/linkedpolicy.go
+++ b/internal/console/linkedpolicy.go
@@ -202,6 +202,7 @@ var linkedPolicies = map[string]linkedPolicy{
"POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/open": linkedRefuse,
"POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/finish": linkedRefuse,
"POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/abort": linkedRefuse,
+ "POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/nudge": linkedRefuse,
"DELETE /api/cli/apps/{account}/{app}/instances/{host}": linkedRefuse,
"PUT /api/cli/apps/{account}/{app}/instances/{host}/import": linkedRefuse,
"POST /api/cli/apps/{account}/{app}/instances/{host}/import/stopped": linkedRefuse,
diff --git a/internal/console/routedecls.go b/internal/console/routedecls.go
index d9fe44015..ee2026f39 100644
--- a/internal/console/routedecls.go
+++ b/internal/console/routedecls.go
@@ -715,6 +715,7 @@ var routeDecls = []routeDecl{
{Pattern: "POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/open", Kind: kindCLI, Allow: svcrole.Allow(svcrole.Instance), Build: func(s *Server) http.HandlerFunc { return s.offlineVerbDoor(offlineVerbOpen) }},
{Pattern: "POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/finish", Kind: kindCLI, Allow: svcrole.Allow(svcrole.Instance), Build: func(s *Server) http.HandlerFunc { return s.offlineVerbDoor(offlineVerbFinish) }},
{Pattern: "POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/abort", Kind: kindCLI, Allow: svcrole.Allow(svcrole.Instance), Handler: (*Server).handleAPIInstanceOfflineAbort},
+ {Pattern: "POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/nudge", Kind: kindCLI, Allow: svcrole.Allow(svcrole.Instance), Handler: (*Server).handleAPIInstanceOfflineNudge},
{Pattern: "DELETE /api/cli/apps/{account}/{app}/instances/{host}", Kind: kindCLIScoped, Allow: svcrole.Allow(svcrole.Instance), Target: scopeHost, Handler: (*Server).handleAPIInstanceDelete},
// The import door (seeded-instances spec §5): the instance role, like
// the create door that begins it.
diff --git a/internal/console/svcroutes_test.go b/internal/console/svcroutes_test.go
index ee25cc619..51836b3d9 100644
--- a/internal/console/svcroutes_test.go
+++ b/internal/console/svcroutes_test.go
@@ -771,6 +771,7 @@ var exemptFromLegacyPin = map[string]bool{
"POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/open": true,
"POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/finish": true,
"POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/abort": true,
+ "POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/nudge": true,
"GET /api/cli/apps/{account}/{app}/sidecars": true,
"POST /api/cli/apps/{account}/{app}/sidecars": true,
"GET /api/cli/apps/{account}/{app}/sidecars/{name}": true,
diff --git a/internal/console/testdata/claim-routes.txt b/internal/console/testdata/claim-routes.txt
index 99a771331..8522e136f 100644
--- a/internal/console/testdata/claim-routes.txt
+++ b/internal/console/testdata/claim-routes.txt
@@ -301,6 +301,7 @@ route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline
route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/abort
route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/finish
route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/flip
+route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/nudge
route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/open
route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/seal
route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline/stage