Fix Collection View import and export resolution - #871
Conversation
…mport-export-fix-for-0.10.0 # Conflicts: # l10n/bundle.l10n.json
There was a problem hiding this comment.
Pull request overview
Fixes Collection View import/export when the originating collection comes from synthetic/hierarchical tree nodes by improving tree-node resolution across Connections/Quick Start and aligning Atlas Discovery IDs with the existing stable-suffix convention.
Changes:
- Replace “throw on unresolved collection node” with a modal error + Output Channel logging for Collection View import/export.
- Introduce ownership-aware Connections View
clusterId → treeIdresolution (Quick Start synthetic instances vs persisted Clusters storage). - Align Atlas Discovery cluster IDs and tree leaf IDs via a shared stable-suffix builder, with updated tests and l10n bundle updates.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/webviews/documentdb/collectionView/collectionViewRouter.ts | Adds modal + output logging when import/export cannot resolve a collection tree node. |
| src/tree/connections-view/resolveConnectionsClusterTreeId.ts | New resolver for stable cluster IDs to current Connections View tree paths, aware of Quick Start synthetic ownership. |
| src/tree/connections-view/resolveConnectionsClusterTreeId.test.ts | Unit tests covering Quick Start vs stored-connection resolution behavior. |
| src/tree/connections-view/LocalQuickStart/revealQuickStartInstance.ts | Refactors Quick Start reveal navigation to use centralized tree identity builders. |
| src/tree/connections-view/LocalQuickStart/revealQuickStartInstance.test.ts | Updates tests to assert new identity builders match the tree’s IDs. |
| src/tree/connections-view/LocalQuickStart/quickStartTreeIdentity.ts | New Quick Start tree identity helpers + stable ID ownership checks. |
| src/tree/connections-view/LocalQuickStart/quickStartTreeIdentity.test.ts | Tests Quick Start tree ID building and stable clusterId → treeId resolution. |
| src/tree/connections-view/LocalQuickStart/LocalQuickStartItem.ts | Uses centralized Quick Start tree ID builders for root and instance rows. |
| src/tree/connections-view/ConnectionsBranchDataProvider.ts | Routes cluster/collection lookup through the new ownership-aware treeId resolver. |
| src/plugins/service-atlas-mongodb/models/AtlasClusterModel.ts | Extracts Atlas stable suffix builder and uses it for provider-prefixed cluster IDs. |
| src/plugins/service-atlas-mongodb/models/AtlasClusterModel.test.ts | Adds assertions for stable suffix usage in the Atlas cluster ID. |
| src/plugins/service-atlas-mongodb/discovery-tree/atlasTree.test.ts | Updates list-mode expectations for Atlas clusterId and treeId. |
| src/plugins/service-atlas-mongodb/discovery-tree/AtlasServiceRootItem.ts | Switches Atlas cluster leaf tree IDs to use the shared stable suffix convention. |
| src/plugins/service-atlas-mongodb/discovery-tree/AtlasProjectItem.ts | Switches project cluster leaf tree IDs to use the shared stable suffix convention. |
| src/plugins/service-atlas-mongodb/discovery-tree/AtlasProjectItem.test.ts | Updates mocks/expectations to assert stable suffix leaf IDs. |
| l10n/bundle.l10n.json | Adds localized strings for the new Collection View failure modal + output log text. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/webviews/documentdb/collectionView/collectionViewRouter.ts:196
- The user-facing strings here interpolate the raw operation value ('import' | 'export') into localized messages. Since 'import'/'export' are not localized, this can produce partially-English UI in non-English locales. Prefer fully localized messages (e.g., separate l10n keys for import vs export) or map to localized operation labels before interpolating.
async function reportCollectionNodeResolutionFailure(
operation: 'import' | 'export',
{ clusterId, viewId, databaseName, collectionName }: RouterContext,
): Promise<void> {
const showOutput = l10n.t('Show Output');
ext.outputChannel.error(
l10n.t(
'Collection View {0} failed because the collection tree node could not be resolved. View ID: {1}; Cluster ID: {2}; Database: {3}; Collection: {4}',
operation,
viewId,
clusterId,
databaseName,
collectionName,
),
);
const choice = await vscode.window.showErrorMessage(
l10n.t('Failed to {0} documents.', operation),
{
modal: true,
detail: l10n.t('Select "{0}" to see error details.', showOutput),
},
showOutput,
src/tree/connections-view/LocalQuickStart/LocalQuickStartItem.ts:299
- Use the shared Quick Start tree-id builder here as well, so the CredentialsMissing row stays consistent if the Quick Start tree layout ever changes. Right now this duplicates the '/instance' suffix logic instead of reusing buildQuickStartInstanceTreeId().
createGenericElementWithContext({
id: `${this.id}/instance`,
contextValue: createContextValue([INSTANCE_CONTEXT, 'state_needsAttention']),
label: l10n.t('DocumentDB Local'),
description: l10n.t('Needs attention · review setup'),
…nd tree data providers
✅ Code Quality Checks
This comment is updated automatically on each push. |
📦 Build Size Report
Download artifact · updated automatically on each push. |
Summary
Fix Collection View import and export resolution across Atlas Discovery and the managed DocumentDB Local Quick Start instance, while making resolution failures and credential-recovery states safer for users.
Collection View failure handling
Atlas Discovery identity
DocumentDB Local Quick Start identity
Credential-recovery UX
Validation
npm run l10nnpm run prettier-fixnpm run lintnpm run buildPackaging/VSIX generation was not run.
Follow-up
clusterIdlookup.