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.
Problems
For several months now the bot has been submitting bogus auto-epoch pull requests, about 0.7 times per day:
https://github.com/KSP-CKAN/CKAN-meta/pulls?q=is%3Apr+author%3Anetkan-bot+is%3Aunmerged+is%3Aclosed
This seems to happen completely randomly, only for GitHub krefs, as if the most recent release for that mod has disappeared. However, when we check the repo, it is still there. So somehow the wrong release is being inflated.
Cause (guesses)
We don't know for sure why this happens (it's very hard to investigate something that only happens once out of 297 unique unfrozen GitHub krefs * 2 inflations per hour * 24 hours per day / 0.7 per day = 20366 attempts), but I have two main guesses at this point:
To further the investigation of this problem, I will be attempting to rule out cause 2 here.
Changes
Now when we receive a group of releases from the API, before we choose which ones to inflate, we sort them by the
published_at
property, in descending order. If the API has returned the releases out of order, this will ensure that we will identify the most recent one correctly.If the problem stops after this, then that confirms cause 2 as the culprit. If it continues, then cause 1 looks likely.
In addition, the interpretation of the
JToken
objects returned from the API for releases is moved fromGithubApi
to a newGithubRelease
constructor, which allowsGithubApi
to deal only in properties of a release object rather than having to cast JSON tokens, etc.