Install compact_index on test_setup#9578
Merged
Merged
Conversation
The earlier `rake vendor:compact_index` hook into `dev:deps` and the
hard-copy step in ruby-core.yml fell apart in ruby/ruby's test-bundler
runner, which sets TMPDIR per process and does not invoke our rake
tasks. Pull the fetch logic into `Spec::Rubygems.install_vendored_compact_index`
and call it from `install_test_deps` so every test setup path - local
`bin/rspec`, `bin/parallel_rspec`, GHA bundler.yml, and ruby/ruby's
test-bundler - lands the files at `Path.tmp_root.join("compact_index")`
exactly where the artifice already looks. The standalone rake task and
its workflow hop are no longer needed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previously the install_vendored_compact_index short-circuit only checked whether `tmp/compact_index/lib/compact_index.rb` existed, so once any ref was vendored a subsequent `COMPACT_INDEX_REF=<sha> bin/rspec ...` kept serving the stale copy. Drop the vendor tree first when the env var is explicitly set so an override always re-fetches against the requested ref. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR moves the compact_index vendoring step out of the vendor:compact_index Rake task and into the Bundler spec test setup, so the vendored compact_index code is installed consistently across local RSpec runs, CI, and ruby/ruby’s make test-bundler-parallel (which does not invoke this repo’s Rakefile).
Changes:
- Add
install_vendored_compact_indextoSpec::Rubygems.install_test_depsso the compact_index implementation is present undertmp/compact_index/whenever specs run. - Make
COMPACT_INDEX_REF=<sha>force-refresh the vendor tree (delete then re-download) instead of reusing an existing copy. - Remove the
vendor:compact_indextask and drop it fromrake setupprerequisites.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| spec/support/rubygems_ext.rb | Installs vendored compact_index as part of test dependency setup, with optional ref override for refreshes. |
| Rakefile | Removes the standalone vendoring task and stops calling it from rake setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+88
to
+107
| if ENV["COMPACT_INDEX_REF"] | ||
| FileUtils.rm_rf(target_root) | ||
| elsif File.exist?(target_root.join("lib/compact_index.rb")) | ||
| return | ||
| end | ||
|
|
||
| require "open-uri" | ||
| ref = ENV["COMPACT_INDEX_REF"] || "7c68a7b39761c61a66f9299f85b889ec39afc02c" | ||
| %w[ | ||
| lib/compact_index.rb | ||
| lib/compact_index/dependency.rb | ||
| lib/compact_index/gem.rb | ||
| lib/compact_index/gem_version.rb | ||
| lib/compact_index/versions_file.rb | ||
| ].each do |path| | ||
| url = "https://raw.githubusercontent.com/rubygems/rubygems.org/#{ref}/#{path}" | ||
| target = target_root.join(path) | ||
| FileUtils.mkdir_p(File.dirname(target)) | ||
| File.write(target, URI.parse(url).open(&:read)) | ||
| end |
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.
What was the end-user or developer problem that led to this PR?
Move
compact_indexvendoring from thevendor:compact_indexrake task intoinstall_test_depsso it runs uniformly across local rspec, bundler.yml, and ruby/ruby'smake test-bundler-parallel, which does not invoke our `Rakefile.The follow-up makes
COMPACT_INDEX_REF=<sha>refresh the vendor tree instead of reusing the stale copy.Make sure the following tasks are checked