Skip to content

Fix Collection View import and export resolution - #871

Merged
Tomasz Naumowicz (tnaum-ms) merged 7 commits into
release/0.10.0from
dev/tnaum/import-export-fix-for-0.10.0
Aug 7, 2026
Merged

Fix Collection View import and export resolution#871
Tomasz Naumowicz (tnaum-ms) merged 7 commits into
release/0.10.0from
dev/tnaum/import-export-fix-for-0.10.0

Conversation

@tnaum-ms

@tnaum-ms Tomasz Naumowicz (tnaum-ms) commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

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

  • Catch collection tree-node resolution failures in the extension-host router instead of surfacing an unhandled tRPC client error.
  • Log sanitized resolution context to the DocumentDB output channel.
  • Show a modal failure message with a Show Output action so users can inspect diagnostics.

Atlas Discovery identity

  • Introduce one Atlas stable-suffix builder based on project ID and cluster name.
  • Use that suffix as the final cluster tree-ID segment in both organization/project tree mode and flat list mode.
  • Preserve visible organization/project hierarchy and cluster labels while matching the existing Discovery lookup convention.
  • Add focused model, tree-mode, and list-mode identity coverage.

DocumentDB Local Quick Start identity

  • Centralize Quick Start root/instance tree identity in the Quick Start feature.
  • Resolve the managed instance by exact feature ownership before falling back to persisted Connections storage.
  • Keep ordinary persisted connection lookup isolated from Quick Start resolver failures.
  • Reuse the same tree-ID builders for rendering, reveal navigation, cluster lookup, and collection lookup.
  • Add focused ownership, fallback, unavailable-instance, and tree-path tests.

Credential-recovery UX

  • Replace the destructive Credentials missing · click to delete tree action with Needs attention · review setup.
  • Route the warning row into Quick Start instead of directly invoking Delete.
  • Remove Delete from that warning row's context menu.
  • Explain in Configure why starting fresh is required, confirm that nothing has changed yet, and state exactly what will be deleted.
  • Label the guarded destructive action Start fresh.

Validation

  • npm run l10n
  • npm run prettier-fix
  • npm run lint
  • Focused Atlas and Quick Start Jest suites
  • Full Jest suite: 210 suites, 3,406 tests
  • npm run build

Packaging/VSIX generation was not run.

Follow-up

Copilot AI lite review requested due to automatic review settings August 7, 2026 07:35
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) requested a review from a team as a code owner August 7, 2026 07:35

Copilot AI left a comment

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.

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 → treeId resolution (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.

Comment thread l10n/bundle.l10n.json Outdated
Comment thread src/webviews/documentdb/collectionView/collectionViewRouter.ts Outdated
Comment thread src/webviews/documentdb/collectionView/collectionViewRouter.ts

Copilot AI left a comment

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.

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'),

@tnaum-ms
Tomasz Naumowicz (tnaum-ms) merged commit 3243b2e into release/0.10.0 Aug 7, 2026
3 checks passed
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) deleted the dev/tnaum/import-export-fix-for-0.10.0 branch August 7, 2026 08:53
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

✅ Code Quality Checks

Check Status How to fix
Localization (l10n) ✅ Passed
ESLint ✅ Passed
Prettier formatting ✅ Passed

This comment is updated automatically on each push.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📦 Build Size Report

Metric Base (release/0.10.0) PR Delta
VSIX (vscode-documentdb-0.10.0-bug-bash-2.vsix) 8.01 MB 8.14 MB ⬆️ +136 KB (+1.7%)
Webview bundle (views.js) 5.88 MB 6.11 MB ⬆️ +231 KB (+3.8%)

Download artifact · updated automatically on each push.

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Collection View import and export toolbar actions do not work

2 participants