carlos / platform Public

moves: offline move status leads with the state (Task 6)

carlos move offline status now prints the state name first (OR30 to
OR38), then label and value rows: move, offline (since requested_at,
only once started; until opened_at once open), this step (since
updated_at), the console's waiting sentence, the one command forward
(OR44 while not yet cleared; none when the step failed) and back (only
with can_abort). Item, report and left lines follow unchanged; staging
keeps its progress line. offlineView reads requested_at, updated_at
and opened_at. Tests, e2e witnesses and the census overlay updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 14a2f01b900fb23f3c981da3d33ec79c83dafb0f parent 99c46da
7 files changed, +272 −37
  • approved_moves_copy_test.go +3 −0
  • docs/superpowers/plans/2026-10-06-moves-phase1-copy.md +18 −0
  • internal/provision/testdata/plan14-root-reads-omr-run.tsv +1 −1
  • move.go +125 −3
  • move_offline_run_test.go +74 −0
  • move_test.go +35 −25
  • offline_move_e2e_test.go +16 −8

CI failed — run details

diff --git a/approved_moves_copy_test.go b/approved_moves_copy_test.go
index 9c57abb39..8b79669d9 100644
--- a/approved_moves_copy_test.go
+++ b/approved_moves_copy_test.go
@@ -120,6 +120,9 @@ var movesCopyIDs = []string{
"OR10", "OR11", "OR12", "OR13", "OR14", "OR15", "OR16", "OR17", "OR18", "OR19",
"OR20", "OR21", "OR22", "OR23", "OR24", "OR25", "OR26", "OR27", "OR28", "OR29",
"OR40", "OR45",
+ // carlos move offline status's dashboard (the same plan, Task 6).
+ "OR30", "OR31", "OR32", "OR33", "OR34", "OR35", "OR36", "OR37", "OR38",
+ "OR41", "OR42", "OR43", "OR44",
}
// copyRow is one row of the record. The File cell is the file the sentence is
diff --git a/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md b/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md
index 162a9e184..38fb6a6a7 100644
--- a/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md
+++ b/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md
@@ -773,3 +773,21 @@ Approved by Luna on 2026-11-15 under Paul's 2026-10-25 delegation (deck `docs/dr
| OR29 | move_offline_run.go | Stopped watching. The move is still running. To see where it is, run: | approved |
| OR40 | move_offline_run.go | <host> is already served from <to>, so the move is not undone. Stopped watching. | approved |
| OR45 | move_offline_run.go | cannot write the log <path>: <system error> | approved |
+
+`carlos move offline status` leads with the state (OR30 to OR38, one per record state), then a block of label and value rows (OR41's labels, in that order) and then the item, report and left lines as before. OR42 is the move row, OR43 the offline row (only once the move started: not while staging, not for an abandoned stage; for an open move, until it opened), OR44 follows the forward command while the console has not cleared that step. The this-step row's value is a duration, the waiting row's the console's own sentence, and the forward and back rows' commands; none of them is a sentence. The rows are written by `offlineStatusRow`, not a sink: their fixed words are these rows.
+
+| id | file | text | status |
+|---|---|---|---|
+| OR30 | move.go | Staging | approved |
+| OR31 | move.go | Stopping | approved |
+| OR32 | move.go | Copying | approved |
+| OR33 | move.go | Copied | approved |
+| OR34 | move.go | Starting in <to> | approved |
+| OR35 | move.go | Ready to open | approved |
+| OR36 | move.go | Open | approved |
+| OR37 | move.go | Finishing | approved |
+| OR38 | move.go | Moving back | approved |
+| OR41 | move.go | move | offline | this step | waiting | forward | back | approved |
+| OR42 | move.go | <id>, <from> to <to> | approved |
+| OR43 | move.go | <duration>, since <time> | approved |
+| OR44 | move.go | , when ready | approved |
diff --git a/internal/provision/testdata/plan14-root-reads-omr-run.tsv b/internal/provision/testdata/plan14-root-reads-omr-run.tsv
index bb533235c..d2a4024e9 100644
--- a/internal/provision/testdata/plan14-root-reads-omr-run.tsv
+++ b/internal/provision/testdata/plan14-root-reads-omr-run.tsv
@@ -3,5 +3,5 @@
# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
@legacy 96caba3ca7e3572ea76608ad566ce3ffc57f45eacdc8434a1e3292968c852e37 move_offline_run.go mover.offlineRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-omr-run;basis=new: carlos move offline run (offline move run plan, Task 5). Opens the operator's own --log path to append the run's output (os.OpenFile, O_APPEND|O_CREATE|O_WRONLY, 0600); reads nothing from it. The verb refuses root (moveMain, L25) before it gets here, so this is never a root read. file:OpenFile@112 685caad00fcc6041ece9f4658a2b2356096247ead6537b6018bb09c565dafc8d
move_offline_run.go mover.offlineRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-omr-run;basis=new: carlos move offline run (offline move run plan, Task 5). Opens the operator's own --log path to append the run's output (os.OpenFile, O_APPEND|O_CREATE|O_WRONLY, 0600); reads nothing from it. The verb refuses root (moveMain, L25) before it gets here, so this is never a root read. file:OpenFile@112 685caad00fcc6041ece9f4658a2b2356096247ead6537b6018bb09c565dafc8d
-@coverage . e189daf25cf6553e3e6c3299b070bd282e006df8f9bcc7d11fd4c535f1cd84f8
+@coverage . 62cf01f89c0e7d04d80f621b7dc91a4e0c0f5b52c9f6841527c30659d3803699
@coverage internal/moves/offlinerun d7126c127296a9490621fd5119ca3bb4951f9c295266b2bacfe7d9d60f10b4d8
diff --git a/move.go b/move.go
index d5a5fc043..50bf51e47 100644
--- a/move.go
+++ b/move.go
@@ -312,7 +312,11 @@ func moveMain(ctx context.Context, args []string, out io.Writer, d moveDeps) int
}
acct := resolvedAccount(sess, &a.account, &a.accountID)
app := resolvedApp(sess, acct, a.app, moveNoApp)
- m := &mover{sess: sess, out: out, host: a.host, poll: d.poll,
+ now := d.now
+ if now == nil {
+ now = time.Now
+ }
+ m := &mover{sess: sess, out: out, host: a.host, poll: d.poll, now: now,
path: apiPath(acct, app, "/instances/"+url.PathEscape(a.host)+"/move")}
// The offline move is the operator's tool for a console with Phase 1 off.
@@ -449,6 +453,8 @@ type mover struct {
host string
path string
poll time.Duration
+ // now is the wall clock (moveDeps.now, else time.Now): status's times.
+ now func() time.Time
// limited: a 429 was answered, so the command waits 10 seconds between
// calls now and has said so (once).
limited bool
@@ -1111,6 +1117,12 @@ type offlineView struct {
// StagedAt is the latest stage request (Unix nanoseconds), which
// Copying.Answered equals once the stager has run its round.
StagedAt int64 `json:"staged_at"`
+ // RequestedAt is when the move was requested, reset by start (Unix
+ // seconds); UpdatedAt when the record last changed; OpenedAt when it
+ // opened. 0 from a console that does not send them.
+ RequestedAt int64 `json:"requested_at"`
+ UpdatedAt int64 `json:"updated_at"`
+ OpenedAt int64 `json:"opened_at"`
// Failed: a box's report says the step cannot finish (the status view's
// own flag; the CLI says MV-O6 or MV-O9 for it).
Failed bool `json:"failed"`
@@ -1627,15 +1639,25 @@ func (w *offlineRun) runStatus(ctx context.Context) int {
}
return moveExitDone
}
- w.headline(r)
+ // The state first, then the block (plan 2026-11-15-offline-move-run,
+ // Task 6), then what the boxes say.
+ w.sayStateName(v)
+ w.statusBlock(r)
if v.State == provision.OfflineStaging {
// Nothing of the manifest is checked before the start, so the
- // items would all say waiting. The stage's own line said it.
+ // items would all say waiting. The stage's own line says it.
+ w.sayStaged(v)
if v.Copying != nil && v.Copying.Phase == moves.OfflinePhaseFailed {
return moveExitWaiting
}
return moveExitDone
}
+ if v.State == provision.OfflineReverting && v.NeverOffline {
+ // An abort from staging: nothing moved and nothing comes back,
+ // only the staged copy goes (#339).
+ moveSay(w.m.out, fmt.Sprintf("Nothing moved. The stage of %s was abandoned, and %s kept serving in %s.", host, host, v.fromPlace()))
+ }
+ w.sayFailure(v)
failed := false
for _, it := range v.Items {
if v.NeverOffline {
@@ -1666,6 +1688,106 @@ func (w *offlineRun) runStatus(ctx context.Context) int {
return moveExitDone
}
+// sayStateName is status's first line: the state, in a word or two
+// (OR30 to OR38). A state this CLI does not know is shown as the console
+// named it.
+func (w *offlineRun) sayStateName(v offlineView) {
+ switch v.State {
+ case provision.OfflineStaging:
+ moveSay(w.m.out, "Staging")
+ case provision.OfflineStopping:
+ moveSay(w.m.out, "Stopping")
+ case provision.OfflineSealing:
+ moveSay(w.m.out, "Copying")
+ case provision.OfflineSealed:
+ moveSay(w.m.out, "Copied")
+ case provision.OfflineLanding:
+ moveSay(w.m.out, fmt.Sprintf("Starting in %s", v.toPlace()))
+ case provision.OfflineLanded:
+ moveSay(w.m.out, "Ready to open")
+ case provision.OfflineOpen:
+ moveSay(w.m.out, "Open")
+ case provision.OfflineFinishing:
+ moveSay(w.m.out, "Finishing")
+ case provision.OfflineReverting:
+ moveSay(w.m.out, "Moving back")
+ default:
+ fmt.Fprintln(w.m.out, v.State)
+ }
+}
+
+// offlineStatusLabels are the block's labels in order (OR41, as approved).
+const offlineStatusLabels = "move | offline | this step | waiting | forward | back"
+
+// offlineWhenReady is OR44: the forward command waits for the console.
+const offlineWhenReady = ", when ready"
+
+// offlineForward is the verb that moves a state on, whether or not the
+// console has cleared it yet ("" for none).
+func offlineForward(state string) string {
+ switch state {
+ case provision.OfflineStaging:
+ return "start"
+ case provision.OfflineStopping:
+ return "seal"
+ case provision.OfflineSealing, provision.OfflineSealed:
+ return "flip"
+ case provision.OfflineLanding, provision.OfflineLanded:
+ return "open"
+ case provision.OfflineOpen, provision.OfflineFinishing, provision.OfflineReverting:
+ return "finish"
+ }
+ return ""
+}
+
+// offlineStatusRow is one row of status's block: a label and its value.
+// The block is data (an id, regions, times, commands); its fixed words are
+// OR41 to OR44, so the rows are written here rather than said as
+// sentences.
+func offlineStatusRow(out io.Writer, label, value string) {
+ fmt.Fprintf(out, " %-12s%s\n", label, value)
+}
+
+// statusBlock is status's label and value rows (the UX pass in
+// docs/drafts/offline-move-run): the move, how long it has been offline,
+// how long in this step, what it waits for, the one command forward and
+// the one back.
+func (w *offlineRun) statusBlock(r offlineReply) {
+ v, host, out := r.v, w.m.host, w.m.out
+ label := strings.Split(offlineStatusLabels, " | ")
+ now := w.m.now()
+ offlineStatusRow(out, label[0], fmt.Sprintf("%s, %s to %s", v.ID, v.fromPlace(), v.toPlace()))
+ if v.State != provision.OfflineStaging && !v.NeverOffline && v.RequestedAt != 0 {
+ since := time.Unix(v.RequestedAt, 0)
+ until := now
+ if v.OpenedAt != 0 {
+ until = time.Unix(v.OpenedAt, 0)
+ }
+ offlineStatusRow(out, label[1], fmt.Sprintf("%s, since %s", runDuration(until.Sub(since)), runClock(since)))
+ }
+ if v.UpdatedAt != 0 {
+ offlineStatusRow(out, label[2], runDuration(now.Sub(time.Unix(v.UpdatedAt, 0))))
+ }
+ if r.hasWaiting {
+ fmt.Fprintf(out, " %-12s", label[3])
+ saySpoken(out, r.waiting)
+ }
+ _, _, failed := v.failure()
+ if verb := offlineForward(v.State); verb != "" && !(failed && v.CanAbort) {
+ cmd := "carlos move offline " + verb + " --host " + host
+ if verb == "start" {
+ cmd += " --to " + v.To
+ }
+ if v.Next != verb {
+ cmd += offlineWhenReady
+ }
+ offlineStatusRow(out, label[4], cmd)
+ }
+ if v.CanAbort {
+ offlineStatusRow(out, label[5], "carlos move offline abort --host "+host)
+ }
+}
+
// runStage posts the stage door, then waits for the round that answers the
// stage request the post made (or a later one's, if another terminal ran
// stage meanwhile).
diff --git a/move_offline_run_test.go b/move_offline_run_test.go
index 0c34b6592..80929f11d 100644
--- a/move_offline_run_test.go
+++ b/move_offline_run_test.go
@@ -617,3 +617,77 @@ func TestMoveOfflineRunNoFinish(t *testing.T) {
}
wantLines(t, out, oServed)
}
+
+// runOfflineStatusAt is `carlos move offline status` against c with the
+// wall clock stopped at now.
+func runOfflineStatusAt(t *testing.T, c *fakeOfflineConsole, now time.Time) (int, string) {
+ t.Helper()
+ ts := httptest.NewServer(c)
+ t.Cleanup(ts.Close)
+ var out bytes.Buffer
+ deps := moveDeps{
+ session: func(string) (*apiSession, error) {
+ return &apiSession{c: newConsoleClient(ts.URL, "cli-token"), console: ts.URL, address: "op@keymail.dev"}, nil
+ },
+ euid: func() int { return 1000 },
+ poll: time.Millisecond,
+ now: func() time.Time { return now },
+ }
+ code := moveMain(context.Background(), []string{"offline", "status", "--host", oHost, "--account", "bab", "--app", "shop"}, &out, deps)
+ return code, out.String()
+}
+
+// Task 6's acceptance: the state first, then the move's id, how long it has
+// been offline (requested_at) and how long in this step (updated_at).
+func TestMoveOfflineStatusLeadsWithTheState(t *testing.T) {
+ now := time.Date(2026, 11, 15, 6, 15, 56, 0, time.UTC)
+ const waiting = "the sealer has not reported the copy yet"
+ c := &fakeOfflineConsole{gets: []frame{offView("offline-sealing", frame{
+ "requested_at": now.Add(-192 * time.Second).Unix(), "updated_at": now.Add(-41 * time.Second).Unix(),
+ "waiting": waiting, "can_abort": true,
+ "items": []frame{{"id": "db", "owner": "seal", "status": "ok"}},
+ })}}
+ code, out := runOfflineStatusAt(t, c, now)
+ want := "Copying\n" +
+ " move " + tMoveID + ", ie to uk\n" +
+ " offline 3 min 12 s, since 06:12:44Z\n" +
+ " this step 41 s\n" +
+ " waiting " + waiting + "\n" +
+ " forward carlos move offline flip --host acme.shop.example.com, when ready\n" +
+ " back carlos move offline abort --host acme.shop.example.com\n" +
+ "Item db is ok.\n"
+ if code != 0 || out != want {
+ t.Fatalf("exit %d, output:\n%s\nwant:\n%s", code, out, want)
+ }
+
+ // Staging is not offline: no offline row, the step's time still shown.
+ c = &fakeOfflineConsole{gets: []frame{stageView(200, 0, "", frame{
+ "requested_at": now.Add(-time.Hour).Unix(), "updated_at": now.Add(-90 * time.Second).Unix()})}}
+ _, out = runOfflineStatusAt(t, c, now)
+ if !strings.HasPrefix(out, "Staging\n move "+tMoveID+", ie to uk\n this step 1 min 30 s\n") || strings.Contains(out, " offline ") {
+ t.Fatalf("staging:\n%s", out)
+ }
+
+ // Once open, offline is the time until it opened.
+ c = &fakeOfflineConsole{gets: []frame{offView("offline-open", frame{
+ "requested_at": now.Add(-10 * time.Minute).Unix(), "opened_at": now.Add(-10*time.Minute + 78*time.Second).Unix(),
+ "updated_at": now.Add(-5 * time.Second).Unix(), "next": "finish"})}}
+ _, out = runOfflineStatusAt(t, c, now)
+ want = "Open\n move " + tMoveID + ", ie to uk\n offline 1 min 18 s, since 06:05:56Z\n this step 5 s\n" +
+ " forward carlos move offline finish --host acme.shop.example.com\n"
+ if out != want {
+ t.Fatalf("open:\n%s\nwant:\n%s", out, want)
+ }
+
+ // Each state's first line (OR30 to OR38).
+ for state, name := range map[string]string{
+ "offline-staging": "Staging", "offline-stopping": "Stopping", "offline-sealing": "Copying", "offline-sealed": "Copied",
+ "offline-landing": "Starting in uk", "offline-landed": "Ready to open", "offline-open": "Open",
+ "offline-finishing": "Finishing", "offline-reverting": "Moving back",
+ } {
+ c = &fakeOfflineConsole{gets: []frame{offView(state, nil)}}
+ if _, out := runOfflineStatusAt(t, c, now); !strings.HasPrefix(out, name+"\n") {
+ t.Errorf("%s: first line of:\n%s", state, out)
+ }
+ }
+}
diff --git a/move_test.go b/move_test.go
index eb02908e8..2978bb671 100644
--- a/move_test.go
+++ b/move_test.go
@@ -1277,6 +1277,9 @@ const (
oBack = "Moving acme.shop.example.com back to ie."
oPutBack = "Every box has put acme.shop.example.com back in ie. Run carlos move offline finish --host acme.shop.example.com to end the move."
oWaitBox = "Waiting for ie-box in ie to confirm it has stopped acme.shop.example.com. acme.shop.example.com is offline."
+ // status's block (Task 6 of the run plan).
+ oMoveRow = " move " + tMoveID + ", ie to uk"
+ oBackRow = " back carlos move offline abort --host acme.shop.example.com"
)
func TestParseMoveArgsOffline(t *testing.T) {
@@ -1632,7 +1635,7 @@ func TestMoveOfflineStatus(t *testing.T) {
"reports": []frame{offReport("ie-box", "source", "stopped", true), offReport("ie-box", "sealer", "sealed", false)},
})}}
code, out := runOfflineAgainst(t, c, "status")
- want := oStarting + "\n" + oCopied + "\n" +
+ want := "Copied\n" + oMoveRow + "\n forward carlos move offline flip --host acme.shop.example.com\n" +
"Item db is waiting.\nItem files is ok: 12 files.\n" +
"ie-box is stopped as the source.\nie-box is sealed as the sealer. Its report is not current.\n"
if code != 0 || out != want {
@@ -1643,16 +1646,17 @@ func TestMoveOfflineStatus(t *testing.T) {
}
// A failed item is the operator's: exit 4.
- c = &fakeOfflineConsole{gets: []frame{offView("offline-landing", frame{"items": []frame{{"id": "db", "owner": "landing", "status": "failed", "detail": "digest differs"}}})}}
+ c = &fakeOfflineConsole{gets: []frame{offView("offline-landing", frame{"can_abort": true, "items": []frame{{"id": "db", "owner": "landing", "status": "failed", "detail": "digest differs"}}})}}
code, out = runOfflineAgainst(t, c, "status")
- wantF := oStarting + "\nuk could not take acme.shop.example.com: digest differs. Run carlos move offline abort --host acme.shop.example.com to move it back.\nItem db is failed: digest differs.\n"
+ wantF := "Starting in uk\n" + oMoveRow + "\n" + oBackRow + "\nuk could not take acme.shop.example.com: digest differs. Run carlos move offline abort --host acme.shop.example.com to move it back.\nItem db is failed: digest differs.\n"
if code != 4 || out != wantF {
t.Fatalf("exit %d, output:\n%s\nwant 4:\n%s", code, out, wantF)
}
// Waiting states say the console's sentence.
c = &fakeOfflineConsole{gets: []frame{offView("offline-stopping", frame{"waiting": oWaitBox})}}
- if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != oStarting+"\n"+oWaitBox+"\n" {
+ if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "Stopping\n"+oMoveRow+"\n waiting "+oWaitBox+
+ "\n forward carlos move offline seal --host acme.shop.example.com, when ready\n" {
t.Fatalf("exit %d:\n%s", code, out)
}
@@ -1672,7 +1676,7 @@ func TestMoveOfflineWaitingAfterOpenAndAbort(t *testing.T) {
c := &fakeOfflineConsole{gets: []frame{offView("offline-finishing", frame{
"reports": []frame{offReport("ie-box", "source", "gone", true), offReport("ie-box", "sealer", "sealed", true)}})}}
code, out := runOfflineAgainst(t, c, "status")
- want := oStarting + "\n" + oServed + "\nWaiting for ie-box to clean up acme.shop.example.com.\n" +
+ want := "Finishing\n" + oMoveRow + "\n forward carlos move offline finish --host acme.shop.example.com, when ready\n" +
"ie-box is gone as the source.\nie-box is sealed as the sealer.\n"
if code != 0 || out != want {
t.Fatalf("exit %d, output:\n%s\nwant:\n%s", code, out, want)
@@ -1774,26 +1778,30 @@ func TestMoveOfflineStatusFailed(t *testing.T) {
state string
extra frame
say string
+ first string
}{
{"failed seal, flag only", "offline-sealing", frame{"failed": true},
- "The move could not finish a step: failed. Run carlos move offline status --host acme.shop.example.com for each item."},
+ "The move could not finish a step: failed. Run carlos move offline status --host acme.shop.example.com for each item.", "Copying"},
{"failed seal, sealer report", "offline-sealing", frame{"failed": true, "reports": []frame{sealerFailed}},
- "The move could not finish a step: special file in the archive. Run carlos move offline status --host acme.shop.example.com for each item."},
+ "The move could not finish a step: special file in the archive. Run carlos move offline status --host acme.shop.example.com for each item.", "Copying"},
{"failed landing, target report", "offline-landed", frame{"failed": true, "reports": []frame{targetFailed}},
- "uk could not take acme.shop.example.com: failed. Run carlos move offline abort --host acme.shop.example.com to move it back."},
+ "uk could not take acme.shop.example.com: failed. Run carlos move offline abort --host acme.shop.example.com to move it back.", "Ready to open"},
{"failed target before the flip", "offline-stopping", frame{"failed": true, "reports": []frame{targetFailed}},
- "uk could not take acme.shop.example.com: failed. Run carlos move offline abort --host acme.shop.example.com to move it back."},
+ "uk could not take acme.shop.example.com: failed. Run carlos move offline abort --host acme.shop.example.com to move it back.", "Stopping"},
} {
t.Run(c.name, func(t *testing.T) {
+ c.extra["can_abort"] = true
f := &fakeOfflineConsole{gets: []frame{offView(c.state, c.extra)}}
code, out := runOfflineAgainst(t, f, "status")
if code != 4 {
t.Errorf("exit %d, want 4:\n%s", code, out)
}
- if !strings.HasPrefix(out, oStarting+"\n"+c.say+"\n") {
- t.Errorf("output:\n%s\nwant the failure line after the headline: %s", out, c.say)
+ if !strings.HasPrefix(out, c.first+"\n"+oMoveRow+"\n") || !strings.Contains(out, "\n"+c.say+"\n") {
+ t.Errorf("output:\n%s\nwant the state, the block and the failure line: %s", out, c.say)
}
- wantNoLine(t, out, "Copying")
+ // A failed seal is not said as progress, and abort is the
+ // way on: no command forward.
+ wantNoLine(t, out, oCopying, " forward ")
})
}
}
@@ -1837,8 +1845,9 @@ func TestMoveOfflineFailedReportAfterTheOpen(t *testing.T) {
t.Run(c.name, func(t *testing.T) {
f := &fakeOfflineConsole{gets: []frame{offView(c.state, frame{"reports": []frame{c.rep}})}}
code, out := runOfflineAgainst(t, f, "status")
- if code != 4 || !strings.HasPrefix(out, oStarting+"\n"+c.say+"\n") {
- t.Errorf("status exit %d, output:\n%s\nwant 4 and %q after the headline", code, out, c.say)
+ if code != 4 || !strings.HasPrefix(out, map[string]string{"offline-open": "Open", "offline-finishing": "Finishing", "offline-reverting": "Moving back"}[c.state]+"\n"+oMoveRow+"\n") ||
+ !strings.Contains(out, "\n"+c.say+"\n") {
+ t.Errorf("status exit %d, output:\n%s\nwant 4, the state, the block and %q", code, out, c.say)
}
if c.state == "offline-open" {
f := &fakeOfflineConsole{
@@ -1928,12 +1937,14 @@ func TestMoveOfflineStage(t *testing.T) {
func TestMoveOfflineStatusWhileStaging(t *testing.T) {
c := &fakeOfflineConsole{gets: []frame{stageView(200, 0, "", nil)}}
code, out := runOfflineAgainst(t, c, "status")
- if want := oStaging + "\nWaiting for the first staging round of acme.shop.example.com.\n"; code != 0 || out != want {
+ if want := "Staging\n" + oMoveRow + "\n forward carlos move offline start --host acme.shop.example.com --to uk, when ready\n" + oBackRow +
+ "\nWaiting for the first staging round of acme.shop.example.com.\n"; code != 0 || out != want {
t.Fatalf("exit %d, output:\n%s\nwant 0:\n%s", code, out, want)
}
c = &fakeOfflineConsole{gets: []frame{stageView(200, 200, "staged", frame{"next": "start"})}}
code, out = runOfflineAgainst(t, c, "status")
- want := oStaging + "\nStaged 305 of 305 objects for acme.shop.example.com in uk (1580.0 of 1580.0 MB) at 2026-10-21 09:00 UTC.\n" + oReady + "\n"
+ want := "Staging\n" + oMoveRow + "\n forward carlos move offline start --host acme.shop.example.com --to uk\n" + oBackRow +
+ "\nStaged 305 of 305 objects for acme.shop.example.com in uk (1580.0 of 1580.0 MB) at 2026-10-21 09:00 UTC.\n"
if code != 0 || out != want {
t.Fatalf("exit %d, output:\n%s\nwant 0:\n%s", code, out, want)
}
@@ -1970,12 +1981,13 @@ func TestMoveOfflineStatusAfterAStagedAbort(t *testing.T) {
c := &fakeOfflineConsole{gets: []frame{offView("offline-reverting", frame{"never_offline": true, "sealer": "", "items": items,
"reports": []frame{offReport("ie-box", "source", "reverted", true)}})}}
code, out := runOfflineAgainst(t, c, "status")
- if want := nothing + "\n" + oUnstage + "\nie-box is reverted as the source.\n"; code != 0 || out != want {
+ if want := "Moving back\n" + oMoveRow + "\n forward carlos move offline finish --host acme.shop.example.com, when ready\n" +
+ nothing + "\nie-box is reverted as the source.\n"; code != 0 || out != want {
t.Fatalf("exit %d, output:\n%s\nwant 0:\n%s", code, out, want)
}
c = &fakeOfflineConsole{gets: []frame{offView("offline-reverting", frame{"never_offline": true, "sealer": "", "next": "finish", "items": items})}}
code, out = runOfflineAgainst(t, c, "status")
- if want := nothing + "\n" + oUnstaged + "\n"; code != 0 || out != want {
+ if want := "Moving back\n" + oMoveRow + "\n forward carlos move offline finish --host acme.shop.example.com\n" + nothing + "\n"; code != 0 || out != want {
t.Fatalf("exit %d, output:\n%s\nwant 0:\n%s", code, out, want)
}
for _, line := range []string{oStarting, oBack, "Item "} {
@@ -2022,17 +2034,15 @@ func TestMoveLinesNameRegionsByLabel(t *testing.T) {
func TestMoveOfflineLinesNameRegionsByLabel(t *testing.T) {
named := func(f frame) frame { f["from_name"], f["to_name"] = "Dublin (IE)", "London (UK)"; return f }
c := &fakeOfflineConsole{gets: []frame{named(offView("offline-sealed", frame{"next": "flip"}))}}
- if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "Moving "+oHost+" from Dublin (IE) to London (UK).\n"+
- "Copied and checked. Run carlos move offline flip --host "+oHost+" to start it in London (UK).\n" {
+ if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "Copied\n move "+tMoveID+", Dublin (IE) to London (UK)\n"+
+ " forward carlos move offline flip --host "+oHost+"\n" {
t.Fatalf("exit %d:\n%s", code, out)
}
// Staged, ready to start: the prose names the label, the command keeps
// the code an operator pastes.
c = &fakeOfflineConsole{gets: []frame{named(offView("offline-staging", frame{"next": "start"}))}}
_, out := runOfflineAgainst(t, c, "status")
- wantLines(t, out,
- "Staging "+oHost+" in London (UK). "+oHost+" keeps serving while the data is copied.",
- oHost+" keeps serving. Run carlos move offline start --host "+oHost+" --to uk when you are ready to take it offline.")
+ wantLines(t, out, "Staging", " forward carlos move offline start --host "+oHost+" --to uk")
// No bare code in prose, in any state: once the labels, the box name
// and --to's value are taken out, no "ie" or "uk" is left.
bare := regexp.MustCompile(`\b(ie|uk)\b`)
@@ -2047,9 +2057,9 @@ func TestMoveOfflineLinesNameRegionsByLabel(t *testing.T) {
}
}
}
- // An older console: today's bytes (TestMoveOfflineStatus's oStarting).
+ // An older console: the codes (TestMoveOfflineStatus's oMoveRow).
c = &fakeOfflineConsole{gets: []frame{offView("offline-sealed", frame{"next": "flip"})}}
- if _, out := runOfflineAgainst(t, c, "status"); !strings.HasPrefix(out, oStarting+"\n"+oCopied+"\n") {
+ if _, out := runOfflineAgainst(t, c, "status"); !strings.HasPrefix(out, "Copied\n"+oMoveRow+"\n") {
t.Fatalf("older console:\n%s", out)
}
}
diff --git a/offline_move_e2e_test.go b/offline_move_e2e_test.go
index 1c7125041..fafc6285c 100644
--- a/offline_move_e2e_test.go
+++ b/offline_move_e2e_test.go
@@ -196,10 +196,15 @@ func TestMoveOfflineAgainstTheRealDoors(t *testing.T) {
t.Fatal("start never moved the record")
}
- // status, before the box has reported: the console's own waiting sentence.
+ // status, before the box has reported: the state first, then the
+ // block with the console's own waiting sentence, then the items.
code, out := run(ctx, "status")
wantWait := "Waiting for ie-box in ie to confirm it has stopped " + host + ". " + host + " is offline."
- wantLines(t, out, "Moving "+host+" from ie to uk.", wantWait, "Item class is ok.", "Item db is waiting.")
+ if !strings.HasPrefix(out, "Stopping\n move "+id+", ie to uk\n offline ") {
+ t.Errorf("status does not lead with the state and the move:\n%s", out)
+ }
+ wantLines(t, out, " waiting "+wantWait, " forward carlos move offline seal --host "+host+", when ready",
+ " back carlos move offline abort --host "+host, "Item class is ok.", "Item db is waiting.")
if code != 0 {
t.Fatalf("status exit %d:\n%s", code, out)
}
@@ -217,8 +222,7 @@ func TestMoveOfflineAgainstTheRealDoors(t *testing.T) {
t.Fatal("start never finished")
}
code, out = run(ctx, "status")
- wantLines(t, out, "Every box in ie has stopped "+host+". Run carlos move offline seal --host "+host+" to copy it.",
- "ie-box is stopped as the source.")
+ wantLines(t, out, " forward carlos move offline seal --host "+host, "ie-box is stopped as the source.")
if code != 0 {
t.Fatalf("status exit %d:\n%s", code, out)
}
@@ -318,7 +322,8 @@ func TestMoveOfflineStageAgainstTheRealDoors(t *testing.T) {
if code != 0 {
t.Fatalf("status exit %d:\n%s", code, out)
}
- wantLines(t, out, staging, ready)
+ wantLines(t, out, "Staging", " forward carlos move offline start --host "+host+" --to uk")
+ wantNoLine(t, out, staging, ready, " offline ")
// abort from staging: the staged copy goes, then finish.
actx, cancel := context.WithTimeout(ctx, 30*time.Second)
@@ -381,8 +386,11 @@ func TestMoveOfflineNamesRegionsThroughTheRealDoors(t *testing.T) {
t.Fatalf("status exit %d:\n%s", code, out)
}
wantLines(t, out,
- "Moving "+e.host+" from Dublin (IE) to London (UK).",
- "Waiting for ie-box in Dublin (IE) to confirm it has stopped "+e.host+". "+e.host+" is offline.")
+ "Stopping",
+ " waiting Waiting for ie-box in Dublin (IE) to confirm it has stopped "+e.host+". "+e.host+" is offline.")
+ if !strings.Contains(out, ", Dublin (IE) to London (UK)\n") {
+ t.Errorf("the move row does not name the regions by label:\n%s", out)
+ }
cancel()
<-done
}
@@ -480,6 +488,6 @@ func TestMoveOfflineFlipStepsOverAPoolBox(t *testing.T) {
if code != 0 {
t.Fatalf("status exit %d:\n%s", code, out)
}
- wantLines(t, out, ready)
+ wantLines(t, out, "Ready to open", " forward carlos move offline open --host "+host)
wantNoLine(t, out, "could not take", "uk-a-pool")
}