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

Refactor relationship resolver to capture full resolved tree #4232

Merged
merged 5 commits into from
Oct 17, 2024

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Oct 17, 2024

Problems

If you use ckan install -c modpack.ckan to install a modpack with incompatible dependencies, the message is something like:

Module installed-Auto-KSP 2024.05.15.01.03.25 required but it is not listed in the 
index, or not available for your version of KSP
If you're lucky, you can do a `ckan update` and try again.
Try `ckan install --no-recommends` to skip installation of recommended modules.
Or `ckan install --allow-incompatible` to ignore module compatibility.

This does not explain the problem, can only report one problem with one mod, and almost all of the advice at the bottom is useless. A similar poor message can also appear in GUI if the user force-selects a mod with incompatible dependencies on the Versions tab.

Causes

When the relationship resolver checks dependencies recursively to make sure a mod can be installed, it loses the information from the "leaf nodes" and just reports the outermost mod that can't be resolved.

Changes

  • Now the relationship resolver generates a tree of resolved relationships and queries it so the error message for incompatible modpack dependencies can report every mod that isn't compatible, the full chain of dependencies to it starting from the module given on the command line, and the game version compatibility range of each missing dependency:
    Unsatisfied dependency B9PartSwitch (KSP 1.0.5-1.12.3) needed for: BluedogDB v1.13.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59); CryoTanks 1.6.6 (needed for BluedogDB-Methalox v1.13.0, needed for CommunityLifeBoat 2024.09.05.11.08.59); CryoEngines 1:2.0.7 (needed for CommunityLifeBoat 2024.09.05.11.08.59); FarFutureTechnologies 1.3.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59); SpaceDust 0.5.4 (needed for FarFutureTechnologies 1.3.0, needed for CommunityLifeBoat 2024.09.05.11.08.59); HabTech2 1.0.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59); HabTechRobotics v1.0.1 (needed for HabTech2 1.0.0, needed for CommunityLifeBoat 2024.09.05.11.08.59); HeatControl 0.6.2 (needed for CommunityLifeBoat 2024.09.05.11.08.59); KerbalAtomics 1:1.3.4 (needed for CommunityLifeBoat 2024.09.05.11.08.59); Mk2Expansion 2:1.9.1.4 (needed for CommunityLifeBoat 2024.09.05.11.08.59); Mk3Expansion 1.6.1.4 (needed for CommunityLifeBoat 2024.09.05.11.08.59); ModularLaunchPads 2.7.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59); NearFutureAeronautics 2.1.2 (needed for CommunityLifeBoat 2024.09.05.11.08.59); NearFutureElectrical 1.2.3 (needed for CommunityLifeBoat 2024.09.05.11.08.59); NearFutureExploration 1.1.3 (needed for CommunityLifeBoat 2024.09.05.11.08.59); NearFutureLaunchVehicles 2.2.1 (needed for CommunityLifeBoat 2024.09.05.11.08.59); NearFuturePropulsion 1.3.6 (needed for CommunityLifeBoat 2024.09.05.11.08.59); NearFutureSolar 1.3.3 (needed for CommunityLifeBoat 2024.09.05.11.08.59); NearFutureSpacecraft 1.4.5 (needed for CommunityLifeBoat 2024.09.05.11.08.59); OmicronFlyingSpaceCar 0.6.6.6 (needed for CommunityLifeBoat 2024.09.05.11.08.59); PlanetsideExplorationTechnologies 1.0.2 (needed for CommunityLifeBoat 2024.09.05.11.08.59); RaginCaucasian 1.5.3.1 (needed for CommunityLifeBoat 2024.09.05.11.08.59); RocketMotorMenagerie v1.1.2 (needed for CommunityLifeBoat 2024.09.05.11.08.59); ShuttleOrbiterConstructionKit 1.1.8 (needed for CommunityLifeBoat 2024.09.05.11.08.59); ShuttlePayloadDeliverySystems 3.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59); SillyPhotonDrives 1.0.1 (needed for CommunityLifeBoat 2024.09.05.11.08.59); StationPartsExpansionRedux 2.0.11 (needed for CommunityLifeBoat 2024.09.05.11.08.59); StockWaterfallEffects 0.8.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59); WaterfallExtensions 0.4.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59); Wyvern-5 0.5 (needed for CommunityLifeBoat 2024.09.05.11.08.59)
    
    Unsatisfied dependency SimpleAdjustableFairings (KSP 1.2.2-1.11.2) needed for: BluedogDB v1.13.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59); TantaresSAF v3.0 (needed for CommunityLifeBoat 2024.09.05.11.08.59)
    
    Unsatisfied dependency AdditionToTantaresSP 0.2 (KSP 1.12.4) needed for: CommunityLifeBoat 2024.09.05.11.08.59
    
    • A new test is created to exercise the incompatible dependencies scenario
  • Now the error footer might actually be helpful, since it suggests using ckan compat instead of --no-recommends, better explains what "lucky" means for ckan update, and notes that --allow-incompatible doesn't apply to dependencies:
    You can use the `ckan compat` commands to change which game versions are treated as compatible.
    If a newly compatible version was just released, you can do a `ckan update` and try again.
    Or `ckan install --allow-incompatible` to ignore compatibility of the modules on the command line (but not dependencies).
    

Fixes #4108.

Side fixes

While working on the above, I tossed in a few opportunistic fixes:

  • The user can get redundant prompts for play modes when installing some of the Wild Blue mods, which can be answered in a way that creates conflicts in the changeset. Now the relationship resolver's new tree logic doesn't present conflicting play modes as options.
    • A new test is created to exercise this scenario, which passes with the new code and fails with the old
  • Several methods of Registry and related classes are refactored to use ICollection instead of IEnumerable or specific collection types, which allows us to eliminate repeated calls to .ToHashSet(), .ToList(), etc. to improve performance.
  • The Untagged search in GUI wasn't working because it was generating a ModSearch object with no tag names rather than the empty string. Now it works.
  • The Show in folder button in Unmanaged Files wasn't working because it was trying to open relative paths instead of absolute. Now it gets the absolute path and works.
  • RelationshipResolverOptions and SelectionReason are moved to their own files.

@HebaruSan HebaruSan added Bug Something is not working as intended Enhancement New features or functionality GUI Issues affecting the interactive GUI Cmdline Issues affecting the command line Core (ckan.dll) Issues affecting the core part of CKAN Tests Issues affecting the internal tests Relationships Issues affecting depends, recommends, etc. Performance Something's slower than it should be labels Oct 17, 2024
@HebaruSan HebaruSan merged commit 653d085 into KSP-CKAN:master Oct 17, 2024
3 checks passed
@HebaruSan HebaruSan deleted the fix/cmdline-incompat-msg branch October 17, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Cmdline Issues affecting the command line Core (ckan.dll) Issues affecting the core part of CKAN Enhancement New features or functionality GUI Issues affecting the interactive GUI Performance Something's slower than it should be Relationships Issues affecting depends, recommends, etc. Tests Issues affecting the internal tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CmdLine: Installing from a .ckan file that depends on incompatible mods produces an unhelpful error message
1 participant