microsoft / microsoft/vscode-documentdb

Use stable clusterId matching for Discovery View cache lookups

Open
#869 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

Discovery View currently resolves cached cluster nodes by removing the discovery-provider prefix from clusterId and returning the first cached tree node whose ID ends with the remaining suffix.

This works only when every discovery provider preserves that exact suffix as the final component of its treeId. It also leaves a theoretical collision risk because the suffix search spans the whole Discovery View cache rather than matching the provider-prefixed stable identity.

Current behavior

DiscoveryBranchDataProvider.findClusterNodeByClusterId():

  1. Splits clusterId at the first _.
  2. Builds /<unprefixedClusterId>.
  3. Calls the global cached-node suffix lookup.
  4. Returns the first match without verifying the node's stable clusterId.

The immediate Atlas compatibility issue is being handled separately by aligning Atlas cluster tree leaves with the existing stable-suffix convention.

Proposed future work

Investigate replacing or augmenting suffix lookup with an exact stable-identity lookup:

  • Search only cluster tree elements.
  • Compare node.cluster.clusterId with the complete requested clusterId.
  • Alternatively, scope suffix lookup to discoveryView/<providerId>/ and verify the matched cluster identity.
  • Preserve the current cache-lifetime behavior; do not force expansion of every discovery provider.

Benefits

  • Avoid cross-provider suffix collisions.
  • Decouple stable resource identity from visual tree hierarchy.
  • Allow discovery providers to evolve tree/list layouts without duplicating the stable suffix in the leaf ID.
  • Better enforce the existing dual-ID contract: clusterId for identity and caches, treeId for tree position.

Acceptance criteria

  • Cached clusters resolve by complete stable identity or by a provider-scoped, identity-verified lookup.
  • Azure, Kubernetes, and Atlas Discovery layouts continue to resolve collections.
  • Duplicate suffixes in different discovery-provider subtrees cannot resolve to the wrong cluster.
  • Uncached-cluster behavior remains explicit and does not trigger broad provider expansion.

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.

Research direction

Start in DiscoveryBranchDataProvider.findClusterNodeByClusterId() and trace the global cached-node suffix lookup and cluster tree elements it searches. Compare the requested complete clusterId with cached node.cluster.clusterId, while preserving cache lifetime and uncached behavior. Done means Azure, Kubernetes, and Atlas layouts resolve correctly without cross-provider suffix collisions or broad provider expansion.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
databases, frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.