diff --git a/internal/app/agentworker/task_execution_test.go b/internal/app/agentworker/task_execution_test.go index 7a5f6e42a..e4d83340f 100644 --- a/internal/app/agentworker/task_execution_test.go +++ b/internal/app/agentworker/task_execution_test.go @@ -250,10 +250,6 @@ func (f *prCapturingForge) IssuesWithLabel(context.Context, string, string, stri panic("unexpected call") } -func (f *prCapturingForge) RepliesAfter(context.Context, string, string, int, int64, string) ([]forge.Reply, error) { - panic("unexpected call") -} - func (f *prCapturingForge) PRState(context.Context, string, string, int) (string, error) { panic("unexpected call") } diff --git a/internal/app/archied/main_test.go b/internal/app/archied/main_test.go index 21baccb2f..8a7ac52c5 100644 --- a/internal/app/archied/main_test.go +++ b/internal/app/archied/main_test.go @@ -937,10 +937,6 @@ func (stubForge) IssuesWithLabel(context.Context, string, string, string) ([]for panic("unexpected call") } -func (stubForge) RepliesAfter(context.Context, string, string, int, int64, string) ([]forge.Reply, error) { - panic("unexpected call") -} - func (stubForge) PRState(context.Context, string, string, int) (string, error) { panic("unexpected call") } @@ -1031,10 +1027,6 @@ func (*identityForge) IssuesWithLabel(context.Context, string, string, string) ( panic("unexpected") } -func (*identityForge) RepliesAfter(context.Context, string, string, int, int64, string) ([]forge.Reply, error) { - panic("unexpected") -} - func (*identityForge) PRState(context.Context, string, string, int) (string, error) { panic("unexpected") } diff --git a/internal/daemon/daemon_test.go b/internal/daemon/daemon_test.go index 7de7ae1bc..a83b3787f 100644 --- a/internal/daemon/daemon_test.go +++ b/internal/daemon/daemon_test.go @@ -1004,10 +1004,6 @@ func (f *testForge) IssuesWithLabel(context.Context, string, string, string) ([] panic("unexpected call") } -func (f *testForge) RepliesAfter(context.Context, string, string, int, int64, string) ([]forge.Reply, error) { - panic("unexpected call") -} - func (f *testForge) CreatePR(context.Context, string, string, string, string, string, string) (int, error) { panic("unexpected call") } @@ -1411,10 +1407,6 @@ func (f *recordingForge) SetStateLabel(context.Context, string, string, int, str panic("unexpected call") } func (f *recordingForge) AcceptInvitations(context.Context) error { panic("unexpected call") } -func (f *recordingForge) RepliesAfter(context.Context, string, string, int, int64, string) ([]forge.Reply, error) { - panic("unexpected call") -} - func (f *recordingForge) CreatePR(context.Context, string, string, string, string, string, string) (int, error) { panic("unexpected call") } diff --git a/internal/domain/workflow/implement_test.go b/internal/domain/workflow/implement_test.go index edf3bd4a5..e74d6458a 100644 --- a/internal/domain/workflow/implement_test.go +++ b/internal/domain/workflow/implement_test.go @@ -326,10 +326,6 @@ func (f *fakeForge) React(ctx context.Context, owner, repo string, number int, r return nil } -func (f *fakeForge) RepliesAfter(ctx context.Context, owner, repo string, number int, afterID int64, exclude string) ([]forge.Reply, error) { - return nil, nil -} - func (f *fakeForge) SetStateLabel(ctx context.Context, owner, repo string, number int, label string, known []string) { } diff --git a/internal/forge/forge.go b/internal/forge/forge.go index 329bed5f7..97f41846e 100644 --- a/internal/forge/forge.go +++ b/internal/forge/forge.go @@ -53,10 +53,6 @@ type IssueForge interface { // Comment posts an issue (or PR) comment and returns its id. Comment(ctx context.Context, owner, repo string, number int, body string) (int64, error) - // RepliesAfter returns comments on the issue with id > afterID that - // were not written by exclude. - RepliesAfter(ctx context.Context, owner, repo string, number int, afterID int64, exclude string) ([]Reply, error) - // CloseIssue closes an issue with an optional final comment. CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error diff --git a/internal/forge/gitea.go b/internal/forge/gitea.go index 816d384b1..d68557543 100644 --- a/internal/forge/gitea.go +++ b/internal/forge/gitea.go @@ -113,25 +113,6 @@ func (c *GiteaClient) Comment(ctx context.Context, owner, repo string, number in return cm.ID, nil } -// RepliesAfter returns comments on the issue with id > afterID not written -// by exclude. -func (c *GiteaClient) RepliesAfter(ctx context.Context, owner, repo string, number int, afterID int64, exclude string) ([]Reply, error) { - comments, _, err := c.cli.ListIssueComments(owner, repo, int64(number), gitea.ListIssueCommentOptions{ - PageSize: 50, - }) - if err != nil { - return nil, err - } - var out []Reply - for _, cm := range comments { - if cm.ID <= afterID || cm.Poster.UserName == exclude { - continue - } - out = append(out, Reply{ID: cm.ID, User: cm.Poster.UserName, Body: cm.Body}) - } - return out, nil -} - // CreatePR opens a pull request and returns its number. func (c *GiteaClient) CreatePR(ctx context.Context, owner, repo, title, head, base, body string) (int, error) { pr, _, err := c.cli.CreatePullRequest(owner, repo, gitea.CreatePullRequestOption{ diff --git a/internal/forge/gitea_methods_test.go b/internal/forge/gitea_methods_test.go index c20c09b1a..972571537 100644 --- a/internal/forge/gitea_methods_test.go +++ b/internal/forge/gitea_methods_test.go @@ -72,25 +72,6 @@ func TestGiteaComment(t *testing.T) { } } -func TestGiteaRepliesAfterExcludesOldAndSelf(t *testing.T) { - c, mux := newTestGiteaClient(t) - mux.HandleFunc("GET /api/v1/repos/o/r/issues/5/comments", func(w http.ResponseWriter, r *http.Request) { - writeJSON(t, w, []map[string]any{ - {"id": 1, "body": "old", "user": map[string]any{"login": "someone"}}, - {"id": 3, "body": "mine", "user": map[string]any{"login": "archie-bot"}}, - {"id": 4, "body": "new reply", "user": map[string]any{"login": "someone"}}, - }) - }) - - replies, err := c.RepliesAfter(t.Context(), "o", "r", 5, 2, "archie-bot") - if err != nil { - t.Fatal(err) - } - if len(replies) != 1 || replies[0].ID != 4 || replies[0].Body != "new reply" { - t.Fatalf("replies = %+v", replies) - } -} - func TestGiteaCreatePR(t *testing.T) { c, mux := newTestGiteaClient(t) mux.HandleFunc("POST /api/v1/repos/o/r/pulls", func(w http.ResponseWriter, r *http.Request) { diff --git a/internal/forge/github.go b/internal/forge/github.go index 98d52be40..200cbae37 100644 --- a/internal/forge/github.go +++ b/internal/forge/github.go @@ -141,31 +141,6 @@ func (c *GitHubClient) Comment(ctx context.Context, owner, repo string, number i return cm.GetID(), nil } -// Reply is a human comment on a watched issue. -type Reply struct { - ID int64 - User string - Body string -} - -// RepliesAfter returns comments on the issue with id > afterID that were -// not written by exclude (the bot) -- the human side of waiting_human. -func (c *GitHubClient) RepliesAfter(ctx context.Context, owner, repo string, number int, afterID int64, exclude string) ([]Reply, error) { - comments, _, err := c.gh.Issues.ListComments(ctx, owner, repo, number, - &github.IssueListCommentsOptions{PerPage: 50}) - if err != nil { - return nil, err - } - var out []Reply - for _, cm := range comments { - if cm.GetID() <= afterID || cm.GetUser().GetLogin() == exclude { - continue - } - out = append(out, Reply{ID: cm.GetID(), User: cm.GetUser().GetLogin(), Body: cm.GetBody()}) - } - return out, nil -} - // CreatePR opens a pull request and returns its number. func (c *GitHubClient) CreatePR(ctx context.Context, owner, repo, title, head, base, body string) (int, error) { pr, _, err := c.gh.PullRequests.Create(ctx, owner, repo, &github.NewPullRequest{ diff --git a/internal/forge/github_methods_test.go b/internal/forge/github_methods_test.go index 3b0613f83..ef54ad588 100644 --- a/internal/forge/github_methods_test.go +++ b/internal/forge/github_methods_test.go @@ -74,25 +74,6 @@ func TestComment(t *testing.T) { } } -func TestRepliesAfterExcludesBotAndOldComments(t *testing.T) { - c, mux := newTestClient(t) - mux.HandleFunc("GET /repos/o/r/issues/5/comments", func(w http.ResponseWriter, r *http.Request) { - writeJSON(t, w, []map[string]any{ - {"id": 1, "user": map[string]any{"login": "human"}, "body": "old, ignored"}, - {"id": 2, "user": map[string]any{"login": "archie-bot"}, "body": "bot comment, excluded"}, - {"id": 3, "user": map[string]any{"login": "human"}, "body": "the reply"}, - }) - }) - - replies, err := c.RepliesAfter(t.Context(), "o", "r", 5, 1, "archie-bot") - if err != nil { - t.Fatal(err) - } - if len(replies) != 1 || replies[0].ID != 3 || replies[0].Body != "the reply" || replies[0].User != "human" { - t.Fatalf("replies = %+v", replies) - } -} - func TestCreatePR(t *testing.T) { c, mux := newTestClient(t) mux.HandleFunc("POST /repos/o/r/pulls", func(w http.ResponseWriter, r *http.Request) { diff --git a/internal/forge/noop.go b/internal/forge/noop.go index 2a2389c7f..03c047d6c 100644 --- a/internal/forge/noop.go +++ b/internal/forge/noop.go @@ -30,10 +30,6 @@ func (n *NoopForge) Comment(ctx context.Context, owner, repo string, number int, return 0, nil } -func (n *NoopForge) RepliesAfter(ctx context.Context, owner, repo string, number int, afterID int64, exclude string) ([]Reply, error) { - return nil, nil -} - func (n *NoopForge) CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error { return nil } diff --git a/internal/forge/noop_test.go b/internal/forge/noop_test.go index 3000fb30c..e20c605ab 100644 --- a/internal/forge/noop_test.go +++ b/internal/forge/noop_test.go @@ -31,11 +31,6 @@ func TestNoopForgeIsAllZeroValue(t *testing.T) { t.Errorf("Comment() = (%d, %v), want (0, nil)", id, err) } - replies, err := f.RepliesAfter(ctx, "o", "r", 1, 0, "") - if replies != nil || err != nil { - t.Errorf("RepliesAfter() = (%v, %v), want (nil, nil)", replies, err) - } - if err := f.CloseIssue(ctx, "o", "r", 1, "comment"); err != nil { t.Errorf("CloseIssue() = %v, want nil", err) } diff --git a/internal/forgerpc/forgerpc_test.go b/internal/forgerpc/forgerpc_test.go index ab5fe2666..0cfd60d14 100644 --- a/internal/forgerpc/forgerpc_test.go +++ b/internal/forgerpc/forgerpc_test.go @@ -109,10 +109,6 @@ func (f *fakeForge) IssuesWithLabel(context.Context, string, string, string) ([] panic("unexpected call") } -func (f *fakeForge) RepliesAfter(context.Context, string, string, int, int64, string) ([]forge.Reply, error) { - panic("unexpected call") -} - func (f *fakeForge) PRState(context.Context, string, string, int) (string, error) { panic("unexpected call") }