microsoft / microsoft/vscode-documentdb

Decouple Collection View actions from Discovery tree cache lifetime

Open
#868 0 comments 0 reactions 1 assignee View on GitHub

@tnaum-ms is already working on this.

Since Aug 6, 2026.

Dominant language
TypeScript
Stars
31
Forks
22
Avg merge
2d 20h
Merged PRs (30d)
21

Description

Problem

Collection View import and export resolve the open collection by locating its CollectionItem in the Discovery View tree cache. This makes a Collection View action depend on the corresponding discovery tree node still existing in the current cached tree.

The lookup starts from a stable clusterId, finds a cached cluster node, then builds and traverses the collection path from that node. It does not rehydrate an unexpanded Discovery hierarchy.

This is a future-work follow-up to #861.

Kubernetes list and tree view switch

Kubernetes supports two renderings beneath a context:

  • Tree view: source -> context -> namespace -> cluster
  • List view: source -> context -> cluster, with namespace shown in the cluster description

Changing the mode performs a whole Discovery View refresh. That clears the parent and node cache. The same cluster retains a stable clusterId and terminal tree-ID suffix, so lookup works again once its path has been expanded in the newly selected layout.

However, an already-open Collection View can no longer resolve the collection immediately after the switch, because the new tree hierarchy has not yet been recreated and cached. Import and export can therefore fail until the user expands the relevant source, context, and cluster again.

Atlas impact

Atlas is also shipping a list and tree presentation. Its tree cache will be invalidated by equivalent full-tree refreshes, creating the same Collection View cache-lifetime dependency. Atlas additionally needs its stable clusterId to remain resolvable to the rendered cluster node in both modes.

Desired outcome

Collection View actions must not require the target collection to be present in the Discovery tree cache. They should resolve or construct the required operation context from stable identifiers and connection/session state, rather than from a cached CollectionItem.

The replacement design should:

  1. Support Connections, Azure Resources, Atlas, and Kubernetes discovery sources.
  2. Work before a discovery hierarchy has been expanded and after a full Discovery View refresh.
  3. Preserve import/export progress, telemetry, command correlation, and error handling.
  4. Keep the tree node optional, limited to tree-specific presentation only if needed.
  5. Define a stable provider contract for resolving a collection from clusterId, database name, and collection name without relying on cached tree IDs.

Acceptance criteria

  • Collection View import and both export actions work after switching Kubernetes between list and tree mode, without re-expanding the discovery hierarchy.
  • The same actions work for Atlas in either presentation mode and after a full Discovery View refresh.
  • The actions work when the Collection View was opened from a discovery provider but the corresponding cluster node is absent from the cache.
  • Focused tests cover the cache-miss path and both Kubernetes layouts.
  • Focused tests cover the Atlas layout(s) and stable clusterId resolution.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.