Check the index's sha256 and the gemspec's body in the release wait

Merged
RO
12d ago
+41-19

The release wait could pass on metadata gem install and Bundler would refuse. This closes the two gaps a review found:

  • The index's sha256. /info's line for the version names the gem's sha256, and Bundler refuses a download that differs. The wait only checked that the line was there. It now requires the index's sha256 to equal the API's, and so the downloaded gem's. It reads /info again while the two disagree.
  • The quick gemspec's body. A 200 with an empty or corrupt gemspec counted as present. The file now has to inflate to something.

A read that finds nothing new no longer clears what the last one found, so a timeout still names the sha256 the index gave.

Checks: I ran the step's own script, parsed out of the YAML, under bash -e -o pipefail:

CaseResult
RubyGems, re-run of a published versionpasses
RubyGems, pushed, same gempasses
RubyGems, pushed, a different gemfails at once
RubyGems, never publishedtimes out, saying what's missing
Mock, everything consistentpasses
Mock, index names another sha256times out, naming it
Mock, index line without a checksumtimes out
Mock, empty gemspectimes out
Mock, gemspec that isn't zlibtimes out
Mock, index heals after 18 secondspasses

actionlint and zizmor report nothing. The same change goes to basecamp-sdk and fizzy-sdk; the two scripts differ only in the gem's name.

Card: Ruby SDK release workflow fails after a successful gem push


Summary by cubic

Fixes the release wait passing in cases where metadata gem install and Bundler would refuse, closing two gaps a review found.

  • Requires the sha256 in /info's line for the version to match the API's and the downloaded gem's, rereading /info while they disagree.
  • An unchanged /info body skips the repeated /versions check, so a slow mid-wait fix still meets the deadline.
  • Requires the quick gemspec to load with RubyGems' safe loader as this gem at this version, not merely a 200 that inflates.
  • A failed fetch leaves the last readings in place, so a timeout still names the sha256 the index gave.