microsoft / microsoft/vscode-documentdb

Revisit: SchemaStore monotonic accumulation can surface stale fields after external schema changes

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

Nobody has claimed this yet.

enhancement needs-triage P3
Dominant language
TypeScript
Stars
31
Forks
22
Avg merge
2d 20h
Merged PRs (30d)
21

Description

Context

ClusterSession.resetCachesIfQueryChanged intentionally no longer wipes accumulated schema data when the user changes the query in the Collection View. Schema data lives in the shared SchemaStore and is accumulated monotonically per (clusterId, databaseName, collectionName).

The trade off is documented in code: preserving field knowledge from earlier queries helps autocompletion when a new query returns zero documents. The risk is that if the collection schema changes externally (drop and recreate, large refactor), completion suggestions will surface fields that no longer exist.

Suggested solutions

  1. Add a "Clear Schema Cache" command that targets a single cluster, database, or collection (the global one already exists).
  2. Invalidate schema entries for a collection when its underlying ClustersClient.dropCollection succeeds (already partially handled via deleteClient, but not for dropCollection alone).
  3. Track sample document _id values and detect a large turnover as a heuristic to age out old field entries.

Definition of done

  • A user who recreates a collection externally has a clear, in-product path to refresh schema knowledge.

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 by reading ClusterSession.resetCachesIfQueryChanged and the SchemaStore accumulation behavior. Trace the existing global schema-cache clear command, ClustersClient.dropCollection, and deleteClient to compare current invalidation paths. Done means a user who recreates a collection externally has a clear in-product way to refresh its schema knowledge.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
databases, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.