From abb5910d2f72264a24f3cb3675823863b4e5aff2 Mon Sep 17 00:00:00 2001 From: Lemon-miaow Date: Wed, 23 Sep 2026 15:56:44 +0800 Subject: [PATCH] fix(cli): setup re-run keeps its already-set-up framing after connect/storage reconfigure --- cmd/felis/tui_root.go | 1 + cmd/felis/tui_root_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/cmd/felis/tui_root.go b/cmd/felis/tui_root.go index a0d83c6..11eebeb 100644 --- a/cmd/felis/tui_root.go +++ b/cmd/felis/tui_root.go @@ -553,6 +553,7 @@ func (m *rootModel) showSummary() (tea.Model, tea.Cmd) { storageLabel: m.result.storageDetail, routedHosts: routed, localHint: m.result.connectMethod == connectLocal, + alreadySetUp: m.result.alreadySetUp, }) } diff --git a/cmd/felis/tui_root_test.go b/cmd/felis/tui_root_test.go index efbf09b..7749ade 100644 --- a/cmd/felis/tui_root_test.go +++ b/cmd/felis/tui_root_test.go @@ -249,6 +249,34 @@ func TestRootReconfigureSMTP(t *testing.T) { } } +// TestRootReconfigureStorageKeepsStatusFraming locks the same rule for the +// "change storage" path: on a re-run, completing it must land back on the +// alreadySetUp status framing (with the updated recap), not "Setup complete." +func TestRootReconfigureStorageKeepsStatusFraming(t *testing.T) { + m := newTestRoot(true, consoleModeSetup, "") + m = drive(t, m, preflightDoneMsg{}) + if _, ok := m.screen.(*summaryModel); !ok { + t.Fatalf("re-run after preflight, screen = %T, want *summaryModel", m.screen) + } + + m = drive(t, m, reconfigureStorageMsg{}) + if _, ok := m.screen.(*storageChooserModel); !ok { + t.Fatalf("reconfigure-storage screen = %T, want *storageChooserModel", m.screen) + } + + m = drive(t, m, storageResultMsg{method: storageLocal, detail: "local disk · /var/lib/felis/uploads"}) + sum, ok := m.screen.(*summaryModel) + if !ok { + t.Fatalf("after reconfigure-storage, screen = %T, want *summaryModel", m.screen) + } + if !sum.alreadySetUp { + t.Fatalf("after reconfigure-storage, summary should keep the alreadySetUp framing") + } + if sum.storageLabel != "local disk · /var/lib/felis/uploads" { + t.Fatalf("storageLabel = %q, want the updated recap", sum.storageLabel) + } +} + func TestRootRerunLandsOnStatus(t *testing.T) { // adminExists at start of a setup run = re-run: preflight should skip straight // to the "manage in panel" status screen, never touching owner/connect.