microsoft / microsoft/vscode-documentdb
Revisit: SchemaStore monotonic accumulation can surface stale fields after external schema changes
Nobody has claimed this yet.
- 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
- Add a "Clear Schema Cache" command that targets a single cluster, database, or collection (the global one already exists).
- Invalidate schema entries for a collection when its underlying
ClustersClient.dropCollectionsucceeds (already partially handled viadeleteClient, but not fordropCollectionalone). - Track sample document
_idvalues 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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