-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Migrate Perl validation checks into netkan.exe #2788
Migrate Perl validation checks into netkan.exe #2788
Conversation
This is awesome! The validation scripts were born before NetKAN and when CKAN-meta was routinely submitted to directly and not via NetKAN. In theory we could use NetKAN as the validator, ie |
77ecd95
to
2153070
Compare
I thought we discussed in #2027 that we didn't want to use Json.NET Schema because of the license:
|
Of course there's always a license problem if I forget to check it. 😬 |
e0d3519
to
d02cd40
Compare
Added tests for each validator. |
dd09b3b
to
1766c3c
Compare
What about this test (have either |
Good catch! I missed that one. Will add... |
Isn't there a download property available in AVC .version files? Do we parse them? Or are they just used as general links like |
See #2517; that's handled by putting the AVC URL in a |
1766c3c
to
111396f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now.
I did a few test runs, in which everything worked.
I didn't really review all the unit tests, but they pass, so let's hope they pass out of the right reasons.
Well that's fun: @techman83, if you have a chance, could you please upload the bot's |
More or less confirmed, the modules that failed with that error all have a KSP version min of 1.5.1 or later, while the ones that succeeded all include 1.4.1 or earlier. So the bot has a cached copy of builds.json from approximately October 2018. |
Ok I uploaded the Gist here. But you're likely quite right. |
Yup, it goes up to 1.4.5. So that's from between KSP-CKAN/CKAN-meta@686ef27 (Jul 28, 2018) and KSP-CKAN/CKAN-meta@9947336 (Oct 15, 2018). |
Good detective work 🙂 |
One thing I just discovered:
But not in other validators. |
The mods CKAN/Netkan/Validators/ObeysCKANSchemaValidator.cs Lines 21 to 31 in b3da232
Line 23 is failing exactly, put a log statement before and one after and there you go. Edit: I see we are passing a |
|
Here's the complete stack trace (which you can view by changing
So yes, it's a bug in NJsonSchema (or Newtonsoft). RicoSuter/NJsonSchema#568 mentions problems with BigInts, but I don't think we have that here. |
I take that back. Looking for commonalities among HyperEdit, Graphotron, and Kethane, they are 3 of the 5 CKAN/Netkan/Transformers/HttpTransformer.cs Lines 28 to 34 in 1ac6261
Line 263 in 1ac6261
Presumably this confuses NJsonSchema. So it's our fault and easy to fix. |
Could've needed that before ;) I've put the json output of --debug runs irght before the error throws into this gist (concatenated as another json file, for easier handling/formatting). |
Oh common, you were like 2 seconds faster :D |
Motivation
The pull request validation scripts apply a bunch of validation to .netkan and .ckan files that aren't implemented anywhere else.
https://github.com/KSP-CKAN/xKAN-meta_testing/blob/7b875488601288bdc59520b5d7ff59b6f9d1c75a/NetKAN/t/metadata.t
This can come as a surprise if a mod author prepares a netkan and tests it with netkan.exe, only to find that there were several problems with it. This is especially common with licenses and spec versions.
Specific checks
Netkans (before processing):
Ckans (after processing):
Changes
Netkan.exe already has a validation framework, but there aren't many checks.
Now all of the above are added. This will allow mod authors to find out about problems before they submit pull requests. In time, we may be able to retire the Perl checks, which would simplify the pull request scripts.
Each validator is exercised by a small suite of tests.
For the schema check:
CKAN.schema
is now an embedded resource in netkan.exeNewtonsoft.Json
only supports v3 syntax whileCKAN.schema
is v4, butNJsonSchema
supports v4, so that reference is added (can't use theNewtonsoft.Json.Schema
assembly because it would require CKAN's license to change)