You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**What's the problem this PR addresses?**
We now keep the package metadata in cache. To avoid missing new packages
being released we have a check so that we only accept the cached
metadata if 1/ the request asks for a semver version (not a range), and
2/ the requested version is found inside the cached metadata. In theory
this means that whenever a dependency asks for a version we didn't
cache, we assume something new got published, and we refetch it.
However, to prevent fetching the package metadata many times for many
different versions or ranges, we also have an in-memory metadata cache
where we store the cached metadata once we extracted them from either
the disk or the network.
This may lead to memory cache corruption issues when two versions from
the same package are resolved if one exists in the cached metadata but
the other doesn't. In that case, the first package will pass the check
for "is this version inside the cached metadata", get stored in the
in-memory cache, and be reused for further resolutions (even if those
resolutions would have failed this check). This is because the disk
cache and the memory cache are the same.
Fixes#5989
**How did you fix it?**
I separated the in-memory cache into two buckets: the disk cache, and
the network cache. This ensures that the disk cache gets properly
ignored when retrieving versions we don't know, rather than be
mistakenly assumed to be what the network fetched.
**Checklist**
<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [x] I have set the packages that need to be released for my changes to
be effective.
<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
0 commit comments