diff --git a/cmd/reviewGOOSE/main_test.go b/cmd/reviewGOOSE/main_test.go index 2e622fd..745a5e8 100644 --- a/cmd/reviewGOOSE/main_test.go +++ b/cmd/reviewGOOSE/main_test.go @@ -205,7 +205,8 @@ func TestMenuItemTitleTransition(t *testing.T) { _ = ctx // Unused in this test but would be used for real menu operations } -// TestWorkflowStateNewlyPublished tests that PRs with NEWLY_PUBLISHED workflow state get a 💎 bullet. +// TestWorkflowStateNewlyPublished tests that PRs with NEWLY_PUBLISHED workflow state get a 💎 bullet +// only when updated within the last minute and not blocked/needing review. func TestWorkflowStateNewlyPublished(t *testing.T) { tests := []struct { name string @@ -213,7 +214,7 @@ func TestWorkflowStateNewlyPublished(t *testing.T) { expectedTitle string }{ { - name: "newly_published_with_action", + name: "newly_published_needs_review_gets_block_not_diamond", pr: PR{ Repository: "test/repo", Number: 123, @@ -222,10 +223,10 @@ func TestWorkflowStateNewlyPublished(t *testing.T) { NeedsReview: true, UpdatedAt: time.Now(), }, - expectedTitle: "💎 test/repo #123 — review", + expectedTitle: "■ test/repo #123 — review", }, { - name: "newly_published_without_action", + name: "newly_published_recent_gets_diamond", pr: PR{ Repository: "test/repo", Number: 456, @@ -235,7 +236,17 @@ func TestWorkflowStateNewlyPublished(t *testing.T) { expectedTitle: "💎 test/repo #456", }, { - name: "newly_published_with_running_tests", + name: "newly_published_stale_no_prefix", + pr: PR{ + Repository: "test/repo", + Number: 457, + WorkflowState: string(turn.StateNewlyPublished), + UpdatedAt: time.Now().Add(-2 * time.Minute), + }, + expectedTitle: "test/repo #457", + }, + { + name: "newly_published_with_running_tests_gets_diamond", pr: PR{ Repository: "test/repo", Number: 789, @@ -245,6 +256,17 @@ func TestWorkflowStateNewlyPublished(t *testing.T) { }, expectedTitle: "💎 test/repo #789 — tests running...", }, + { + name: "newly_published_with_action_gets_bullet_not_diamond", + pr: PR{ + Repository: "test/repo", + Number: 790, + ActionKind: "review", + WorkflowState: string(turn.StateNewlyPublished), + UpdatedAt: time.Now(), + }, + expectedTitle: "• test/repo #790 — review", + }, { name: "not_newly_published_with_action", pr: PR{ @@ -273,12 +295,15 @@ func TestWorkflowStateNewlyPublished(t *testing.T) { title = fmt.Sprintf("%s — tests running...", title) } - // Add prefix based on workflow state or blocked status + // Add prefix based on blocked status, action, or newly published + // (mirrors priority order in ui.go - diamond is lowest priority) switch { - case pr.WorkflowState == string(turn.StateNewlyPublished): - title = fmt.Sprintf("💎 %s", title) case pr.NeedsReview || pr.IsBlocked: title = fmt.Sprintf("■ %s", title) + case pr.ActionKind != "": + title = fmt.Sprintf("• %s", title) + case pr.WorkflowState == string(turn.StateNewlyPublished) && time.Since(pr.UpdatedAt) < time.Minute: + title = fmt.Sprintf("💎 %s", title) } return title diff --git a/cmd/reviewGOOSE/ui.go b/cmd/reviewGOOSE/ui.go index 08481e5..f7b906d 100644 --- a/cmd/reviewGOOSE/ui.go +++ b/cmd/reviewGOOSE/ui.go @@ -304,9 +304,6 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string, // Add bullet point or emoji based on PR status switch { - case pr.WorkflowState == string(turn.StateNewlyPublished): - // Use gem emoji for newly published PRs - title = fmt.Sprintf("💎 %s", title) case pr.NeedsReview || pr.IsBlocked: // Get the blocked time from state manager prState, hasState := app.stateManager.PRState(pr.URL) @@ -371,8 +368,11 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string, case pr.ActionKind != "": // PR has an action but isn't blocked - add bullet to indicate it could use input title = fmt.Sprintf("• %s", title) + case pr.WorkflowState == string(turn.StateNewlyPublished) && time.Since(pr.UpdatedAt) < time.Minute: + // Use gem emoji for newly published PRs updated within the last minute + title = fmt.Sprintf("💎 %s", title) default: - // No special prefix needed + // No prefix needed } // Format age for tooltip @@ -520,9 +520,6 @@ func (app *App) generatePRSectionTitles(prs []PR, sectionTitle string, hiddenOrg // Add bullet point or emoji for blocked PRs (same logic as in addPRSection) switch { - case pr.WorkflowState == string(turn.StateNewlyPublished): - // Use gem emoji for newly published PRs - title = fmt.Sprintf("💎 %s", title) case pr.NeedsReview || pr.IsBlocked: prState, hasState := app.stateManager.PRState(pr.URL) @@ -583,8 +580,11 @@ func (app *App) generatePRSectionTitles(prs []PR, sectionTitle string, hiddenOrg case pr.ActionKind != "": // PR has an action but isn't blocked - add bullet to indicate it could use input title = fmt.Sprintf("• %s", title) + case pr.WorkflowState == string(turn.StateNewlyPublished) && time.Since(pr.UpdatedAt) < time.Minute: + // Use gem emoji for newly published PRs updated within the last minute + title = fmt.Sprintf("💎 %s", title) default: - // No special prefix needed + // No prefix needed } titles = append(titles, title) diff --git a/go.mod b/go.mod index a099464..ab2abf0 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/gen2brain/beeep v0.11.2 github.com/godbus/dbus/v5 v5.2.2 github.com/google/go-github/v57 v57.0.0 - golang.org/x/image v0.34.0 + golang.org/x/image v0.35.0 golang.org/x/oauth2 v0.34.0 ) @@ -26,12 +26,12 @@ require ( github.com/jackmordaunt/icns/v3 v3.0.1 // indirect github.com/klauspost/compress v1.18.2 // indirect github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect - github.com/puzpuzpuz/xsync/v4 v4.2.0 // indirect + github.com/puzpuzpuz/xsync/v4 v4.3.0 // indirect github.com/sergeymakinen/go-bmp v1.0.0 // indirect github.com/sergeymakinen/go-ico v1.0.0 // indirect github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c // indirect - golang.org/x/net v0.48.0 // indirect - golang.org/x/sys v0.39.0 // indirect - golang.org/x/text v0.32.0 // indirect + golang.org/x/net v0.49.0 // indirect + golang.org/x/sys v0.40.0 // indirect + golang.org/x/text v0.33.0 // indirect ) diff --git a/go.sum b/go.sum index 12b20aa..2b7e03e 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,8 @@ github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/puzpuzpuz/xsync/v4 v4.2.0 h1:dlxm77dZj2c3rxq0/XNvvUKISAmovoXF4a4qM6Wvkr0= -github.com/puzpuzpuz/xsync/v4 v4.2.0/go.mod h1:VJDmTCJMBt8igNxnkQd86r+8KUeN1quSfNKu5bLYFQo= +github.com/puzpuzpuz/xsync/v4 v4.3.0 h1:w/bWkEJdYuRNYhHn5eXnIT8LzDM1O629X1I9MJSkD7Q= +github.com/puzpuzpuz/xsync/v4 v4.3.0/go.mod h1:VJDmTCJMBt8igNxnkQd86r+8KUeN1quSfNKu5bLYFQo= github.com/sergeymakinen/go-bmp v1.0.0 h1:SdGTzp9WvCV0A1V0mBeaS7kQAwNLdVJbmHlqNWq0R+M= github.com/sergeymakinen/go-bmp v1.0.0/go.mod h1:/mxlAQZRLxSvJFNIEGGLBE/m40f3ZnUifpgVDlcUIEY= github.com/sergeymakinen/go-ico v1.0.0 h1:uL3khgvKkY6WfAetA+RqsguClBuu7HpvBB/nq/Jvr80= @@ -62,18 +62,18 @@ github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG0 github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c h1:coVla7zpsycc+kA9NXpcvv2E4I7+ii6L5hZO2S6C3kw= github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c/go.mod h1:qc66Pna1RiIsPa7O4Egxxs9OqkuxDX55zznh9K07Tzg= -golang.org/x/image v0.34.0 h1:33gCkyw9hmwbZJeZkct8XyR11yH889EQt/QH4VmXMn8= -golang.org/x/image v0.34.0/go.mod h1:2RNFBZRB+vnwwFil8GkMdRvrJOFd1AzdZI6vOY+eJVU= -golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= -golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/image v0.35.0 h1:LKjiHdgMtO8z7Fh18nGY6KDcoEtVfsgLDPeLyguqb7I= +golang.org/x/image v0.35.0/go.mod h1:MwPLTVgvxSASsxdLzKrl8BRFuyqMyGhLwmC+TO1Sybk= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= -golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= -golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= +golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= +golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= +golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=