Fix already contains module error at upgrade #3660
Merged
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.
Problem
After #3643, upgrades are broken in the dev builds:
KSP-Recall
Reported on Discord by @TwiceDaIce, who was not able to submit an issue at the time.
Cause
The exception indicates that the list of modules passed to the resolver contained a duplicate. This was supposed to be prevented by the way
FindRemovableAutoInstalled
's parameter is constructed, butmodules_to_remove
doesn't contain the installed version (as I assumed it would by its name since that version would be removed). This duplicate would always have been there for upgrades, but prior to #3643 it didn't matter because we weren't passing the modules to a resolver.Tried and failed
I tried adding the installed module to
modules_to_remove
, and this broke switching from one module version to another. There are too many uses of these variables and too many implicit assumptions about how they behave for me to sort it out that way.Changes
Now a new
InstalledAfterChanges
function generates exactly the list of modules that I want, without duplicates, so upgrading and switching versions both work.