Skip to content

Commit b7785b0

Browse files
authored
Merge pull request #55 from tstromberg/new-turn
upgrade to latest turn api
2 parents b3787bd + 6a66c26 commit b7785b0

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

cmd/goose/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"time"
1515

1616
"github.com/codeGROOVE-dev/retry"
17-
"github.com/ready-to-review/turnclient/pkg/turn"
17+
"github.com/codeGROOVE-dev/turnclient/pkg/turn"
1818
)
1919

2020
type cacheEntry struct {

cmd/goose/github.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515
"time"
1616

1717
"github.com/codeGROOVE-dev/retry"
18+
"github.com/codeGROOVE-dev/turnclient/pkg/turn"
1819
"github.com/google/go-github/v57/github"
19-
"github.com/ready-to-review/turnclient/pkg/turn"
2020
"golang.org/x/oauth2"
2121
)
2222

@@ -42,8 +42,8 @@ func (app *App) initClients(ctx context.Context) error {
4242
tc := oauth2.NewClient(ctx, ts)
4343
app.client = github.NewClient(tc)
4444

45-
// Initialize Turn client with base URL
46-
turnClient, err := turn.NewClient("https://turn.ready-to-review.dev")
45+
// Initialize Turn client using default backend
46+
turnClient, err := turn.NewDefaultClient()
4747
if err != nil {
4848
return fmt.Errorf("create turn client: %w", err)
4949
}
@@ -450,7 +450,7 @@ func (app *App) fetchTurnDataSync(ctx context.Context, issues []*github.Issue, u
450450
cacheHits := 0
451451

452452
for result := range results {
453-
if result.err == nil && result.turnData != nil && result.turnData.PRState.UnblockAction != nil {
453+
if result.err == nil && result.turnData != nil && result.turnData.Analysis.NextAction != nil {
454454
turnSuccesses++
455455
if result.wasFromCache {
456456
cacheHits++
@@ -460,13 +460,15 @@ func (app *App) fetchTurnDataSync(ctx context.Context, issues []*github.Issue, u
460460

461461
// Check if user needs to review and get action reason
462462
needsReview := false
463+
isBlocked := false
463464
actionReason := ""
464-
if action, exists := result.turnData.PRState.UnblockAction[user]; exists {
465+
if action, exists := result.turnData.Analysis.NextAction[user]; exists {
465466
needsReview = true
467+
isBlocked = action.Critical // Only critical actions are blocking
466468
actionReason = action.Reason
467469
// Only log fresh API calls
468470
if !result.wasFromCache {
469-
slog.Debug("[TURN] UnblockAction", "url", result.url, "reason", action.Reason, "kind", action.Kind)
471+
slog.Debug("[TURN] NextAction", "url", result.url, "reason", action.Reason, "kind", action.Kind, "critical", action.Critical)
470472
}
471473
}
472474

@@ -475,7 +477,7 @@ func (app *App) fetchTurnDataSync(ctx context.Context, issues []*github.Issue, u
475477
for i := range *outgoing {
476478
if (*outgoing)[i].URL == result.url {
477479
(*outgoing)[i].NeedsReview = needsReview
478-
(*outgoing)[i].IsBlocked = needsReview
480+
(*outgoing)[i].IsBlocked = isBlocked
479481
(*outgoing)[i].ActionReason = actionReason
480482
break
481483
}

cmd/goose/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717
"time"
1818

1919
"github.com/codeGROOVE-dev/retry"
20+
"github.com/codeGROOVE-dev/turnclient/pkg/turn"
2021
"github.com/energye/systray"
2122
"github.com/google/go-github/v57/github"
22-
"github.com/ready-to-review/turnclient/pkg/turn"
2323
)
2424

2525
// Version information - set during build with -ldflags.

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ go 1.24.0
44

55
require (
66
github.com/codeGROOVE-dev/retry v1.2.0
7+
github.com/codeGROOVE-dev/turnclient v0.0.0-20250922145707-664c2dcdf5b8
78
github.com/energye/systray v1.0.2
89
github.com/gen2brain/beeep v0.11.1
910
github.com/google/go-github/v57 v57.0.0
10-
github.com/ready-to-review/turnclient v0.0.0-20250804200718-023200511dab
1111
golang.org/x/oauth2 v0.31.0
1212
)
1313

1414
require (
1515
git.sr.ht/~jackmordaunt/go-toast v1.1.2 // indirect
16+
github.com/codeGROOVE-dev/prx v0.0.0-20250908203157-0711b3ec5471 // indirect
1617
github.com/esiqveland/notify v0.13.3 // indirect
1718
github.com/go-ole/go-ole v1.3.0 // indirect
1819
github.com/godbus/dbus/v5 v5.1.0 // indirect
@@ -24,5 +25,5 @@ require (
2425
github.com/sergeymakinen/go-ico v1.0.0-beta.0 // indirect
2526
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
2627
github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c // indirect
27-
golang.org/x/sys v0.35.0 // indirect
28+
golang.org/x/sys v0.36.0 // indirect
2829
)

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
git.sr.ht/~jackmordaunt/go-toast v1.1.2 h1:/yrfI55LRt1M7H1vkaw+NaH1+L1CDxrqDltwm5euVuE=
22
git.sr.ht/~jackmordaunt/go-toast v1.1.2/go.mod h1:jA4OqHKTQ4AFBdwrSnwnskUIIS3HYzlJSgdzCKqfavo=
3+
github.com/codeGROOVE-dev/prx v0.0.0-20250908203157-0711b3ec5471 h1:CbUa70O+iNC9rPk5aoZGs/RZbpmPyfNydv5ncKLdOvk=
4+
github.com/codeGROOVE-dev/prx v0.0.0-20250908203157-0711b3ec5471/go.mod h1:7qLbi18baOyS8yO/6/64SBIqtyzSzLFdsDST15NPH3w=
35
github.com/codeGROOVE-dev/retry v1.2.0 h1:xYpYPX2PQZmdHwuiQAGGzsBm392xIMl4nfMEFApQnu8=
46
github.com/codeGROOVE-dev/retry v1.2.0/go.mod h1:8OgefgV1XP7lzX2PdKlCXILsYKuz6b4ZpHa/20iLi8E=
7+
github.com/codeGROOVE-dev/turnclient v0.0.0-20250922145707-664c2dcdf5b8 h1:3088TLJGgxzjM/bR1gafKQ609NMkBNlZe1Fd5SnRrrY=
8+
github.com/codeGROOVE-dev/turnclient v0.0.0-20250922145707-664c2dcdf5b8/go.mod h1:7lBF4vS6T+D1rNjmJ+CNVrXALQvdwNfBVEy7vhIQtYk=
59
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
610
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
711
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -29,8 +33,6 @@ github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6
2933
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
3034
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
3135
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
32-
github.com/ready-to-review/turnclient v0.0.0-20250804200718-023200511dab h1:8UppuvcSCqg/djzBRXu19P9hEn8yCmoIWIQZLevlUFk=
33-
github.com/ready-to-review/turnclient v0.0.0-20250804200718-023200511dab/go.mod h1:0irrOtjtAxH3st+RktW2Gr9Telf8fn/zd4+LK5X7X6A=
3436
github.com/sergeymakinen/go-bmp v1.0.0 h1:SdGTzp9WvCV0A1V0mBeaS7kQAwNLdVJbmHlqNWq0R+M=
3537
github.com/sergeymakinen/go-bmp v1.0.0/go.mod h1:/mxlAQZRLxSvJFNIEGGLBE/m40f3ZnUifpgVDlcUIEY=
3638
github.com/sergeymakinen/go-ico v1.0.0-beta.0 h1:m5qKH7uPKLdrygMWxbamVn+tl2HfiA3K6MFJw4GfZvQ=
@@ -50,8 +52,8 @@ golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
5052
golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
5153
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5254
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
53-
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
54-
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
55+
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
56+
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
5557
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5658
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5759
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)