Skip to content

DacPac Dialog Bug Fixes and Feature Flag Implementation#20505

Merged
allancascante merged 86 commits intomainfrom
dev/allancascante/dacpac_dialog_fixes
Nov 10, 2025
Merged

DacPac Dialog Bug Fixes and Feature Flag Implementation#20505
allancascante merged 86 commits intomainfrom
dev/allancascante/dacpac_dialog_fixes

Conversation

@allancascante
Copy link
Copy Markdown
Contributor

@allancascante allancascante commented Nov 8, 2025

Description

This PR addresses critical bug fixes identified during code review and implements a feature flag to gate the Data-tier Application dialog behind experimental features. This allows for controlled rollout and user opt-in while ensuring stability of the core extension.

Changes in this PR:

  • Feature Flag Implementation: This allows users to opt into the feature while ensuring it doesn't impact users who prefer stability over new features.
    Enable the Feature:

{    "mssql.enableExperimentalFeatures": true}
After enabling, reload VS Code. The "Data-tier Applications..." menu item will appear in Object Explorer for Server and Database nodes. And the operations for the quick lunch for Data-tier will be available also.

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
Copy Markdown
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

This PR enhances the DACPAC/BACPAC dialog functionality by implementing experimental feature gating, improving user experience with application version validation and success notifications, and updating terminology from "Deploy" to "Publish" for consistency.

  • Implements experimental feature flag to conditionally register and display DACPAC/BACPAC commands
  • Adds application version format validation (n.n.n or n.n.n.n) for Extract operations
  • Introduces success notifications with "Reveal in Explorer" actions for Extract/Export operations

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/controllers/mainController.ts Conditionally registers DACPAC commands based on experimental features flag and sets VS Code context for menu visibility
src/controllers/dacpacDialogWebviewController.ts Adds success notifications for all operations, filters system databases from listings, and updates terminology in comments
src/reactviews/pages/DacpacDialog/dacpacDialogForm.tsx Implements application version validation, reorders UI sections for better UX, and adds Learn More link
src/reactviews/pages/DacpacDialog/ApplicationInfoSection.tsx Adds validation support with error display for application version field
src/reactviews/common/locConstants.ts Updates terminology from "Deploy DACPAC" to "Publish DACPAC" and adds validation message
src/constants/locConstants.ts Adds new localized success messages and validation error message
package.json Updates menu visibility condition to include experimental features check
test/unit/mainController.test.ts Updates tests to handle conditional command registration based on experimental features
test/unit/dacpacDialogWebviewController.test.ts Updates test descriptions to use "Publish" terminology and adds stub for notification messages
localization/xliff/vscode-mssql.xlf Updates localization entries for terminology changes and new messages
localization/l10n/bundle.l10n.json Updates localization bundle with new and updated strings

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

Comment thread localization/l10n/bundle.l10n.json
Comment thread src/reactviews/pages/DacpacDialog/dacpacDialogForm.tsx
Comment thread src/constants/locConstants.ts
Comment thread localization/xliff/vscode-mssql.xlf
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 8, 2025

PR Changes

Category Target Branch PR Branch Difference
Code Coverage 59.62% 59.62% ⚪ 0.00%
VSIX Size 5233 KB 5234 KB ⚪ 1 KB ( 0% )
Webview Bundle Size 5252 KB 5252 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.64706% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.60%. Comparing base (609dc9a) to head (39ba016).

Files with missing lines Patch % Lines
src/controllers/mainController.ts 0.00% 7 Missing ⚠️
src/controllers/dacpacDialogWebviewController.ts 76.47% 4 Missing ⚠️

❌ Your patch status has failed because the patch coverage (67.64%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #20505   +/-   ##
=======================================
  Coverage   57.59%   57.60%           
=======================================
  Files         207      207           
  Lines       18798    18826   +28     
  Branches     1175     1178    +3     
=======================================
+ Hits        10827    10845   +18     
- Misses       7971     7981   +10     
Files with missing lines Coverage Δ
src/constants/locConstants.ts 83.26% <100.00%> (+0.18%) ⬆️
src/controllers/dacpacDialogWebviewController.ts 91.40% <76.47%> (-0.96%) ⬇️
src/controllers/mainController.ts 16.86% <0.00%> (-0.41%) ⬇️
🚀 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.

LocConstants.DacpacDialog.RevealInExplorer,
)
.then((selection) => {
if (selection === LocConstants.DacpacDialog.RevealInExplorer) {
Copy link
Copy Markdown
Contributor

@Benjin Benjin Nov 10, 2025

Choose a reason for hiding this comment

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

This should be "Reveal in Finder" on macOS and "Open Containing Folder" on Linux. #20511

Comment on lines +1682 to +1686
registerDacPacCommand(Constants.cmdDacpacDialog, DacPacDialogOperationType.Deploy);
registerDacPacCommand(Constants.cmdDeployDacpac, DacPacDialogOperationType.Deploy);
registerDacPacCommand(Constants.cmdExtractDacpac, DacPacDialogOperationType.Extract);
registerDacPacCommand(Constants.cmdImportBacpac, DacPacDialogOperationType.Import);
registerDacPacCommand(Constants.cmdExportBacpac, DacPacDialogOperationType.Export);
Copy link
Copy Markdown
Contributor

@Benjin Benjin Nov 10, 2025

Choose a reason for hiding this comment

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

These commands need to be added to package.json's contributes/menus/commandPalette section with:

{
    "command": "mssql.launchDacpacDialog",
    "when": "mssql.enableExperimentalFeatures"
},

As is, these still show up in the command palette, but error out because the flag being off means they aren't actually registered.

#20512

Comment thread package.json
@@ -570,7 +570,7 @@
},
{
Copy link
Copy Markdown
Contributor

@Benjin Benjin Nov 10, 2025

Choose a reason for hiding this comment

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

For follow-up: we should rename the commands so that they're grouped as a feature, e.g.:

mssql.launchDacpacDialog -> mssql.dacpacDialog.launch
mssql.deployDacpac -> mssql.dacpacDialog.deploy

#20513

Comment on lines +833 to +837
await vscode.commands.executeCommand(
"setContext",
"mssql.experimentalFeaturesEnabled",
this.isExperimentalEnabled,
);
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.

This shouldn't be necessary for boolean config options. Look in package.json for "when": "mssql.enableRichExperiences"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is needed to hide the menu option on OE

<Field
label={locConstants.dacpacDialog.applicationVersionLabel}
validationMessage={versionValidation?.message}
validationState={versionValidation?.severity === "error" ? "error" : "none"}>
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.

Why not just validationState={versionValidation?.severity}? All of versionValidation?.severity's potential values (error, warning, undefined) are valid for validationState.

Comment on lines +383 to +385
// Regex to match n.n.n.n format where n is one or more digits
// Allows 3 or 4 parts (1.0.0 or 1.0.0.0)
const versionRegex = /^\d+\.\d+\.\d+(\.\d+)?$/;
Copy link
Copy Markdown
Contributor

@Benjin Benjin Nov 10, 2025

Choose a reason for hiding this comment

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

Can you double-check this validation with @llali? At the very least, I know 1.1 is also valid (but just 1 is not, nor is 1.1.1.1.1.1.1.1.1.1.1.1)

#20514

<div className={classes.description}>{locConstants.dacpacDialog.subtitle}</div>
<div className={classes.description}>
{locConstants.dacpacDialog.subtitle}{" "}
<Link href="https://learn.microsoft.com/en-us/sql/tools/sql-database-projects/concepts/data-tier-applications/overview?view=sql-server-ver17">
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.

We should extract this to src\reactviews\common\constants.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants