Fixing Providers cache#7357
Merged
Merged
Conversation
Providers.from_config_files() stores the result of
`get_dataset_root("")` and delivers the previous resut, if not called
with `reload` and the dataset root is the same.
However, what effectively is stored when CWD is a dataset's root is the
empty string - so, effectively `.`. But this would be the same for any
dataset root we are in, therefore this lazy loading would not recognize,
that the dataset changed. This lead to side-effects of the order of test
execution, when a test provided new config files. Those files would be
ignored, when providers were read from within a different dataset
before.
Hence, use the absolute path to store and compare.
Closes datalad#7347
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## maint #7357 +/- ##
==========================================
- Coverage 88.74% 88.55% -0.20%
==========================================
Files 327 327
Lines 44629 44630 +1
Branches 5913 0 -5913
==========================================
- Hits 39605 39520 -85
- Misses 5009 5110 +101
+ Partials 15 0 -15
... and 23 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
yarikoptic
approved these changes
Mar 28, 2023
Member
yarikoptic
left a comment
There was a problem hiding this comment.
looks LGTM and passes tests for me locally
Thank you @bpoldrack for getting to the bottom of it!!!
Collaborator
|
PR released in |
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.
I have no idea how it only now blew up, but the lazy loading of
Providers.from_config_filesis broken (probably since forever). That is, because it relies onget_dataset_root("")to detect whether the same config files would effectively be read. Not only does this ignore the fact that new/modified files could have appeared in the meantime, but more importantly, this is nonsense, because the stored root would always be""whenever PWD is in a dataset's root. Meaning, if we switch into another dataset, the result is the same, hence no config is actually read.Therefore, use the absolute path as the stored value to check against.
Closes #7347