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
Sort GitHub releases #3571
Sort GitHub releases #3571
Conversation
Oof, good point, I didn't make that connection when that error came up. My only idea for cause 1 so far, since we can't prevent it or detect it, is to switch to the GraphQL API in the hopes that the bug is specific to the old API. Hopefully it doesn't come to that. 🤞 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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.
Let's give it a try 🤞
Cause 1 confirmed: KSP-CKAN/CKAN-meta#2686 |
If we tried this, would we be able to test it before going live? It seems like we would have to run it at least 20k times to detect it if the same bug was still present. Hmm, the |
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.