Warnings for missing swinfo.json deps#3827
Merged
Merged
Conversation
Member
Author
|
Self-reviewing so I can get a sense of what's out there in the already indexed mods... ... nothing, apparently! |
Member
Author
|
This worked, but we didn't catch the message (eventually addressed in KSP-CKAN/KSP2-NetKAN#44): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
See KSP-CKAN/KSP2-NetKAN#33, a dependency was missing from a KSP2 module. This dependency was documented (only) in the
swinfo.jsonfile, and the netkan didn't have it.This could easily happen again with other mods, either when initially adding them or as new versions are released.
Cause
The inflator parses the
swinfo.jsonfile but ignores itsdependenciesproperty. I thought about automatically importing it intoCkanModule.depends, but that would have trapped us if:swinfo.jsonwas wrongChanges
Now when we inflate a module with a
swinfo.jsonfile, if it hasdependencieslisted, we'll check them and log a warning for any identifier that isn't in theCkanModule.dependslist. It's a warning instead of an error so a human can decide what to do.For now, min/max versions are ignored. From what I've seen, these tend to be filled in unnecessarily with non-useful data, so it would be a lot of noise / alert-fatigue to see these all if we logged them.
This way we will get a notification in Discord if a KSP2 module adds a new dependency and documents it in the
swinfo.jsonfile, or in the GitHub Action output in a pull request.Considered and not done
In principle, this code belongs in a
Validatorfile/class.In practice, I started that and it got really messy. I had to duplicate essentially all of the logic of the
Transformerclass, including retrieving the file from the ZIP and checking the remote copy. The last straw was when I had to add anIGithubApiobject toCkanValidator, which really does not belong there.Since I was ending up with an extended copy of the
Transformerclass, I thought it would be cleaner to extend the original. We can look into adding some sort of shared retrieval and caching forswinfo.jsondata in the future and revisit this then.This means these warnings will only fire for
.netkanfiles, not for validating.ckanfiles. I think that's fine for now.