Skip to content

Commit 341872b

Browse files
authored
Merge pull request #76 from tstromberg/main
Add cockroaches and diamonds, increase duration from 5m to 15m
2 parents e1a5b1c + 827d292 commit 341872b

File tree

5 files changed

+83
-50
lines changed

5 files changed

+83
-50
lines changed

cmd/goose/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const (
3939
maxPRsToProcess = 200
4040
minUpdateInterval = 10 * time.Second
4141
defaultUpdateInterval = 1 * time.Minute
42-
blockedPRIconDuration = 5 * time.Minute
42+
blockedPRIconDuration = 15 * time.Minute
4343
maxRetryDelay = 2 * time.Minute
4444
maxRetries = 10
4545
minorFailureThreshold = 3

cmd/goose/main_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"sync"
1010
"testing"
1111
"time"
12+
13+
"github.com/codeGROOVE-dev/turnclient/pkg/turn"
1214
)
1315

1416
func TestMain(m *testing.M) {
@@ -198,7 +200,7 @@ func TestMenuItemTitleTransition(t *testing.T) {
198200
_ = ctx // Unused in this test but would be used for real menu operations
199201
}
200202

201-
// TestWorkflowStateNewlyPublished tests that PRs with NEWLY_PUBLISHED workflow state get "- NEW!" suffix.
203+
// TestWorkflowStateNewlyPublished tests that PRs with NEWLY_PUBLISHED workflow state get a 💎 bullet.
202204
func TestWorkflowStateNewlyPublished(t *testing.T) {
203205
tests := []struct {
204206
name string
@@ -211,32 +213,32 @@ func TestWorkflowStateNewlyPublished(t *testing.T) {
211213
Repository: "test/repo",
212214
Number: 123,
213215
ActionKind: "review",
214-
WorkflowState: "NEWLY_PUBLISHED",
216+
WorkflowState: string(turn.StateNewlyPublished),
215217
NeedsReview: true,
216218
UpdatedAt: time.Now(),
217219
},
218-
expectedTitle: " test/repo #123 — review - NEW!",
220+
expectedTitle: "💎 test/repo #123 — review",
219221
},
220222
{
221223
name: "newly_published_without_action",
222224
pr: PR{
223225
Repository: "test/repo",
224226
Number: 456,
225-
WorkflowState: "NEWLY_PUBLISHED",
227+
WorkflowState: string(turn.StateNewlyPublished),
226228
UpdatedAt: time.Now(),
227229
},
228-
expectedTitle: "test/repo #456 - NEW!",
230+
expectedTitle: "💎 test/repo #456",
229231
},
230232
{
231233
name: "newly_published_with_running_tests",
232234
pr: PR{
233235
Repository: "test/repo",
234236
Number: 789,
235237
TestState: "running",
236-
WorkflowState: "NEWLY_PUBLISHED",
238+
WorkflowState: string(turn.StateNewlyPublished),
237239
UpdatedAt: time.Now(),
238240
},
239-
expectedTitle: "test/repo #789 — tests running... - NEW!",
241+
expectedTitle: "💎 test/repo #789 — tests running...",
240242
},
241243
{
242244
name: "not_newly_published_with_action",
@@ -266,13 +268,11 @@ func TestWorkflowStateNewlyPublished(t *testing.T) {
266268
title = fmt.Sprintf("%s — tests running...", title)
267269
}
268270

269-
// Add "- NEW!" suffix if workflow state is NEWLY_PUBLISHED
270-
if pr.WorkflowState == "NEWLY_PUBLISHED" {
271-
title = fmt.Sprintf("%s - NEW!", title)
272-
}
273-
274-
// Add prefix based on blocked status
275-
if pr.NeedsReview || pr.IsBlocked {
271+
// Add prefix based on workflow state or blocked status
272+
switch {
273+
case pr.WorkflowState == string(turn.StateNewlyPublished):
274+
title = fmt.Sprintf("💎 %s", title)
275+
case pr.NeedsReview || pr.IsBlocked:
276276
title = fmt.Sprintf("■ %s", title)
277277
}
278278

cmd/goose/ui.go

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"strings"
1414
"time"
1515

16+
"github.com/codeGROOVE-dev/turnclient/pkg/turn"
1617
"github.com/energye/systray" // needed for MenuItem type
1718
)
1819

@@ -342,13 +343,12 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string,
342343
title = fmt.Sprintf("%s — tests running...", title)
343344
}
344345

345-
// Add "- NEW!" suffix if workflow state is NEWLY_PUBLISHED
346-
if sortedPRs[prIndex].WorkflowState == "NEWLY_PUBLISHED" {
347-
title = fmt.Sprintf("%s - NEW!", title)
348-
}
349-
350346
// Add bullet point or emoji based on PR status
351-
if sortedPRs[prIndex].NeedsReview || sortedPRs[prIndex].IsBlocked {
347+
switch {
348+
case sortedPRs[prIndex].WorkflowState == string(turn.StateNewlyPublished):
349+
// Use gem emoji for newly published PRs
350+
title = fmt.Sprintf("💎 %s", title)
351+
case sortedPRs[prIndex].NeedsReview || sortedPRs[prIndex].IsBlocked:
352352
// Get the blocked time from state manager
353353
prState, hasState := app.stateManager.PRState(sortedPRs[prIndex].URL)
354354

@@ -358,16 +358,27 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string,
358358
time.Since(prState.FirstBlockedAt) < blockedPRIconDuration &&
359359
!prState.IsInitialDiscovery {
360360
timeSinceBlocked := time.Since(prState.FirstBlockedAt)
361-
// Use party popper for outgoing PRs, goose for incoming PRs
361+
// Use cockroach for fix_tests, party popper for other outgoing PRs, goose for incoming PRs
362362
if sectionTitle == "Outgoing" {
363-
title = fmt.Sprintf("🎉 %s", title)
364-
slog.Info("[MENU] Adding party popper to outgoing PR",
365-
"repo", sortedPRs[prIndex].Repository,
366-
"number", sortedPRs[prIndex].Number,
367-
"url", sortedPRs[prIndex].URL,
368-
"firstBlockedAt", prState.FirstBlockedAt.Format(time.RFC3339),
369-
"blocked_ago", timeSinceBlocked.Round(time.Second),
370-
"remaining", (blockedPRIconDuration - timeSinceBlocked).Round(time.Second))
363+
if sortedPRs[prIndex].ActionKind == "fix_tests" {
364+
title = fmt.Sprintf("🪳 %s", title)
365+
slog.Info("[MENU] Adding cockroach to outgoing PR with broken tests",
366+
"repo", sortedPRs[prIndex].Repository,
367+
"number", sortedPRs[prIndex].Number,
368+
"url", sortedPRs[prIndex].URL,
369+
"firstBlockedAt", prState.FirstBlockedAt.Format(time.RFC3339),
370+
"blocked_ago", timeSinceBlocked.Round(time.Second),
371+
"remaining", (blockedPRIconDuration - timeSinceBlocked).Round(time.Second))
372+
} else {
373+
title = fmt.Sprintf("🎉 %s", title)
374+
slog.Info("[MENU] Adding party popper to outgoing PR",
375+
"repo", sortedPRs[prIndex].Repository,
376+
"number", sortedPRs[prIndex].Number,
377+
"url", sortedPRs[prIndex].URL,
378+
"firstBlockedAt", prState.FirstBlockedAt.Format(time.RFC3339),
379+
"blocked_ago", timeSinceBlocked.Round(time.Second),
380+
"remaining", (blockedPRIconDuration - timeSinceBlocked).Round(time.Second))
381+
}
371382
} else {
372383
title = fmt.Sprintf("🪿 %s", title)
373384
slog.Debug("[MENU] Adding goose to incoming PR",
@@ -394,9 +405,11 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string,
394405
}
395406
}
396407
}
397-
} else if sortedPRs[prIndex].ActionKind != "" {
408+
case sortedPRs[prIndex].ActionKind != "":
398409
// PR has an action but isn't blocked - add bullet to indicate it could use input
399410
title = fmt.Sprintf("• %s", title)
411+
default:
412+
// No special prefix needed
400413
}
401414
// Format age inline for tooltip
402415
duration := time.Since(sortedPRs[prIndex].UpdatedAt)
@@ -538,28 +551,38 @@ func (app *App) generatePRSectionTitles(prs []PR, sectionTitle string, hiddenOrg
538551
title = fmt.Sprintf("%s — tests running...", title)
539552
}
540553

541-
// Add "- NEW!" suffix if workflow state is NEWLY_PUBLISHED
542-
if sortedPRs[prIndex].WorkflowState == "NEWLY_PUBLISHED" {
543-
title = fmt.Sprintf("%s - NEW!", title)
544-
}
545-
546554
// Add bullet point or emoji for blocked PRs (same logic as in addPRSection)
547-
if sortedPRs[prIndex].NeedsReview || sortedPRs[prIndex].IsBlocked {
555+
switch {
556+
case sortedPRs[prIndex].WorkflowState == string(turn.StateNewlyPublished):
557+
// Use gem emoji for newly published PRs
558+
title = fmt.Sprintf("💎 %s", title)
559+
case sortedPRs[prIndex].NeedsReview || sortedPRs[prIndex].IsBlocked:
548560
prState, hasState := app.stateManager.PRState(sortedPRs[prIndex].URL)
549561

550562
if hasState && !prState.FirstBlockedAt.IsZero() &&
551563
time.Since(prState.FirstBlockedAt) < blockedPRIconDuration &&
552564
!prState.IsInitialDiscovery {
553565
timeSinceBlocked := time.Since(prState.FirstBlockedAt)
554566
if sectionTitle == "Outgoing" {
555-
title = fmt.Sprintf("🎉 %s", title)
556-
slog.Info("[MENU] Adding party popper to outgoing PR in generateMenuTitles",
557-
"repo", sortedPRs[prIndex].Repository,
558-
"number", sortedPRs[prIndex].Number,
559-
"url", sortedPRs[prIndex].URL,
560-
"firstBlockedAt", prState.FirstBlockedAt.Format(time.RFC3339),
561-
"blocked_ago", timeSinceBlocked.Round(time.Second),
562-
"remaining", (blockedPRIconDuration - timeSinceBlocked).Round(time.Second))
567+
if sortedPRs[prIndex].ActionKind == "fix_tests" {
568+
title = fmt.Sprintf("🪳 %s", title)
569+
slog.Info("[MENU] Adding cockroach to outgoing PR with broken tests in generateMenuTitles",
570+
"repo", sortedPRs[prIndex].Repository,
571+
"number", sortedPRs[prIndex].Number,
572+
"url", sortedPRs[prIndex].URL,
573+
"firstBlockedAt", prState.FirstBlockedAt.Format(time.RFC3339),
574+
"blocked_ago", timeSinceBlocked.Round(time.Second),
575+
"remaining", (blockedPRIconDuration - timeSinceBlocked).Round(time.Second))
576+
} else {
577+
title = fmt.Sprintf("🎉 %s", title)
578+
slog.Info("[MENU] Adding party popper to outgoing PR in generateMenuTitles",
579+
"repo", sortedPRs[prIndex].Repository,
580+
"number", sortedPRs[prIndex].Number,
581+
"url", sortedPRs[prIndex].URL,
582+
"firstBlockedAt", prState.FirstBlockedAt.Format(time.RFC3339),
583+
"blocked_ago", timeSinceBlocked.Round(time.Second),
584+
"remaining", (blockedPRIconDuration - timeSinceBlocked).Round(time.Second))
585+
}
563586
} else {
564587
title = fmt.Sprintf("🪿 %s", title)
565588
slog.Debug("[MENU] Adding goose to incoming PR in generateMenuTitles",
@@ -586,9 +609,11 @@ func (app *App) generatePRSectionTitles(prs []PR, sectionTitle string, hiddenOrg
586609
"number", sortedPRs[prIndex].Number)
587610
}
588611
}
589-
} else if sortedPRs[prIndex].ActionKind != "" {
612+
case sortedPRs[prIndex].ActionKind != "":
590613
// PR has an action but isn't blocked - add bullet to indicate it could use input
591614
title = fmt.Sprintf("• %s", title)
615+
default:
616+
// No special prefix needed
592617
}
593618

594619
titles = append(titles, title)

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ module github.com/codeGROOVE-dev/goose
33
go 1.24.0
44

55
require (
6-
github.com/codeGROOVE-dev/retry v1.2.0
7-
github.com/codeGROOVE-dev/sprinkler v0.0.0-20251027122631-1d61827b70ca
8-
github.com/codeGROOVE-dev/turnclient v0.0.0-20251022064427-5a712e1e10e6
6+
github.com/codeGROOVE-dev/retry v1.3.0
7+
github.com/codeGROOVE-dev/sprinkler v0.0.0-20251027213037-05bb80a9db89
8+
github.com/codeGROOVE-dev/turnclient v0.0.0-20251028130307-1f85c9aa43c4
99
github.com/energye/systray v1.0.2
1010
github.com/gen2brain/beeep v0.11.1
1111
github.com/google/go-github/v57 v57.0.0
@@ -14,7 +14,7 @@ require (
1414

1515
require (
1616
git.sr.ht/~jackmordaunt/go-toast v1.1.2 // indirect
17-
github.com/codeGROOVE-dev/prx v0.0.0-20251027012315-7b273aabfc7d // indirect
17+
github.com/codeGROOVE-dev/prx v0.0.0-20251027204543-4e6165f046e5 // indirect
1818
github.com/esiqveland/notify v0.13.3 // indirect
1919
github.com/go-ole/go-ole v1.3.0 // indirect
2020
github.com/godbus/dbus/v5 v5.1.0 // indirect

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@ git.sr.ht/~jackmordaunt/go-toast v1.1.2 h1:/yrfI55LRt1M7H1vkaw+NaH1+L1CDxrqDltwm
22
git.sr.ht/~jackmordaunt/go-toast v1.1.2/go.mod h1:jA4OqHKTQ4AFBdwrSnwnskUIIS3HYzlJSgdzCKqfavo=
33
github.com/codeGROOVE-dev/prx v0.0.0-20251027012315-7b273aabfc7d h1:kUaCKFRxWFrWEyl4fVHi+eY/D5tKhBU29a8YbQyihEk=
44
github.com/codeGROOVE-dev/prx v0.0.0-20251027012315-7b273aabfc7d/go.mod h1:7qLbi18baOyS8yO/6/64SBIqtyzSzLFdsDST15NPH3w=
5+
github.com/codeGROOVE-dev/prx v0.0.0-20251027204543-4e6165f046e5 h1:tjxTLJ5NXx1xhReL4M+J4LTl/JGNSZjPrznAoci06OA=
6+
github.com/codeGROOVE-dev/prx v0.0.0-20251027204543-4e6165f046e5/go.mod h1:FEy3gz9IYDXWnKWkoDSL+pWu6rujxbBSrF4w5A8QSK0=
57
github.com/codeGROOVE-dev/retry v1.2.0 h1:xYpYPX2PQZmdHwuiQAGGzsBm392xIMl4nfMEFApQnu8=
68
github.com/codeGROOVE-dev/retry v1.2.0/go.mod h1:8OgefgV1XP7lzX2PdKlCXILsYKuz6b4ZpHa/20iLi8E=
9+
github.com/codeGROOVE-dev/retry v1.3.0 h1:/+ipAWRJLL6y1R1vprYo0FSjSBvH6fE5j9LKXjpD54g=
10+
github.com/codeGROOVE-dev/retry v1.3.0/go.mod h1:8OgefgV1XP7lzX2PdKlCXILsYKuz6b4ZpHa/20iLi8E=
711
github.com/codeGROOVE-dev/sprinkler v0.0.0-20251027122631-1d61827b70ca h1:NDBJTf69PxMsZkZLUjvnfiMQHWL6Y2T4jQT5YNzXTXA=
812
github.com/codeGROOVE-dev/sprinkler v0.0.0-20251027122631-1d61827b70ca/go.mod h1:/kd3ncsRNldD0MUpbtp5ojIzfCkyeXB7JdOrpuqG7Gg=
13+
github.com/codeGROOVE-dev/sprinkler v0.0.0-20251027213037-05bb80a9db89 h1:8Z3SM90hy1nuK2r2yhtv4HwitnO9si4GzVRktRDQ68g=
14+
github.com/codeGROOVE-dev/sprinkler v0.0.0-20251027213037-05bb80a9db89/go.mod h1:/kd3ncsRNldD0MUpbtp5ojIzfCkyeXB7JdOrpuqG7Gg=
915
github.com/codeGROOVE-dev/turnclient v0.0.0-20251022064427-5a712e1e10e6 h1:7FCmaftkl362oTZHVJyUg+xhxqfQFx+JisBf7RgklL8=
1016
github.com/codeGROOVE-dev/turnclient v0.0.0-20251022064427-5a712e1e10e6/go.mod h1:fYwtN9Ql6lY8t2WvCfENx+mP5FUwjlqwXCLx9CVLY20=
17+
github.com/codeGROOVE-dev/turnclient v0.0.0-20251028130307-1f85c9aa43c4 h1:si9tMEo5SXpDuDXGkJ1zNnnpP8TbmakrkNujAbpKlqA=
18+
github.com/codeGROOVE-dev/turnclient v0.0.0-20251028130307-1f85c9aa43c4/go.mod h1:bFWMd0JeaJY0kSIO5AcRQdJLXF3Fo3eKclE49vmIZes=
1119
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1220
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1321
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

0 commit comments

Comments
 (0)