From 87bd76c5aa2f55b18acedb40883fe4663a6faa74 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Mon, 1 Sep 2025 13:55:44 +0100 Subject: [PATCH] docs: add cleanup/future TODO marks for advanced issue search changes Signed-off-by: Babak K. Shandiz --- .../featuredetection/feature_detection.go | 21 ++++++++++++------- pkg/cmd/issue/list/http.go | 4 ++++ pkg/cmd/issue/list/http_test.go | 2 ++ pkg/cmd/issue/list/list.go | 7 +++++++ pkg/cmd/issue/list/list_test.go | 12 +++++++++++ pkg/cmd/pr/list/http.go | 4 ++++ pkg/cmd/pr/list/http_test.go | 8 +++++++ pkg/cmd/pr/list/list.go | 9 +++++--- pkg/cmd/pr/list/list_test.go | 8 +++++++ pkg/cmd/search/issues/issues.go | 2 ++ pkg/cmd/search/prs/prs.go | 2 ++ pkg/search/searcher.go | 13 ++++++++---- pkg/search/searcher_test.go | 6 ++++++ 13 files changed, 83 insertions(+), 15 deletions(-) diff --git a/internal/featuredetection/feature_detection.go b/internal/featuredetection/feature_detection.go index ad1a0c092..00f9fbb91 100644 --- a/internal/featuredetection/feature_detection.go +++ b/internal/featuredetection/feature_detection.go @@ -68,9 +68,9 @@ type SearchFeatures struct { // advanced issue search syntax in the Issues tab of repositories. AdvancedIssueSearchWebInIssuesTab bool - // TODO(babakks): when advanced issue search is supported in Pull Requests - // tab, or in global search we can introduce more fields to reflect the - // support status + // TODO advancedSearchFuture + // When advanced issue search is supported in Pull Requests tab, or in + // global search we can introduce more fields to reflect the support status. } // advancedIssueSearchNotSupported mimics GHE <3.18 where advanced issue search @@ -273,6 +273,9 @@ const ( ) func (d *detector) SearchFeatures() (SearchFeatures, error) { + // TODO advancedIssueSearchCleanup + // Once GHES 3.17 support ends, we don't need this and, probably, the entire search feature detection. + // Regarding the release of advanced issue search (AIS, for short), there // are three time spans/periods: // @@ -310,9 +313,10 @@ func (d *detector) SearchFeatures() (SearchFeatures, error) { feature.AdvancedIssueSearchAPI = true feature.AdvancedIssueSearchWebInIssuesTab = true - // TODO(babakks): when the advanced search syntax is supported in - // global search or Pull Requests tabs (in repositories), we can - // enable the corresponding fields. + // TODO advancedSearchFuture + // When the advanced search syntax is supported in global search or + // Pull Requests tabs (in repositories), we can add and enable the + // corresponding fields. } } else { // As of August 2025, advanced issue search is available on github.com, @@ -320,8 +324,9 @@ func (d *detector) SearchFeatures() (SearchFeatures, error) { feature.AdvancedIssueSearchAPI = true feature.AdvancedIssueSearchWebInIssuesTab = true - // TODO(babakks): when the advanced search syntax is supported in global - // search or Pull Requests tabs (in repositories), we can enable the + // TODO advancedSearchFuture + // When the advanced search syntax is supported in global search or + // Pull Requests tabs (in repositories), we can add and enable the // corresponding fields. } diff --git a/pkg/cmd/issue/list/http.go b/pkg/cmd/issue/list/http.go index eb2c54330..0fceb3e97 100644 --- a/pkg/cmd/issue/list/http.go +++ b/pkg/cmd/issue/list/http.go @@ -114,6 +114,10 @@ loop: } func searchIssues(client *api.Client, detector fd.Detector, repo ghrepo.Interface, filters prShared.FilterOptions, limit int) (*api.IssuesAndTotalCount, error) { + // TODO advancedIssueSearchCleanup + // We won't need feature detection when GHES 3.17 support ends, since + // the advanced issue search is the only available search backend for + // issues. features, err := detector.SearchFeatures() if err != nil { return nil, err diff --git a/pkg/cmd/issue/list/http_test.go b/pkg/cmd/issue/list/http_test.go index 8c73b7eac..747bd0a4b 100644 --- a/pkg/cmd/issue/list/http_test.go +++ b/pkg/cmd/issue/list/http_test.go @@ -167,6 +167,8 @@ func TestIssueList_pagination(t *testing.T) { assert.Equal(t, []string{"user2"}, getAssignees(res.Issues[1])) } +// TODO advancedIssueSearchCleanup +// Remove this test once GHES 3.17 support ends. func TestSearchIssuesAndAdvancedSearch(t *testing.T) { tests := []struct { name string diff --git a/pkg/cmd/issue/list/list.go b/pkg/cmd/issue/list/list.go index 2dea7dceb..c27374533 100644 --- a/pkg/cmd/issue/list/list.go +++ b/pkg/cmd/issue/list/list.go @@ -58,6 +58,8 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman cmd := &cobra.Command{ Use: "list", Short: "List issues in a repository", + // TODO advancedIssueSearchCleanup + // Update the links and remove the mention at GHES 3.17 version. Long: heredoc.Doc(` List issues in a GitHub repository. By default, this only lists open issues. @@ -170,6 +172,11 @@ func listRun(opts *ListOptions) error { isTerminal := opts.IO.IsStdoutTTY() if opts.WebMode { + // TODO advancedIssueSearchCleanup + // We won't need feature detection when GHES 3.17 support ends, since + // the advanced issue search is the only available search backend for + // issues, and the GUI (i.e. Issues tab of repos) already supports the + // advanced syntax. searchFeatures, err := opts.Detector.SearchFeatures() if err != nil { return err diff --git a/pkg/cmd/issue/list/list_test.go b/pkg/cmd/issue/list/list_test.go index 040c38e8a..83dc313ce 100644 --- a/pkg/cmd/issue/list/list_test.go +++ b/pkg/cmd/issue/list/list_test.go @@ -190,6 +190,8 @@ func TestIssueList_disabledIssues(t *testing.T) { } } +// TODO advancedIssueSearchCleanup +// Simplify this test to only a single test case once GHES 3.17 support ends. func TestIssueList_web(t *testing.T) { tests := []struct { name string @@ -299,6 +301,8 @@ func Test_issueList(t *testing.T) { { name: "milestone by number", args: args{ + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. detector: fd.AdvancedIssueSearchSupportedAsOptIn(), limit: 30, repo: ghrepo.New("OWNER", "REPO"), @@ -339,6 +343,8 @@ func Test_issueList(t *testing.T) { { name: "milestone by title", args: args{ + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. detector: fd.AdvancedIssueSearchSupportedAsOptIn(), limit: 30, repo: ghrepo.New("OWNER", "REPO"), @@ -408,6 +414,8 @@ func Test_issueList(t *testing.T) { { name: "@me with search", args: args{ + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. detector: fd.AdvancedIssueSearchSupportedAsOptIn(), limit: 30, repo: ghrepo.New("OWNER", "REPO"), @@ -444,6 +452,8 @@ func Test_issueList(t *testing.T) { { name: "with labels", args: args{ + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. detector: fd.AdvancedIssueSearchSupportedAsOptIn(), limit: 30, repo: ghrepo.New("OWNER", "REPO"), @@ -615,6 +625,8 @@ func TestIssueList_Search_withProjectItems(t *testing.T) { client := &http.Client{Transport: reg} issuesAndTotalCount, err := issueList( client, + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. fd.AdvancedIssueSearchSupportedAsOptIn(), ghrepo.New("OWNER", "REPO"), prShared.FilterOptions{ diff --git a/pkg/cmd/pr/list/http.go b/pkg/cmd/pr/list/http.go index 24a303e43..4f82d5006 100644 --- a/pkg/cmd/pr/list/http.go +++ b/pkg/cmd/pr/list/http.go @@ -30,6 +30,10 @@ func listPullRequests(httpClient *http.Client, detector fd.Detector, repo ghrepo } func searchPullRequests(httpClient *http.Client, detector fd.Detector, repo ghrepo.Interface, filters prShared.FilterOptions, limit int) (*api.PullRequestAndTotalCount, error) { + // TODO advancedIssueSearchCleanup + // We won't need feature detection when GHES 3.17 support ends, since + // the advanced issue search is the only available search backend for + // issues. features, err := detector.SearchFeatures() if err != nil { return nil, err diff --git a/pkg/cmd/pr/list/http_test.go b/pkg/cmd/pr/list/http_test.go index e3b8cad5d..5f08498f7 100644 --- a/pkg/cmd/pr/list/http_test.go +++ b/pkg/cmd/pr/list/http_test.go @@ -78,6 +78,8 @@ func Test_ListPullRequests(t *testing.T) { { name: "with labels", args: args{ + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. detector: fd.AdvancedIssueSearchSupportedAsOptIn(), repo: ghrepo.New("OWNER", "REPO"), limit: 30, @@ -104,6 +106,8 @@ func Test_ListPullRequests(t *testing.T) { { name: "with author", args: args{ + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. detector: fd.AdvancedIssueSearchSupportedAsOptIn(), repo: ghrepo.New("OWNER", "REPO"), limit: 30, @@ -130,6 +134,8 @@ func Test_ListPullRequests(t *testing.T) { { name: "with search", args: args{ + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. detector: fd.AdvancedIssueSearchSupportedAsOptIn(), repo: ghrepo.New("OWNER", "REPO"), limit: 30, @@ -171,6 +177,8 @@ func Test_ListPullRequests(t *testing.T) { } } +// TODO advancedIssueSearchCleanup +// Remove this test once GHES 3.17 support ends. func TestSearchPullRequestsAndAdvancedSearch(t *testing.T) { tests := []struct { name string diff --git a/pkg/cmd/pr/list/list.go b/pkg/cmd/pr/list/list.go index 1419aef9d..8e927cafa 100644 --- a/pkg/cmd/pr/list/list.go +++ b/pkg/cmd/pr/list/list.go @@ -56,6 +56,8 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman cmd := &cobra.Command{ Use: "list", Short: "List pull requests in a repository", + // TODO advancedIssueSearchCleanup + // Update the links and remove the mention at GHES 3.17 version. Long: heredoc.Doc(` List pull requests in a GitHub repository. By default, this only lists open PRs. @@ -177,9 +179,10 @@ func listRun(opts *ListOptions) error { if opts.WebMode { prListURL := ghrepo.GenerateRepoURL(baseRepo, "pulls") - // TODO(babakks): As of August 2025, the advanced issue search syntax is - // not supported in Pull Requests tab of repositories. When it's supported - // we can change the argument to true. + // TODO advancedSearchFuture + // As of August 2025, the advanced issue search syntax is not supported + // in Pull Requests tab of repositories. When it's supported we can + // change the argument to true. openURL, err := shared.ListURLWithQuery(prListURL, filters, false) if err != nil { return err diff --git a/pkg/cmd/pr/list/list_test.go b/pkg/cmd/pr/list/list_test.go index 3df8721e6..4953b8888 100644 --- a/pkg/cmd/pr/list/list_test.go +++ b/pkg/cmd/pr/list/list_test.go @@ -192,6 +192,8 @@ func TestPRList_filteringAssignee(t *testing.T) { assert.Equal(t, `assignee:hubot base:develop is:merged label:"needs tests" repo:OWNER/REPO type:pr`, params["q"].(string)) })) + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. _, err := runCommand(http, fd.AdvancedIssueSearchSupportedAsOptIn(), true, `-s merged -l "needs tests" -a hubot -B develop`) assert.Error(t, err) } @@ -225,6 +227,8 @@ func TestPRList_filteringDraft(t *testing.T) { assert.Equal(t, test.expectedQuery, params["q"].(string)) })) + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. _, err := runCommand(http, fd.AdvancedIssueSearchSupportedAsOptIn(), true, test.cli) assert.Error(t, err) }) @@ -270,6 +274,8 @@ func TestPRList_filteringAuthor(t *testing.T) { assert.Equal(t, test.expectedQuery, params["q"].(string)) })) + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. _, err := runCommand(http, fd.AdvancedIssueSearchSupportedAsOptIn(), true, test.cli) assert.Error(t, err) }) @@ -443,6 +449,8 @@ func TestPRList_Search_withProjectItems(t *testing.T) { client := &http.Client{Transport: reg} prsAndTotalCount, err := listPullRequests( client, + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. fd.AdvancedIssueSearchSupportedAsOptIn(), ghrepo.New("OWNER", "REPO"), prShared.FilterOptions{ diff --git a/pkg/cmd/search/issues/issues.go b/pkg/cmd/search/issues/issues.go index 845cc7c60..a4bdca36a 100644 --- a/pkg/cmd/search/issues/issues.go +++ b/pkg/cmd/search/issues/issues.go @@ -26,6 +26,8 @@ func NewCmdIssues(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *c cmd := &cobra.Command{ Use: "issues []", Short: "Search for issues", + // TODO advancedIssueSearchCleanup + // Update the links and remove the mention at GHES 3.17 version. Long: heredoc.Docf(` Search for issues on GitHub. diff --git a/pkg/cmd/search/prs/prs.go b/pkg/cmd/search/prs/prs.go index c91761f49..db1731053 100644 --- a/pkg/cmd/search/prs/prs.go +++ b/pkg/cmd/search/prs/prs.go @@ -28,6 +28,8 @@ func NewCmdPrs(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *cobr cmd := &cobra.Command{ Use: "prs []", Short: "Search for pull requests", + // TODO advancedIssueSearchCleanup + // Update the links and remove the mention at GHES 3.17 version. Long: heredoc.Docf(` Search for pull requests on GitHub. diff --git a/pkg/search/searcher.go b/pkg/search/searcher.go index 3fe69fd2a..7097d2fe8 100644 --- a/pkg/search/searcher.go +++ b/pkg/search/searcher.go @@ -210,6 +210,10 @@ func (s searcher) search(query Query, result interface{}) (*http.Response, error qs.Set("per_page", strconv.Itoa(query.Limit)) if query.Kind == KindIssues { + // TODO advancedIssueSearchCleanup + // We won't need feature detection when GHES 3.17 support ends, since + // the advanced issue search is the only available search backend for + // issues. features, err := s.detector.SearchFeatures() if err != nil { return nil, err @@ -269,10 +273,11 @@ func (s searcher) URL(query Query) string { qs := url.Values{} qs.Set("type", query.Kind) - // TODO(babakks): currently, the global search GUI does not support the - // advanced issue search syntax (even for the issues/PRs tab on the - // sidebar). When the GUI is updated, we can use feature detection, and, if - // available, use the advanced search syntax. + // TODO advancedSearchFuture + // Currently, the global search GUI does not support the advanced issue + // search syntax (even for the issues/PRs tab on the sidebar). When the GUI + // is updated, we can use feature detection, and, if available, use the + // advanced search syntax. qs.Set("q", query.String()) if query.Order != "" { diff --git a/pkg/search/searcher_test.go b/pkg/search/searcher_test.go index df30ae6ac..f5467be37 100644 --- a/pkg/search/searcher_test.go +++ b/pkg/search/searcher_test.go @@ -1161,6 +1161,8 @@ func TestSearcherIssuesAdvancedSyntax(t *testing.T) { wantErr string }{ { + // TODO advancedIssueSearchCleanup + // Remove this test case once GHES 3.17 support ends. name: "advanced issue search not supported", detector: fd.AdvancedIssueSearchUnsupported(), query: query, @@ -1170,6 +1172,8 @@ func TestSearcherIssuesAdvancedSyntax(t *testing.T) { }, }, { + // TODO advancedIssueSearchCleanup + // Remove this test case once GHES 3.17 support ends. name: "advanced issue search supported as an opt-in feature", detector: fd.AdvancedIssueSearchSupportedAsOptIn(), query: query, @@ -1179,6 +1183,8 @@ func TestSearcherIssuesAdvancedSyntax(t *testing.T) { }, }, { + // TODO advancedIssueSearchCleanup + // No need for feature detection once GHES 3.17 support ends. name: "advanced issue search supported as the only search backend", detector: fd.AdvancedIssueSearchSupportedAsOnlyBackend(), query: query,