Skip to content

Commit ae5e857

Browse files
BagToadCopilot
andcommitted
refactor(featuredetection): rename ActorIsAssignable to ApiActorsSupported
Aligns the feature detector field name with the downstream ApiActorsSupported flag introduced in the previous commit, so the signal has one consistent name from detection through to consumption. Also consolidates leftover TODO tags (actorIsAssignableCleanup, requestReviewsByLoginCleanup) under the single // TODO ApiActorsSupported tag so there's exactly one thing to grep for. Pure rename with no logic changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3c00ffd commit ae5e857

9 files changed

Lines changed: 29 additions & 23 deletions

File tree

api/queries_pr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ func CreatePullRequest(client *Client, repo *Repository, params map[string]inter
532532
}
533533
}
534534

535-
// TODO requestReviewsByLoginCleanup
535+
// TODO ApiActorsSupported
536536
// Request reviewers using either login-based (github.com) or ID-based (GHES) mutation.
537537
// The ID-based path can be removed once GHES supports requestReviewsByLogin.
538538
userLogins, hasUserLogins := params["userReviewerLogins"].([]string)

internal/featuredetection/feature_detection.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ type Detector interface {
2323
}
2424

2525
type IssueFeatures struct {
26-
ActorIsAssignable bool
26+
// TODO ApiActorsSupported
27+
// ApiActorsSupported indicates the host supports actor-based APIs
28+
// (replaceActorsForAssignable, requestReviewsByLogin, suggestedAssignableActors, etc.).
29+
// True for github.com and ghe.com. False for GHES.
30+
// Remove this flag once GHES supports these mutations, then collapse all
31+
// // TODO ApiActorsSupported sites to the actor-only path.
32+
ApiActorsSupported bool
2733
}
2834

2935
var allIssueFeatures = IssueFeatures{
30-
ActorIsAssignable: true,
36+
ApiActorsSupported: true,
3137
}
3238

3339
type PullRequestFeatures struct {
@@ -136,7 +142,7 @@ func (d *detector) IssueFeatures() (IssueFeatures, error) {
136142
}
137143

138144
return IssueFeatures{
139-
ActorIsAssignable: false, // replaceActorsForAssignable GraphQL mutation unavailable on GHES
145+
ApiActorsSupported: false, // TODO ApiActorsSupported — actor-based mutations unavailable on GHES
140146
}, nil
141147
}
142148

internal/featuredetection/feature_detection_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ func TestIssueFeatures(t *testing.T) {
2323
name: "github.com",
2424
hostname: "github.com",
2525
wantFeatures: IssueFeatures{
26-
ActorIsAssignable: true,
26+
ApiActorsSupported: true,
2727
},
2828
wantErr: false,
2929
},
3030
{
3131
name: "ghec data residency (ghe.com)",
3232
hostname: "stampname.ghe.com",
3333
wantFeatures: IssueFeatures{
34-
ActorIsAssignable: true,
34+
ApiActorsSupported: true,
3535
},
3636
wantErr: false,
3737
},
3838
{
3939
name: "GHE",
4040
hostname: "git.my.org",
4141
wantFeatures: IssueFeatures{
42-
ActorIsAssignable: false,
42+
ApiActorsSupported: false,
4343
},
4444
wantErr: false,
4545
},

