Skip to content

search: repository ID is 0 for commit results in stream API

Created by: coury-clark

Linked from https://github.com/sourcegraph/sourcegraph/issues/38603#issuecomment-1181990495

Running a type:commit search in the streaming API returns a repository ID of 0 instead of the correct repository ID. https://sourcegraph.com/.api/search/stream?q=type:commit

event: matches
data: [{"type":"commit","label":"[jwasham/coding-interview-university](/github.com/jwasham/coding-interview-university) › [Antoine Cotten](/github.com/jwasham/coding-interview-university/-/commit/fe1ec60459cb8ef2d502af581b536e5bbcd4375b): [Update links to Topcoder community articles](/github.com/jwasham/coding-interview-university/-/commit/fe1ec60459cb8ef2d502af581b536e5bbcd4375b)","url":"/github.com/jwasham/coding-interview-university/-/commit/fe1ec60459cb8ef2d502af581b536e5bbcd4375b","detail":"[`fe1ec60` 5 days ago](/github.com/jwasham/coding-interview-university/-/commit/fe1ec60459cb8ef2d502af581b536e5bbcd4375b)","repositoryID":0,"repository":"github.com/jwasham/coding-interview-university","oid":"fe1ec60459cb8ef2d502af581b536e5bbcd4375b","message":"Update links to Topcoder community articles","authorName":"Antoine Cotten","authorDate":"2022-07-07T15:39:53Z","repoStars":221168,"repoLastFetched":"2022-07-11T07:07:14.462742Z","content":"```COMMIT_EDITMSG\nUpdate links to Topcoder community articles\n```","ranges":[]}]

Doesn't reproduce in GraphQL

query search {
  search(query:"type:commit repo:^github\\.com/sourcegraph/sourcegraph$") {
    results {
      alert {
        title
      }
      results {
        ... on CommitSearchResult {
          commit {
            repository {
              id
            }
          }
        }
      }
    }
  }
}