Skip to content

Fix scope picker visibility and function git settings updates#3014

Merged
HarshMN2345 merged 2 commits intomainfrom
fix-000-scope-picker-git-settings
May 2, 2026
Merged

Fix scope picker visibility and function git settings updates#3014
HarshMN2345 merged 2 commits intomainfrom
fix-000-scope-picker-git-settings

Conversation

@HarshMN2345
Copy link
Copy Markdown
Member

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.)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 2, 2026

Greptile Summary

This PR fixes three related issues: scope picker visibility broken by a DatabaseDatabases category rename (with normalizeCategory and dynamic categories derivation), missing git settings fields (providerSilentMode, providerRootDirectory, buildSpecification) being dropped on update/connect/disconnect operations, and a wrong product="sites" prop on the SelectRootModal in the functions settings page.

Confidence Score: 4/5

Safe 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

Filename Overview
src/routes/(console)/project-[region]-[project]/overview/api-keys/scopes.svelte Fixes scope picker visibility by normalizing 'Database' → 'Databases', adding new categories (Project, Domains), deriving categories dynamically from filteredScopes, and using effectiveScopes for compat-pair translation
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateRepository.svelte Adds buildSpecification/providerSilentMode/providerRootDirectory to updateConfiguration and connect calls; adds branch-detection logic in connect(); fixes SelectRootModal product prop from 'sites' to 'functions'
src/routes/(console)/project-[region]-[project]/functions/function-[function]/(modals)/createGit.svelte Adds providerSilentMode, providerRootDirectory, and buildSpecification to the function update call in createDeployment() to preserve existing settings
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/disconnectRepo.svelte Preserves buildSpecification when disconnecting a repository by forwarding the existing value instead of clearing it

Reviews (2): Last reviewed commit: "Address PR feedback on scope categories ..." | Re-trigger Greptile

Comment on lines 132 to +146
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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Suggested change
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;
}

@HarshMN2345 HarshMN2345 requested a review from eldadfux May 2, 2026 03:46
@HarshMN2345 HarshMN2345 merged commit 0275dc4 into main May 2, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-000-scope-picker-git-settings branch May 2, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants