From c75fc9651db3df4d40bd379bec60b213ca2078e7 Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Mon, 29 Sep 2025 15:46:44 -0400 Subject: [PATCH 1/2] Show 'tests running' as a state --- cmd/goose/main_test.go | 23 +++++++++++++++++++++++ cmd/goose/ui.go | 9 +++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/cmd/goose/main_test.go b/cmd/goose/main_test.go index 8e0df14..03a99e5 100644 --- a/cmd/goose/main_test.go +++ b/cmd/goose/main_test.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "runtime" + "strings" "sync" "testing" "time" @@ -110,6 +111,17 @@ func TestMenuItemTitleTransition(t *testing.T) { // This simulates what addPRSection does when building menu items for _, pr := range app.incoming { title := fmt.Sprintf("%s #%d", pr.Repository, pr.Number) + + // Add action code if present, or test state as fallback + if pr.ActionKind != "" { + // Replace underscores with spaces for better readability + actionDisplay := strings.ReplaceAll(pr.ActionKind, "_", " ") + title = fmt.Sprintf("%s — %s", title, actionDisplay) + } else if pr.TestState == "running" { + // Show "tests running" as a fallback when no specific action is available + title = fmt.Sprintf("%s — tests running", title) + } + if pr.NeedsReview { if !pr.FirstBlockedAt.IsZero() && time.Since(pr.FirstBlockedAt) < testBlockDuration { title = fmt.Sprintf("🪿 %s", title) @@ -122,6 +134,17 @@ func TestMenuItemTitleTransition(t *testing.T) { for _, pr := range app.outgoing { title := fmt.Sprintf("%s #%d", pr.Repository, pr.Number) + + // Add action code if present, or test state as fallback + if pr.ActionKind != "" { + // Replace underscores with spaces for better readability + actionDisplay := strings.ReplaceAll(pr.ActionKind, "_", " ") + title = fmt.Sprintf("%s — %s", title, actionDisplay) + } else if pr.TestState == "running" { + // Show "tests running" as a fallback when no specific action is available + title = fmt.Sprintf("%s — tests running", title) + } + if pr.IsBlocked { if !pr.FirstBlockedAt.IsZero() && time.Since(pr.FirstBlockedAt) < testBlockDuration { title = fmt.Sprintf("🎉 %s", title) diff --git a/cmd/goose/ui.go b/cmd/goose/ui.go index 909a015..e040076 100644 --- a/cmd/goose/ui.go +++ b/cmd/goose/ui.go @@ -308,9 +308,14 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string, title := fmt.Sprintf("%s #%d", sortedPRs[prIndex].Repository, sortedPRs[prIndex].Number) - // Add action code if present + // Add action code if present, or test state as fallback if sortedPRs[prIndex].ActionKind != "" { - title = fmt.Sprintf("%s — %s", title, sortedPRs[prIndex].ActionKind) + // Replace underscores with spaces for better readability + actionDisplay := strings.ReplaceAll(sortedPRs[prIndex].ActionKind, "_", " ") + title = fmt.Sprintf("%s — %s", title, actionDisplay) + } else if sortedPRs[prIndex].TestState == "running" { + // Show "tests running" as a fallback when no specific action is available + title = fmt.Sprintf("%s — tests running", title) } // Add bullet point or emoji based on PR status From 3517993dc398e5ad4714fbdc75b7a99a4e372e83 Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Mon, 29 Sep 2025 15:49:11 -0400 Subject: [PATCH 2/2] add ellipsis --- cmd/goose/main_test.go | 4 ++-- cmd/goose/ui.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/goose/main_test.go b/cmd/goose/main_test.go index 03a99e5..75a1cd1 100644 --- a/cmd/goose/main_test.go +++ b/cmd/goose/main_test.go @@ -119,7 +119,7 @@ func TestMenuItemTitleTransition(t *testing.T) { title = fmt.Sprintf("%s — %s", title, actionDisplay) } else if pr.TestState == "running" { // Show "tests running" as a fallback when no specific action is available - title = fmt.Sprintf("%s — tests running", title) + title = fmt.Sprintf("%s — tests running...", title) } if pr.NeedsReview { @@ -142,7 +142,7 @@ func TestMenuItemTitleTransition(t *testing.T) { title = fmt.Sprintf("%s — %s", title, actionDisplay) } else if pr.TestState == "running" { // Show "tests running" as a fallback when no specific action is available - title = fmt.Sprintf("%s — tests running", title) + title = fmt.Sprintf("%s — tests running...", title) } if pr.IsBlocked { diff --git a/cmd/goose/ui.go b/cmd/goose/ui.go index e040076..c59f470 100644 --- a/cmd/goose/ui.go +++ b/cmd/goose/ui.go @@ -315,7 +315,7 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string, title = fmt.Sprintf("%s — %s", title, actionDisplay) } else if sortedPRs[prIndex].TestState == "running" { // Show "tests running" as a fallback when no specific action is available - title = fmt.Sprintf("%s — tests running", title) + title = fmt.Sprintf("%s — tests running...", title) } // Add bullet point or emoji based on PR status