Conversation
`published` asked rubygems.org whether this version is already out and rescued OpenURI::HTTPError to false. The comment says 404, and 404 does mean the gem has never been published -- but the rescue caught every HTTP error. A 500, a 429, or anything else from rubygems.org read as "not published", which is the one answer that makes release:push go ahead and push. That inverts the check. It exists so a re-run is a no-op, and the case it is least able to handle is the case where it cannot tell. Failing the release is the right answer there: the version is still sitting in the gemspec and the workflow can be run again. Only 404 returns false now; everything else propagates. The lookup gets explicit open and read timeouts instead of inheriting none, and the response is checked for being the array it is parsed as -- .any? over an unexpected Hash would have raised NoMethodError from inside a lambda with no context. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
publishedasks rubygems.org whether this version is already out, and rescuedOpenURI::HTTPErrortofalse. The comment says 404, and 404 does mean the gem has never been published — but the rescue caught every HTTP error. A 500, a 429, or anything else from rubygems.org read as "not published", which is the one answer that makesrelease:pushgo ahead and push.That inverts the check. It exists so a re-run is a no-op, and the case it's least able to handle is the case where it cannot tell. Failing the release is the right answer there: the version is still sitting in the gemspec and the workflow can be run again.
The fix
Only 404 returns
false; everything else propagates. The lookup gets explicit open and read timeouts instead of inheriting none, and the response is checked for being the array it's parsed as —.any?over an unexpected Hash would have raisedNoMethodErrorfrom inside a lambda with no context.Verified against the real API: a never-published name returns
false,ruby_decision_model 0.1.0returnstrue,9.9.9returnsfalse, and a 503 now raises where it used to read asfalse.Draft: part of a security and API-coverage audit, opened for reference rather than as a request for immediate review. Independent of the other branches, each off
main. Suite green on Ruby 3.2.11, 3.3.8 and 3.4.8.🤖 Generated with Claude Code