refactor(forge): delete the unwired RepliesAfter surface

DELETE: IssueForge.RepliesAfter and its Reply type had no production caller --
the waiting_human status exists and is reachable, but automatic detection of a
human reply never landed, so the intended poller was never built. Neither
implementation paginated either (both read one page of 50), so the method
would have been wrong if wired as-is.

The manual path is untouched: waiting_human remains reachable and an operator
requeues through the existing task-action flow. Removing the interface method
also removes seven test fakes that existed only to satisfy it.

No behavioural test accompanies this: a pure deletion has no assertion to
make fail, and the compiler enforces completeness across every implementation.
This commit is contained in:
sam committed 2026-09-15 16:54:16 +10:00
1 parent 07e39144e2
commit 0b3dc6c01f
12 files changed
-123

No files matched your search

@@ -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")
}
-8
View File
@@ -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")
}
-8
View File
@@ -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")
}
@@ -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) {
}
-4
View File
@@ -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
-19
View File
@@ -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{
-19
View File
@@ -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) {
-25
View File
@@ -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{
-19
View File
@@ -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) {
-4
View File
@@ -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
}
-5
View File
@@ -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)
}
-4
View File
@@ -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")
}