Schema Compare: surface platform badges and affected constraints in UI#22340
Schema Compare: surface platform badges and affected constraints in UI#22340roramsay wants to merge 2 commits into
Conversation
For Feature 1847587 -- Schema Compare for Fabric Warehouse. Complements the
DacFx-side fix (PR 2143938) that cascades exclusion to hierarchical-child
constraints, and the sqltoolsservice contract addition of
SourcePlatform / TargetPlatform on SchemaCompareResult.
Two additive UX surfaces in the Schema Compare webview, both gated on the
relevant data being populated (no behaviour change for older sqltoolsservice
builds that omit the new fields):
1. Platform badges under source / target inputs (SelectSchemasPanel.tsx).
When the comparison result has populated sourcePlatform / targetPlatform
(the DacFx SqlServerVersion short name such as SqlDwUnified, Sql160,
SqlAzure), render a small outline Badge below each endpoint input
showing the dialect Schema Compare is using. Lets the user confirm at a
glance that a Fabric Warehouse endpoint is actually being treated as
Fabric.
2. Affected-constraints banner above the diff editor (CompareDiffEditor.tsx).
When the selected diff entry has hierarchical-child constraint diffs
(PK / FK / UNIQUE / CHECK / DEFAULT), render a one-line summary above
the script viewer for each SchemaUpdateAction:
Constraints added: [dbo].[PK_Customers], [dbo].[UQ_Customers_Email]
Constraints changed: ...
Constraints dropped: ...
Filtered to constraint object types so column-change children (which are
already part of the parent table's CREATE / ALTER script) are not listed
here. Reads source name first then falls back to target name so Drop-only
diffs still produce a label. Wrapped in an aria-label-decorated region
for screen-reader accessibility.
Typings (vscode-mssql.d.ts):
- Add sourcePlatform?: string and targetPlatform?: string to
SchemaCompareResult. JSDoc fixed -- the previous draft comment claimed the
field carried the full DSP class name; the actual sqltoolsservice
implementation returns the DacFx SqlServerVersion enum short name.
Localisation:
- All new display strings go through locConstants.schemaCompare with
parameterised l10n.t calls and translator-facing comments (per
extensions/mssql/src/webviews/AGENTS.md).
Build / lint:
- npm run build:extension:typecheck -- 0 errors
- webviews tsgo -- 0 errors
- npm run lint (mssql workspace) -- 0 errors / 0 warnings
Unit tests for the two new render branches are not added in this commit:
there are no existing component-level webview tests for SelectSchemasPanel
or CompareDiffEditor to extend, and the additive conditional renders are
well-covered by the typecheck + lint pipeline. Component-test scaffolding is
tracked as a follow-up.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@microsoft-github-policy-service agree company="Microsoft" |
… (Feature 1847587) Implements the three webview-level tests from the Schema Compare for Fabric Warehouse spec (Feature 1847587) test design. Extracts CompareDiffEditor.tsx's local helpers into a new compareDiffEditorUtils.ts module so the spec's three webview cases can be covered as pure-function unit tests without spinning up a React render harness for the component itself: isConstraintObjectType, formatChildName, groupConstraintChildrenByAction, getAggregatedScript, and the CONSTRAINT_OBJECT_TYPE_SUFFIXES list. CompareDiffEditor.tsx now consumes those helpers via named import; behaviour is unchanged. New test suite (compareDiffEditorUtils.test.ts) covers the three cases called out in the spec plus broader edge coverage: - compare diff editor filters DiffEntry.Children by constraint object-type suffix (PK / FK / UNIQUE / CHECK / DEFAULT); column-change and index children are dropped so they do not double-count in the banner; substring vs endsWith guard. - compare diff editor renders matched constraint children grouped by SchemaUpdateAction (Add / Change / Delete) for the Constraints added / changed / dropped banner, with source-name -> target-name -> child.name fallback for Drop-only diffs. - compare diff editor aggregated script walks DiffEntry.Children and includes constraint ALTER scripts under the parent table in the right order so the Monaco diff editor shows the full picture after the sqltoolsservice CreateDiffEntry SqlDwUnified carve-out preserves them. Also covers defensive paths: null / undefined diff, empty children, missing scripts, and getSourceScript=false (target pane). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Added the three webview-level test scenarios from the spec (Feature 1847587 §Test design) in commit 1d4898c: Extracted New test suite (
Plus defensive paths: Local run: all suites green; mssql Linked sqltoolsservice PR with the contract + unit + integration tests: microsoft/sqltoolsservice#2722. |
One commit on this branch ships the vscode-mssql webview changes for Schema
Compare on Microsoft Fabric Warehouse (Feature 1847587):
fd214e94a— surface platform badges (consumes the new SourcePlatform /TargetPlatform fields on the Schema Compare response) and render an
"affected constraints" banner above the diff editor (client-side filter
on the existing
DiffEntry.Childrenarray, matching DacFx full typenames ending in
PrimaryKeyConstraint/ForeignKeyConstraint/UniqueConstraint/CheckConstraint/DefaultConstraint).Localization strings are committed in extensions/mssql/l10n/bundle.l10n.json
and localization/xliff/vscode-mssql.xlf.
Depends on the companion sqltoolsservice PR (microsoft/sqltoolsservice#2722)
for the platform pill data. The constraint banner works against today''s STS
(DiffEntry.Children already populates correctly for Fabric
SqlPrimaryKeyConstraint diffs).
Spec: https://dev.azure.com/powerbi/Trident/_git/specs-dw/pullrequest/989687