Skip to content

Fix to load default database in dacpac dialog when user lacks permissions#21491

Open
allancascante wants to merge 4 commits intomainfrom
dev/allancascante/dacpac_dialog_fix_fabric_default_database
Open

Fix to load default database in dacpac dialog when user lacks permissions#21491
allancascante wants to merge 4 commits intomainfrom
dev/allancascante/dacpac_dialog_fix_fabric_default_database

Conversation

@allancascante
Copy link
Contributor

@allancascante allancascante commented Mar 6, 2026

Description

In case user lack LIST ANY DATABASE permission (#21414) default to the connection database in dacpac operations. Also added support to show loading on database to improve user experience on 'slow' connections when trying to pull databases to show and fallback on errors to the default connection database.

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the DACPAC/BACPAC dialog to better handle connections where the user cannot list all databases (e.g., missing LIST ANY DATABASE), by falling back to the connection’s database and improving UX while databases are being fetched.

Changes:

  • Add backend fallback logic for database listing failures (and propagate an errorMessage to the webview) while ensuring the connection database can still be selected.
  • Add UI loading state (spinner) while databases are being retrieved and default-selection behavior based on the connection database.
  • Extend RPC contracts + add/adjust unit tests and localization strings for the new UX text.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
localization/xliff/vscode-mssql.xlf Adds new localized source string for database-loading UX text.
extensions/mssql/l10n/bundle.l10n.json Adds the "Loading databases..." key for VS Code l10n.
extensions/mssql/src/reactviews/common/locConstants.ts Introduces dacpacDialog.loadingDatabases localized constant.
extensions/mssql/src/sharedInterfaces/dacpacDialog.ts Extends RPC response shapes (errorMessage for list, databaseName for connect).
extensions/mssql/src/reactviews/pages/DacpacDialog/dacpacDialogStateProvider.tsx Updates webview RPC method typings to match updated contracts.
extensions/mssql/src/controllers/dacpacDialogWebviewController.ts Implements database listing fallback to state database; returns connection database name on connect.
extensions/mssql/src/reactviews/pages/DacpacDialog/dacpacDialogForm.tsx Tracks connection database, adds database-loading state, and improved defaulting/reset behavior.
extensions/mssql/src/reactviews/pages/DacpacDialog/SourceDatabaseSection.tsx Shows a spinner while databases are loading instead of an empty/disabled dropdown.
extensions/mssql/src/reactviews/pages/DacpacDialog/TargetDatabaseSection.tsx Shows a spinner while databases are loading for target database selection.
extensions/mssql/test/unit/dacpacDialogWebviewController.test.ts Adds coverage for fallback/error propagation behavior and databaseName in connect responses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 6410 KB 6409 KB ⚪ -1 KB ( 0% )
sql-database-projects VSIX 7061 KB 7061 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 98.50746% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.69%. Comparing base (e120e1e) to head (cdf0149).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...nsions/mssql/src/reactviews/common/locConstants.ts 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #21491      +/-   ##
==========================================
+ Coverage   72.67%   72.69%   +0.01%     
==========================================
  Files         331      331              
  Lines       98489    98543      +54     
  Branches     5462     5473      +11     
==========================================
+ Hits        71580    71633      +53     
- Misses      26909    26910       +1     
Files with missing lines Coverage Δ
...l/src/controllers/dacpacDialogWebviewController.ts 93.95% <100.00%> (+0.27%) ⬆️
...ensions/mssql/src/sharedInterfaces/dacpacDialog.ts 100.00% <100.00%> (ø)
...nsions/mssql/src/reactviews/common/locConstants.ts 25.19% <0.00%> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@allancascante allancascante added this to the March 2026 Release milestone Mar 6, 2026
Copilot AI review requested due to automatic review settings March 10, 2026 19:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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.

4 participants