Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/tui/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ func (m *Model) planStripLabel() string {
// syncPlanPanelMsg refreshes the tab's empty/unavailable copy from state.
func (m *Model) syncPlanPanelMsg() {
switch {
case m.cl == nil || m.sessionID == "":
// No live session: fetchPlan is a silent no-op, so "loading plan…"
// would never resolve. Say why instead (attach completes → reset +
// refetch at the tail resolves this to a real snapshot).
m.panelMsg = "no active session yet — the plan loads when a run starts"
case m.planAvail == planUnavailable:
m.panelMsg = "plan unavailable on this engine · r retries"
case m.planAvail == planUnknown && !m.planInit:
Expand Down
19 changes: 19 additions & 0 deletions internal/tui/plan_tab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ func TestPlanTab_OpenerAndRenderedRows(t *testing.T) {
}
}

func TestPlanTab_UnattachedOpenerNeverShowsEternalLoading(t *testing.T) {
// Regression: opening the tab with no live session (no client / no
// session id) used to render "loading plan…" forever — fetchPlan was
// a silent no-op, so no reply ever resolved the placeholder.
m := newTestModel()
if c := m.openPlan(); c != nil {
t.Fatal("unattached opener must not issue a fetch")
}
if m.panel != panelPlan {
t.Fatalf("opener panel = %d", m.panel)
}
if strings.Contains(m.panelMsg, "loading") {
t.Fatalf("unattached tab shows eternal loading copy %q", m.panelMsg)
}
if got := plain(m.View()); !strings.Contains(got, "no active session") {
t.Errorf("unattached copy missing from view:\n%s", got)
}
}

func TestPlanTab_DetailFoldHouseGrammar(t *testing.T) {
m := newTestModel()
m.cl = &client.Client{}
Expand Down