docs: add cleanup/future TODO marks for advanced issue search changes

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2025-09-01 13:55:44 +01:00
parent 33f1f6ea68
commit 87bd76c5aa
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E
13 changed files with 83 additions and 15 deletions

View file

@ -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.
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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{

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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{

View file

@ -26,6 +26,8 @@ func NewCmdIssues(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *c
cmd := &cobra.Command{
Use: "issues [<query>]",
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.

View file

@ -28,6 +28,8 @@ func NewCmdPrs(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *cobr
cmd := &cobra.Command{
Use: "prs [<query>]",
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.

View file

@ -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 != "" {

View file

@ -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,