Fix bugs related to losing index URL information when clearing finder cache #2305
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.
Rather than rebuilding the package finder, which seems to have a number of unexpected and undesirable side-effects, implement a safe way to clear the cache on a package finder.
A new regression test for #2220 validates the fix, demonstrating that we preserve the
--extra-index-urlprovided viarequirements.in.This also fixes #2294 , for similar reasons.
This change was also manually tested on the reproducers from #2220 and #2294, where it has the correct effect.
The originating work where this bug was introduced comes from #2176, which was fixed in #2178 (and incorporated in #2195).
We were aware at the time that it wasn't clear what side-effects rebuilding the finder might have, but I considered it safe.
It has since turned out (#2220 and #2294) that we lose important information in the process -- we could reconstitute that information but this approach seems simpler.
Importantly, the new test would catch any future regression in this behavior.
Contributor checklist
changelog.d/(seechangelog.d/README.mdfor instructions) or the PR text says "no changelog needed".Maintainer checklist
bot:chronographer:skiplabel.