Switch to local env var cache, remove broken (now unused) InMemoryInterpreterSpecificCache#15098
Merged
Merged
Conversation
Member
Author
|
Odd. Will look; seems to be the with-VSC tests. |
Member
Author
|
Not sure why those broke, but the tests didn't seem to be adding all of the services they need. Gross tests that don't explicitly create things... |
Codecov Report
@@ Coverage Diff @@
## main #15098 +/- ##
======================================
- Coverage 65% 65% -1%
======================================
Files 557 557
Lines 26220 26182 -38
Branches 3729 3721 -8
======================================
- Hits 17061 17032 -29
+ Misses 8463 8460 -3
+ Partials 696 690 -6
|
Member
Author
|
@karrtikr The PR's been updated, if you wanted to take a look again. |
kimadeline
approved these changes
Jan 7, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #3805
The
InMemoryInterpreterSpecificCachewas unfortunately fatally flawed; its cache key calculation was done globally (behaved differently in tests which let the bug go unnoticed) and returned different results seemingly randomly based on which part of the workspace you queried (undefined resource versus folder versus file).The environment provider is the only user of this cache class, and to clear the caches it used a clear function that operated on the global cache; however, the previously mentioned inconsistency meant that it wouldn't actually clear everything out of the cache, as a single environment file could affect multiple cache entries.
We still want to be able to cache things, so instead use the (actually functional)
InMemoryCachewithin the environment variable provider, and clear the caches when an environment file changes.I've added a test for modifying the environment file, and also realized that the tests always returned a shared envfile object, meaning changing the faked file would always appear to have worked; explicit copies are added to work around this.
The new test would still pass on the old code, however, as there was no good way to actually force the cache to behave as it does at runtime; the old cache code bypassed any interfaces to go to the vscode API directly.
The now-unused
InMemoryInterpreterSpecificCacheand its tests have been removed (and a little cruft from it cleaned up).Appropriate comments and documentation strings in the code.Has sufficient logging.Has telemetry for enhancements.Test plan is updated as appropriate.package-lock.jsonhas been regenerated by runningnpm install(if dependencies have changed).The wiki is updated with any design decisions/details.