Repository navigation
Conversation
Replace hand-written endpoint + case-insensitive login comparisons with isSameAccount, and add getRepositoryAccountIdentity to build the identity of a repository's assigned account. No behaviour change. Co-authored-by: Copilot App <[email protected]>
This was referenced Oct 15, 2026
…-comparisons Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused refactor preserves intended identity matching and null handling, with no unresolved findings.
No open issues 🎉
What changed in this PR
Consolidates repository account identity comparisons using existing helpers, building on the multi-account support in #23020.
Changes:
- Replaces 11 handwritten comparisons with
isSameAccount. - Adds
getRepositoryAccountIdentityfor nullable repository assignments. - Leaves strict assignment-change checks unchanged.
| File | Description |
|---|---|
| app/src/ui/repository-settings/repository-settings.tsx | Simplifies selected-account matching. |
| app/src/ui/repository-account/repository-account-dialog.tsx | Reuses helpers for sign-in checks. |
| app/src/models/repository.ts | Adds repository account identity helper. |
| app/src/lib/trampoline/trampoline-credential-helper.ts | Simplifies fallback credential account lookup. |
| app/src/lib/stores/repositories-store.ts | Reuses helpers when clearing assignments. |
| app/src/lib/stores/app-store.ts | Consolidates clone, sign-out, and account-selection checks. |
| app/src/lib/repository-matching.ts | Simplifies selected-account verification. |
| app/src/lib/get-account-for-repository.ts | Centralizes assigned-account lookup. |
Review effort: Balanced
…-comparisons Co-authored-by: Copilot App <[email protected]>
…-comparisons Co-authored-by: Copilot App <[email protected]>
…-comparisons Co-authored-by: Copilot App <[email protected]>
…-comparisons Co-authored-by: Copilot App <[email protected]>
sergiou87
previously approved these changes
Oct 21, 2026
…-comparisons Co-authored-by: Copilot App <[email protected]>
…-comparisons Co-authored-by: Copilot App <[email protected]>
…-comparisons Co-authored-by: Copilot App <[email protected]>
…-comparisons Co-authored-by: Copilot App <[email protected]>
sergiou87
approved these changes
Oct 22, 2026
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.
Stacked on #23020.
Description
This is a pure refactor with no behaviour change. It replaces the hand-written "same endpoint and case-insensitively equal login" checks introduced in #23020 with the existing
isSameAccounthelper. It also addsgetRepositoryAccountIdentity(repository): IAccountIdentity | nulltomodels/repository.ts, which returns the identity of a repository's assigned account, ornullwhen the repository has no GitHub repository or no login.Replaced (11 sites)
getAccountForRepositoryrepository-matching.ts(verifying the selected account)trampoline-credential-helper.ts(fallback account lookup)RepositoriesStore.clearAccountAssignmentsAppStore:_signOutAccountrepository count_updateRepositoryAccountsigned-in checkRepositoryAccountDialog:requiresSignInandonAssignedAccountSignInResultRepositorySettings.selectedAccountDeliberately left alone
AppStore._selectRepositoryruleset cache invalidation and thecurrent.login !== repository.logincheck during repository refresh. These detect any change to the assignment, so they compare strictly (case-sensitive, and null equals null). They aren't identity checks.RepositoryAccountDialog(onAccountChanged,accounts). They match the exact<select>value within a list that is already filtered by endpoint.getAccountKey(a) === keylookups inAccountsStore(one of them also comparesid); persisted DB record and index comparisons; owner, repository and email matching.accountEquals, which compares endpoint and id and so has different semantics.Note
isSameAccountcompares endpoints case-insensitively, while the old checks used===. Endpoints are normalized API URLs (built fromURL.host), andgetAccountKeyis already the account identity inAccountsStore, so nothing changes in practice.Validation
tsc --noEmitpasses.Release notes
Notes: no-notes