pkg/cmd/issue/create/create.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func createRun(opts *CreateOptions) (err error) {
179179

180180
// Replace special values in assignees
181181
// For web mode, @copilot should be replaced by name; otherwise, login.
182-
assigneeReplacer := prShared.NewSpecialAssigneeReplacer(apiClient, baseRepo.RepoHost(), issueFeatures.ActorIsAssignable, !opts.WebMode)
182+
assigneeReplacer := prShared.NewSpecialAssigneeReplacer(apiClient, baseRepo.RepoHost(), issueFeatures.ApiActorsSupported, !opts.WebMode)
183183
assignees, err := assigneeReplacer.ReplaceSlice(opts.Assignees)
184184
if err != nil {
185185
return err
@@ -189,7 +189,7 @@ func createRun(opts *CreateOptions) (err error) {
189189

190190
tb := prShared.IssueMetadataState{
191191
Type: prShared.IssueMetadata,
192-
ApiActorsSupported: issueFeatures.ActorIsAssignable, // TODO ApiActorsSupported
192+
ApiActorsSupported: issueFeatures.ApiActorsSupported, // TODO ApiActorsSupported
193193
Assignees: assigneeSet.ToSlice(),
194194
Labels: opts.Labels,
195195
ProjectTitles: opts.Projects,
@@ -309,7 +309,7 @@ func createRun(opts *CreateOptions) (err error) {
309309
State: &tb,
310310
}
311311
var assigneeSearchFunc func(string) prompter.MultiSelectSearchResult
312-
if issueFeatures.ActorIsAssignable {
312+
if issueFeatures.ApiActorsSupported {
313313
assigneeSearchFunc = prShared.RepoAssigneeSearchFunc(apiClient, baseRepo)
314314
}
315315
err = prShared.MetadataSurvey(opts.Prompter, opts.IO, baseRepo, fetcher, &tb, projectsV1Support, nil, assigneeSearchFunc)

pkg/cmd/issue/edit/edit.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func editRun(opts *EditOptions) error {
216216
lookupFields := []string{"id", "number", "title", "body", "url"}
217217
if editable.Assignees.Edited {
218218
// TODO ApiActorsSupported
219-
if issueFeatures.ActorIsAssignable {
219+
if issueFeatures.ApiActorsSupported {
220220
editable.ApiActorsSupported = true
221221
lookupFields = append(lookupFields, "assignedActors")
222222
} else {
@@ -249,9 +249,9 @@ func editRun(opts *EditOptions) error {
249249
// Fetch editable shared fields once for all issues.
250250
apiClient := api.NewClientFromHTTP(httpClient)
251251

252-
// Wire up search function for assignees when ActorIsAssignable is available.
252+
// Wire up search function for assignees when ApiActorsSupported is available.
253253
// Interactive mode only supports a single issue, so we use its ID for the search query.
254-
if issueFeatures.ActorIsAssignable && opts.Interactive && len(issues) == 1 {
254+
if issueFeatures.ApiActorsSupported && opts.Interactive && len(issues) == 1 {
255255
editable.AssigneeSearchFunc = prShared.AssigneeSearchFunc(apiClient, baseRepo, issues[0].ID)
256256
}
257257

pkg/cmd/issue/edit/edit_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ func mockProjectV2ItemUpdate(t *testing.T, reg *httpmock.Registry) {
935935
)
936936
}
937937

938-
func TestActorIsAssignable(t *testing.T) {
938+
func TestApiActorsSupported(t *testing.T) {
939939
t.Run("when actors are assignable, query includes assignedActors", func(t *testing.T) {
940940
ios, _, _, _ := iostreams.Test()
941941

pkg/cmd/pr/create/create.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,15 +399,15 @@ func createRun(opts *CreateOptions) error {
399399

400400
client := ctx.Client
401401

402-
// Detect ActorIsAssignable feature to determine if we can use search-based
402+
// Detect ApiActorsSupported feature to determine if we can use search-based
403403
// reviewer selection (github.com) or need to use legacy ID-based selection (GHES)
404404
issueFeatures, err := opts.Detector.IssueFeatures()
405405
if err != nil {
406406
return err
407407
}
408408
var reviewerSearchFunc func(string) prompter.MultiSelectSearchResult
409409
var assigneeSearchFunc func(string) prompter.MultiSelectSearchResult
410-
if issueFeatures.ActorIsAssignable {
410+
if issueFeatures.ApiActorsSupported {
411411
reviewerSearchFunc = func(query string) prompter.MultiSelectSearchResult {
412412
candidates, moreResults, err := api.SuggestedReviewerActorsForRepo(client, ctx.PRRefs.BaseRepo(), query)
413413
if err != nil {
@@ -430,7 +430,7 @@ func createRun(opts *CreateOptions) error {
430430
}
431431

432432
// TODO ApiActorsSupported
433-
if issueFeatures.ActorIsAssignable {
433+
if issueFeatures.ApiActorsSupported {
434434
state.ApiActorsSupported = true
435435
}
436436

pkg/cmd/pr/edit/edit.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ func editRun(opts *EditOptions) error {
270270
return err
271271
}
272272

273-
// TODO actorIsAssignableCleanup
274-
if issueFeatures.ActorIsAssignable {
273+
// TODO ApiActorsSupported
274+
if issueFeatures.ApiActorsSupported {
275275
findOptions.Fields = append(findOptions.Fields, "assignedActors")
276276
} else {
277277
findOptions.Fields = append(findOptions.Fields, "assignees")
@@ -290,7 +290,7 @@ func editRun(opts *EditOptions) error {
290290
editable.Reviewers.Default = pr.ReviewRequests.DisplayNames()
291291
editable.Reviewers.DefaultLogins = pr.ReviewRequests.Logins()
292292
// TODO ApiActorsSupported
293-
if issueFeatures.ActorIsAssignable {
293+
if issueFeatures.ApiActorsSupported {
294294
editable.ApiActorsSupported = true
295295
editable.Assignees.Default = pr.AssignedActors.DisplayNames()
296296
editable.Assignees.DefaultLogins = pr.AssignedActors.Logins()
@@ -320,8 +320,8 @@ func editRun(opts *EditOptions) error {
320320
// Wire up search functions for assignees and reviewers.
321321
// When these aren't wired up, it triggers a downstream fallback
322322
// to legacy reviewer/assignee fetching.
323-
// TODO actorIsAssignableCleanup
324-
if issueFeatures.ActorIsAssignable {
323+
// TODO ApiActorsSupported
324+
if issueFeatures.ApiActorsSupported {
325325
editable.AssigneeSearchFunc = shared.AssigneeSearchFunc(apiClient, repo, pr.ID)
326326
editable.ReviewerSearchFunc = reviewerSearchFunc(apiClient, repo, &editable, pr.ID)
327327
}

pkg/cmd/pr/shared/survey.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func MetadataSurvey(p Prompt, io *iostreams.IOStreams, baseRepo ghrepo.Interface
275275
}
276276
values.Reviewers = selectedReviewers
277277
} else if len(reviewers) > 0 {
278-
// TODO requestReviewsByLoginCleanup
278+
// TODO ApiActorsSupported
279279
// The static MultiSelect path can be removed once GHES supports
280280
// requestReviewsByLogin and search-based selection is always used.
281281
selected, err := p.MultiSelect("Reviewers", state.Reviewers, reviewers)

0 commit comments

Comments
 (0)