refactor(forge): delete dead CreateIssue surface
DELETE: no document in docs/architecture/ or docs/prds/ specifies a production consumer for forge.IssueForge.CreateIssue. It has no production caller -- the remaining repo matches are the GitHub CreateIssueReaction and Gitea CreateIssueComment SDK methods. Removing the interface method and the GitHub/Gitea/Noop implementations; the other fakes that still define CreateIssue are test-only and out of lane ownership, and an interface with one fewer method keeps them satisfying. RepliesAfter and forge.Reply are untouched (a parallel FLAG record).
This commit is contained in:
1 parent
1177012a3a
commit
a406c36f27
6 files changed
-50
No files matched your search
@@ -60,9 +60,6 @@ type IssueForge interface {
|
||||
// CloseIssue closes an issue with an optional final comment.
|
||||
CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error
|
||||
|
||||
// CreateIssue opens a new issue and returns its number.
|
||||
CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error)
|
||||
|
||||
// React adds an emoji reaction to an issue.
|
||||
React(ctx context.Context, owner, repo string, number int, reaction string) error
|
||||
|
||||
|
||||
@@ -294,15 +294,6 @@ func (c *GiteaClient) CloseIssue(ctx context.Context, owner, repo string, number
|
||||
return err
|
||||
}
|
||||
|
||||
// CreateIssue opens a new issue and returns its number.
|
||||
func (c *GiteaClient) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) {
|
||||
iss, _, err := c.cli.CreateIssue(owner, repo, gitea.CreateIssueOption{Title: title, Body: body})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(iss.Index), nil
|
||||
}
|
||||
|
||||
// React adds an emoji reaction to an issue.
|
||||
func (c *GiteaClient) React(ctx context.Context, owner, repo string, number int, reaction string) error {
|
||||
_, _, err := c.cli.PostIssueReaction(owner, repo, int64(number), reaction)
|
||||
|
||||
@@ -230,21 +230,6 @@ func TestGiteaCloseIssueWithoutComment(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGiteaCreateIssue(t *testing.T) {
|
||||
c, mux := newTestGiteaClient(t)
|
||||
mux.HandleFunc("POST /api/v1/repos/o/r/issues", func(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(t, w, map[string]any{"number": 11})
|
||||
})
|
||||
|
||||
num, err := c.CreateIssue(t.Context(), "o", "r", "title", "body", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if num != 11 {
|
||||
t.Fatalf("num = %d, want 11", num)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGiteaReact(t *testing.T) {
|
||||
c, mux := newTestGiteaClient(t)
|
||||
var got string
|
||||
|
||||
@@ -302,20 +302,6 @@ func (c *GitHubClient) LinkBranch(ctx context.Context, owner, repo string, issue
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateIssue opens a new issue and returns its number.
|
||||
func (c *GitHubClient) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) {
|
||||
req := &github.IssueRequest{
|
||||
Title: &title,
|
||||
Body: &body,
|
||||
Labels: &labels,
|
||||
}
|
||||
iss, _, err := c.gh.Issues.Create(ctx, owner, repo, req)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("create issue %s/%s: %w", owner, repo, err)
|
||||
}
|
||||
return iss.GetNumber(), nil
|
||||
}
|
||||
|
||||
// State labels mirror the task lifecycle onto the forge so archie's
|
||||
// status is visible at a glance. SQLite remains the source of truth;
|
||||
// labels are the human-facing projection -- and removing the parked
|
||||
|
||||
@@ -38,10 +38,6 @@ func (n *NoopForge) CloseIssue(ctx context.Context, owner, repo string, number i
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *NoopForge) CreateIssue(ctx context.Context, owner, repo, title, body string, labels []string) (int, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (n *NoopForge) React(ctx context.Context, owner, repo string, number int, reaction string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -40,11 +40,6 @@ func TestNoopForgeIsAllZeroValue(t *testing.T) {
|
||||
t.Errorf("CloseIssue() = %v, want nil", err)
|
||||
}
|
||||
|
||||
num, err := f.CreateIssue(ctx, "o", "r", "title", "body", nil)
|
||||
if num != 0 || err != nil {
|
||||
t.Errorf("CreateIssue() = (%d, %v), want (0, nil)", num, err)
|
||||
}
|
||||
|
||||
if err := f.React(ctx, "o", "r", 1, "+1"); err != nil {
|
||||
t.Errorf("React() = %v, want nil", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user