fix(github): prioritize authenticated user repositories in clone search - #327659
Open
rohitbytecode wants to merge 1 commit into
Open
fix(github): prioritize authenticated user repositories in clone search#327659rohitbytecode wants to merge 1 commit into
rohitbytecode wants to merge 1 commit into
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Prioritizes authenticated GitHub repositories in clone search results.
Changes:
- Preserves authenticated repositories during deduplication.
- Filters and lazily populates the repository cache.
- Reorders authenticated results before public search results.
Comment on lines
+86
to
+89
| return this.userReposCache.filter(repo => | ||
| repo.name | ||
| .toLowerCase() | ||
| .includes(normalizedQuery) |
Comment on lines
+81
to
83
| if (this.userReposCache.length === 0) { | ||
| const res = await octokit.repos.listForAuthenticatedUser({ sort: 'updated', per_page: 100 }); | ||
| this.userReposCache = res.data.map(asRemoteSource); |
Comment on lines
+82
to
83
| const res = await octokit.repos.listForAuthenticatedUser({ sort: 'updated', per_page: 100 }); | ||
| this.userReposCache = res.data.map(asRemoteSource); |
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #141754
User's own repos were getting buried under public search results in the GitHub clone picker. This fixes the merge order so authenticated user repos always show up first.
Root cause
GithubRemoteSourceProvider.getRemoteSources()merges results fromgetUserRemoteSources()andgetQueryRemoteSources(). The merge was overwriting duplicates instead of keeping the first match, and cached user repos weren't being filtered against the current query. End result: your own repos could rank below public repos with a similar name, and stale cached repos showed up even when they didn't match what you typed.Changes
Testing
Couldn't run the full VS Code build locally — missing the Spectre-mitigated VC++ libs on this machine. Change is small and scoped to
extensions/github/src/remoteSourceProvider.ts, should be fine for CI to validate.