Fix scope picker visibility and function git settings updates#3014
Fix scope picker visibility and function git settings updates#3014HarshMN2345 merged 2 commits intomainfrom
Conversation
Greptile SummaryThis PR fixes three related issues: scope picker visibility broken by a Confidence Score: 4/5Safe to merge with one minor defensive-coding improvement suggested All three bug fixes are correct and well-scoped. The only finding is a P2 in updateRepository.svelte where an added API call inside an existing silent-catch block can silently prevent repository connection on transient network failure; it is not a regression but a new failure surface introduced by this PR. updateRepository.svelte — the new listRepositoryBranches call inside connect()'s try/catch Important Files Changed
Reviews (2): Last reviewed commit: "Address PR feedback on scope categories ..." | Re-trigger Greptile |
| async function connect(selectedInstallationId: string, selectedRepository: string) { | ||
| let nextBranch = func?.providerBranch ?? 'main'; | ||
| try { | ||
| const branchList = await sdk | ||
| .forProject(page.params.region, page.params.project) | ||
| .vcs.listRepositoryBranches({ | ||
| installationId: selectedInstallationId, | ||
| providerRepositoryId: selectedRepository | ||
| }); | ||
| const sorted = sortBranches(branchList.branches); | ||
| nextBranch = | ||
| sorted.find((branch) => branch.name === func?.providerBranch)?.name ?? | ||
| sorted.find((branch) => branch.name === 'main' || branch.name === 'master')?.name ?? | ||
| sorted[0]?.name ?? | ||
| nextBranch; |
There was a problem hiding this comment.
If
listRepositoryBranches throws (network blip, access revoked, empty repo), the catch { return; } at the bottom silently abandons the entire connection — functions.update never runs and the user sees no feedback. Consider wrapping only the branch fetch in its own try/catch so a failure there still allows the connection to proceed with the nextBranch fallback.
| async function connect(selectedInstallationId: string, selectedRepository: string) { | |
| let nextBranch = func?.providerBranch ?? 'main'; | |
| try { | |
| const branchList = await sdk | |
| .forProject(page.params.region, page.params.project) | |
| .vcs.listRepositoryBranches({ | |
| installationId: selectedInstallationId, | |
| providerRepositoryId: selectedRepository | |
| }); | |
| const sorted = sortBranches(branchList.branches); | |
| nextBranch = | |
| sorted.find((branch) => branch.name === func?.providerBranch)?.name ?? | |
| sorted.find((branch) => branch.name === 'main' || branch.name === 'master')?.name ?? | |
| sorted[0]?.name ?? | |
| nextBranch; | |
| async function connect(selectedInstallationId: string, selectedRepository: string) { | |
| let nextBranch = func?.providerBranch ?? 'main'; | |
| try { | |
| const branchList = await sdk | |
| .forProject(page.params.region, page.params.project) | |
| .vcs.listRepositoryBranches({ | |
| installationId: selectedInstallationId, | |
| providerRepositoryId: selectedRepository | |
| }).catch(() => null); | |
| if (branchList) { | |
| const sorted = sortBranches(branchList.branches); | |
| nextBranch = | |
| sorted.find((branch) => branch.name === func?.providerBranch)?.name ?? | |
| sorted.find((branch) => branch.name === 'main' || branch.name === 'master')?.name ?? | |
| sorted[0]?.name ?? | |
| nextBranch; | |
| } |
What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)