Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't prompt user to choose conflicting modules #3434

Merged
merged 1 commit into from Sep 27, 2021

Conversation

HebaruSan
Copy link
Member

Problem

A module that tries to filter an option out of the "Too many mods provide" prompt with a conflict just ends up complaining to the user after the fact:

depends:
  - name: CustomBarnKit
conflicts:
  - name: CustomBarnKit-RO
$ ckan compat add 1.7
$ ckan install Komplexity
Module CustomBarnKit is provided by more than one available module. Please choose one of the following:
1) CustomBarnKit-RO (Custom Barn Kit - RO build)
2) CustomBarnKit (Custom Barn Kit)
Enter a number between 1 and 2 (To cancel press "c" or "n".): 
1
The following inconsistencies were found:
* CustomBarnKit-RO 1.1.20.0 conflicts with Komplexity 0.9.3.0
Install canceled. Your files have been returned to their initial state.

Noticed while investigating KSP-CKAN/NetKAN#8656.

Cause

The relationship resolver relies on AvailableModule.Latest to generate the modules for the user prompt, which filters modules with AvailableModule.DependsAndConflictsOK, which only checks conflicts unidirectionally.

Changes

Now AvailableModule.DependsAndConflictsOK checks conflicts bidirectionally, so choices that the installing modules conflict with will be filtered out before (or without) prompting:

$ ckan compat add 1.7
$ ckan install Komplexity
About to install:

 * Komplexity 0.9.3.0 (cached)
 * Module Manager 4.2.1 (cached)
 * Custom Barn Kit 1.1.21.0 (cached)
 * Kerbal Changelog v1.4.2 (cached)

Continue? [Y/n]

Concerns

This will probably pre-empt the "{conflicting_mod} conflicts with {candidate}" message in other cases, which might be confusing. I need help identifying those cases so I can figure out how to address them. Are there other situations where a mod might depend on its own conflict?

@HebaruSan HebaruSan added Bug Core (ckan.dll) Issues affecting the core part of CKAN Pull request Relationships Issues affecting depends, recommends, etc. labels Aug 10, 2021
@DasSkelett
Copy link
Member

This will probably pre-empt the "{conflicting_mod} conflicts with {candidate}" message in other cases, which might be confusing. I need help identifying those cases so I can figure out how to address them. Are there other situations where a mod might depend on its own conflict?

I can't come up with a situation where this would make problems, and testing with some mods with more complex relationships (Scatterer with its self-conflicts, RP-1 Express Install) worked fine.

So if this introduces a bug in the resolver, at least it won't hit too hard 😅

Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes do make sense in theory, let's see if they withstand in practice 🤞

@HebaruSan HebaruSan merged commit 83aad88 into KSP-CKAN:master Sep 27, 2021
@HebaruSan HebaruSan deleted the fix/conflict-prompt branch September 27, 2021 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Core (ckan.dll) Issues affecting the core part of CKAN Pull request Relationships Issues affecting depends, recommends, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants