Skip to content

Commit

Permalink
archive: add cody and golang repo to e2e rank corpus
Browse files Browse the repository at this point in the history
Additionally we add many queries we are tracking.

Test Plan: go test
  • Loading branch information
keegancsmith committed Nov 20, 2023
1 parent 0f685d8 commit 5238bba
Show file tree
Hide file tree
Showing 9 changed files with 314 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/zoekt-archive-index/e2e_rank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,24 @@ func TestRanking(t *testing.T) {

archiveURLs := []string{
"https://github.com/sourcegraph/sourcegraph/tree/v5.2.2",
"https://github.com/golang/go/tree/go1.21.4",
"https://github.com/sourcegraph/cody/tree/vscode-v0.14.5",
}
queries := []string{
// golang/go
"test server",
"bytes buffer",
"bufio buffer",

// sourcegraph/sourcegraph
"graphql type User",
"Get database/user",
"InternalDoer",
"Repository metadata Write rbac",

// cody
"generate unit test",
"r:cody sourcegraph url",
}

indexDir := t.TempDir()
Expand Down
40 changes: 40 additions & 0 deletions cmd/zoekt-archive-index/testdata/Get_databaseuser.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
queryString: Get database/user
query: (and case_substr:"Get" substr:"database/user")

github.com/sourcegraph/sourcegraph/internal/database/user_emails.go
161:func (s *userEmailsStore) Get(ctx context.Context, userID int32, email string) (emailCanonicalCase string, verified bool, err error) {
50: Get(ctx context.Context, userID int32, email string) (emailCanonicalCase string, verified bool, err error)
91:func (s *userEmailsStore) GetInitialSiteAdminInfo(ctx context.Context) (email string, tosAccepted bool, err error) {
hidden 14 more line matches

github.com/sourcegraph/sourcegraph/internal/database/user_roles.go
35: GetUserRoleOpts UserRoleOpts
358:func (r *userRoleStore) GetByUserID(ctx context.Context, opts GetUserRoleOpts) ([]*types.UserRole, error) {
365:func (r *userRoleStore) GetByRoleID(ctx context.Context, opts GetUserRoleOpts) ([]*types.UserRole, error) {
hidden 8 more line matches

github.com/sourcegraph/sourcegraph/internal/database/users.go
940:func (u *userStore) GetByID(ctx context.Context, id int32) (*types.User, error) {
947:func (u *userStore) GetByVerifiedEmail(ctx context.Context, email string) (*types.User, error) {
951:func (u *userStore) GetByUsername(ctx context.Context, username string) (*types.User, error) {
hidden 17 more line matches

github.com/sourcegraph/sourcegraph/internal/database/user_credentials.go
248:func (s *userCredentialsStore) GetByID(ctx context.Context, id int64) (*UserCredential, error) {
271:func (s *userCredentialsStore) GetByScope(ctx context.Context, scope UserCredentialScope) (*UserCredential, error) {
108: GetByID(ctx context.Context, id int64) (*UserCredential, error)
hidden 8 more line matches

github.com/sourcegraph/sourcegraph/internal/database/user_emails_test.go
56:func TestUserEmails_Get(t *testing.T) {
106:func TestUserEmails_GetPrimary(t *testing.T) {
585:func TestUserEmails_GetLatestVerificationSentEmail(t *testing.T) {
hidden 10 more line matches

github.com/sourcegraph/sourcegraph/internal/database/users_test.go
628:func TestUsers_GetByVerifiedEmail(t *testing.T) {
664:func TestUsers_GetByUsername(t *testing.T) {
711:func TestUsers_GetByUsernames(t *testing.T) {
hidden 32 more line matches

hidden 3 more file matches
27 changes: 27 additions & 0 deletions cmd/zoekt-archive-index/testdata/InternalDoer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
queryString: InternalDoer
query: case_substr:"InternalDoer"

github.com/sourcegraph/sourcegraph/internal/httpcli/client.go
217:var InternalDoer, _ = InternalClientFactory.Doer()
215:// InternalDoer is a shared client for internal communication. This is a

github.com/sourcegraph/sourcegraph/internal/api/internalapi/client.go
144: resp, err := httpcli.InternalDoer.Do(req.WithContext(ctx))

github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings/qa/context_data.tsv
3:In the sourcegraph repository, what does InternalDoer do? internal/httpcli/client.go
4:In my codebase, what does InternalDoer do? internal/httpcli/client.go

github.com/sourcegraph/sourcegraph/cmd/frontend/internal/app/badge.go
23: totalRefs, err := backend.CountGoImporters(r.Context(), httpcli.InternalDoer, routevar.ToRepo(mux.Vars(r)))

github.com/sourcegraph/sourcegraph/internal/batches/webhooks/webhooks.go
67: Enqueue(ctx, logger, db, eventType, marshalBatchChange, id, httpcli.InternalDoer)
74: Enqueue(ctx, logger, db, eventType, marshalChangeset, id, httpcli.InternalDoer)

github.com/sourcegraph/sourcegraph/cmd/frontend/internal/app/resolvers/app.go
53: doer: httpcli.InternalDoer,
354: cli := httpcli.InternalDoer
424: cli := httpcli.InternalDoer

hidden 9 more file matches
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
queryString: Repository metadata Write rbac
query: (and case_substr:"Repository" substr:"metadata" case_substr:"Write" substr:"rbac")

github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/repository_metadata.go
54:func (r *schemaResolver) AddRepoMetadata(ctx context.Context, args struct {
95:func (r *schemaResolver) UpdateRepoMetadata(ctx context.Context, args struct {
134:func (r *schemaResolver) DeleteRepoMetadata(ctx context.Context, args struct {
hidden 30 more line matches

github.com/sourcegraph/sourcegraph/client/web/src/repo/tree/TreePageContent.tsx
666:interface RepositoryContributorNodeProps extends QuerySpec {
10:import { RepoMetadata } from '@sourcegraph/branded'
16:import { RepositoryType, SearchPatternType, type TreeFields } from '@sourcegraph/shared/src/graphql-operations'
hidden 46 more line matches

github.com/sourcegraph/sourcegraph/doc/admin/repo/metadata.md
1:# Custom repository metadata
18:## Adding metadata
8:### Repository owners
hidden 14 more line matches

github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/repository_metadata_test.go
26:func TestRepositoryMetadata(t *testing.T) {
17: "github.com/sourcegraph/sourcegraph/internal/rbac"
23: rtypes "github.com/sourcegraph/sourcegraph/internal/rbac/types"
hidden 25 more line matches

github.com/sourcegraph/sourcegraph/client/web/src/repo/repoContainerRoutes.tsx
3:import { canWriteRepoMetadata } from '../util/rbac'
5:import { RepositoryChangelistPage } from './commit/RepositoryCommitPage'
9:const RepositoryCommitPage = lazyComponent(() => import('./commit/RepositoryCommitPage'), 'RepositoryCommitPage')
hidden 19 more line matches

40 changes: 40 additions & 0 deletions cmd/zoekt-archive-index/testdata/bufio_buffer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
queryString: bufio buffer
query: (and substr:"bufio" substr:"buffer")

github.com/golang/go/src/bytes/buffer.go
20:type Buffer struct {
60:func (b *Buffer) AvailableBuffer() []byte { return b.buf[len(b.buf):] }
472:func NewBuffer(buf []byte) *Buffer { return &Buffer{buf: buf} }
hidden 108 more line matches

github.com/golang/go/src/bufio/scan.go
267:func (s *Scanner) Buffer(buf []byte, max int) {
5:package bufio
25:// large to fit in the buffer. When a scan stops, the reader may have
hidden 21 more line matches

github.com/golang/go/src/bufio/bufio.go
8:package bufio
665:func (b *Writer) AvailableBuffer() []byte {
338:func (b *Reader) Buffered() int { return b.w - b.r }
hidden 89 more line matches

github.com/golang/go/src/cmd/doc/pkg.go
59: bytes.Buffer
56:type pkgBuffer struct {
8: "bufio"
hidden 8 more line matches

github.com/golang/go/src/net/http/h2_bundle.go
3716:type http2pipeBuffer interface {
1086:type http2dataBuffer struct {
3724:func (p *http2pipe) setBuffer(b http2pipeBuffer) {
hidden 116 more line matches

github.com/golang/go/src/image/png/writer.go
36:type EncoderBuffer encoder
24: BufferPool EncoderBufferPool
30:type EncoderBufferPool interface {
hidden 18 more line matches

hidden 112 more file matches
40 changes: 40 additions & 0 deletions cmd/zoekt-archive-index/testdata/bytes_buffer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
queryString: bytes buffer
query: (and substr:"bytes" substr:"buffer")

github.com/golang/go/src/bytes/buffer.go
20:type Buffer struct {
54:func (b *Buffer) Bytes() []byte { return b.buf[b.off:] }
5:package bytes
hidden 126 more line matches

github.com/golang/go/src/cmd/internal/edit/edit.go
14:type Buffer struct {
68:func (b *Buffer) Bytes() []byte {
41:func NewBuffer(data []byte) *Buffer {
hidden 13 more line matches

github.com/golang/go/src/hash/crc32/crc32_ppc64le.s
122: SLD $2,R8 // convert index-> bytes
59: MOVWZ 0(R5),R8 // 0-3 bytes of p ?Endian?
60: MOVWZ 4(R5),R9 // 4-7 bytes of p
hidden 35 more line matches

github.com/golang/go/src/fmt/print.go
101:type buffer []byte
509:func (p *pp) fmtBytes(v []byte, verb rune, typeString string) {
17:// Strings for use with buffer.WriteString.
hidden 28 more line matches

github.com/golang/go/src/bufio/scan.go
106:func (s *Scanner) Bytes() []byte {
267:func (s *Scanner) Buffer(buf []byte, max int) {
289:func ScanBytes(data []byte, atEOF bool) (advance int, token []byte, err error) {
hidden 26 more line matches

github.com/golang/go/src/os/exec/exec.go
1134:func (w *prefixSuffixSaver) Bytes() []byte {
94: "bytes"
396: if i := bytes.Index(stack, []byte("\nos/exec.Command(")); i >= 0 {
hidden 17 more line matches

hidden 494 more file matches
40 changes: 40 additions & 0 deletions cmd/zoekt-archive-index/testdata/generate_unit_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
queryString: generate unit test
query: (and substr:"generate" substr:"unit" substr:"test")

github.com/sourcegraph/sourcegraph/cmd/frontend/internal/insights/resolvers/insight_series_resolver.go
300:func (j *seriesResolverGenerator) Generate(ctx context.Context, series types.InsightViewSeries, baseResolver baseInsightResolver, filters types.InsightViewFilters, options types.SeriesDisplayOptions) ([]graphqlbackend.InsightSeriesResolver, error) {
275: Generate(ctx context.Context, series types.InsightViewSeries, baseResolver baseInsightResolver, filters types.InsightViewFilters, options types.SeriesDisplayOptions) ([]graphqlbackend.InsightSeriesResolver, error)
286: generateResolver resolverGenerator
hidden 16 more line matches

github.com/golang/go/src/cmd/vendor/github.com/google/pprof/internal/report/report.go
87:func Generate(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
187:func (rpt *Report) selectOutputUnit(g *graph.Graph) {
75: SampleUnit string // Unit for the sample data from the profile.
hidden 48 more line matches

github.com/sourcegraph/sourcegraph/internal/codeintel/autoindexing/internal/inference/lua/test.lua
9: generate = function(_, paths)
6: patterns = { pattern.new_path_basename "sg-test" },
8: -- Invoked as part of unit tests for the autoindexing service
hidden 1 more line matches

github.com/golang/go/src/cmd/internal/testdir/testdir_test.go
273:type test struct {
74:func Test(t *testing.T) {
263:type testCommon struct {
hidden 120 more line matches

github.com/golang/go/src/cmd/vendor/github.com/google/pprof/profile/profile.go
65: Unit string // seconds, nanoseconds, bytes, etc
77: NumUnit map[string][]string
68: unitX int64
hidden 44 more line matches

github.com/golang/go/src/cmd/link/internal/loader/loader.go
79: unit *sym.CompilationUnit
1544:func (l *Loader) SymUnit(i Sym) *sym.CompilationUnit {
228: generatedSyms Bitmap // symbols that generate their content, indexed by ext sym idx
hidden 50 more line matches

hidden 244 more file matches
39 changes: 39 additions & 0 deletions cmd/zoekt-archive-index/testdata/r_cody_sourcegraph_url.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
queryString: r:cody sourcegraph url
query: (and repo:cody substr:"sourcegraph" substr:"url")

github.com/sourcegraph/cody/lib/shared/src/sourcegraph-api/graphql/client.ts
611: const url = buildGraphQLUrl({ request: query, baseUrl: this.config.serverEndpoint })
626: const url = buildGraphQLUrl({ request: query, baseUrl: this.dotcomUrl.href })
641: const url = 'http://localhost:49300/.api/testLogging'
hidden 51 more line matches

github.com/sourcegraph/cody/vscode/src/completions/client.ts
85: const url = getCodeCompletionsEndpoint()
1:import { FeatureFlag, featureFlagProvider } from '@sourcegraph/cody-shared/src/experimentation/FeatureFlagProvider'
5:} from '@sourcegraph/cody-shared/src/sourcegraph-api/completions/client'
hidden 6 more line matches

github.com/sourcegraph/cody/vscode/scripts/download-wasm-modules.ts
83: for (const url of urls) {
93:function getFilePathFromURL(url: string): string {
20:const urls = [
hidden 21 more line matches

github.com/sourcegraph/cody/slack/src/services/local-vector-store.ts
18: const { content, url } = codyNotice
9: owner: 'sourcegraph',
24: fileName: url,

github.com/sourcegraph/cody/lib/shared/src/sourcegraph-api/completions/client.ts
23:export abstract class SourcegraphCompletionsClient {
21: * Access the chat based LLM APIs via a Sourcegraph server instance.
36: return new URL('/.api/completions/stream', this.config.serverEndpoint).href
hidden 1 more line matches

github.com/sourcegraph/cody/lib/shared/src/sourcegraph-api/completions/browserClient.ts
8:export class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
5:import { SourcegraphCompletionsClient } from './client'
20: headersInstance.set('X-Sourcegraph-Should-Trace', 'true')
hidden 1 more line matches

hidden 71 more file matches
40 changes: 40 additions & 0 deletions cmd/zoekt-archive-index/testdata/test_server.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
queryString: test server
query: (and substr:"test" substr:"server")

github.com/golang/go/src/net/http/httptest/server.go
26:type Server struct {
105:func NewServer(handler http.Handler) *Server {
117:func NewUnstartedServer(handler http.Handler) *Server {
hidden 62 more line matches

github.com/golang/go/src/net/rpc/server.go
188:type Server struct {
656:type ServerCodec interface {
197:func NewServer() *Server {
hidden 104 more line matches

github.com/sourcegraph/cody/vscode/test/fixtures/mock-server.ts
126: const server = app.listen(SERVER_PORT, () => {
19:const SERVER_PORT = 49300
21:export const SERVER_URL = 'http://localhost:49300'
hidden 24 more line matches

github.com/golang/go/src/net/http/server.go
2617:type Server struct {
256: server *Server
2925:type serverHandler struct {
hidden 180 more line matches

github.com/sourcegraph/sourcegraph/cmd/gitserver/server/server.go
132:type Server struct {
2:package server
741:func (s *Server) serverContext() (context.Context, context.CancelFunc) {
hidden 166 more line matches

github.com/golang/go/src/cmd/go/internal/vcweb/vcstest/vcstest.go
32:type Server struct {
42:func NewServer() (srv *Server, err error) {
7:package vcstest
hidden 31 more line matches

hidden 494 more file matches

0 comments on commit 5238bba

Please sign in to comment.