Split heaviest bundler spec files for parallel execution - #9691
Merged
Merged
Conversation
This was by far the heaviest bundler spec file (~2500 example-seconds on Windows). Parallel spec runs distribute work per file, so a single huge file caps the achievable wall-clock time. Move its describe blocks verbatim into three files, keeping example count and structure unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Its before(:context) shard warning fires on every run since the file was added without a shards.rb entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Recorded per-file runtimes show outdated_spec.rb, newgem_spec.rb and update_spec.rb each exceed the ideal per-worker load of a parallel run, and setup_spec.rb dominates standalone runs, so file-based distribution cannot go faster without splitting them. Blocks move verbatim and example sets are unchanged. newgem's shared examples move together with their consumers, with its top-level helpers duplicated into both files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Bundler spec suite parallelism by splitting several “heavy” spec files into multiple smaller files (at describe boundaries) so parallel runners can distribute work more evenly. It also updates the shard mapping so the newly created spec files remain assigned to the same shards as their original files (preserving shard balance) and fixes a missing shard assignment warning.
Changes:
- Split
spec/runtime/setup_spec.rbintosetup_spec.rb+setup_gems_spec.rband register the new file in shards. - Split
spec/install/gemfile/git_spec.rbinto three files (git_spec.rb,git_overrides_spec.rb,git_extensions_spec.rb) and register new files in shards. - Split
spec/commands/outdated_spec.rb,spec/commands/update_spec.rb, andspec/commands/newgem_spec.rbinto additional companion files and register them in shards (also adding the previously-unassignedspec/bundler/plugin/unloaded_source_spec.rb).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/support/shards.rb | Registers new split spec files into the existing shard buckets and adds a missing shard assignment. |
| spec/runtime/setup_spec.rb | Removes the extracted “setup gems” examples so the remaining file is lighter for parallel runs. |
| spec/runtime/setup_gems_spec.rb | New file containing extracted Bundler.setup gem/load-path/system-gems related examples. |
| spec/install/gemfile/git_spec.rb | Removes extracted git override/extension/etc. sections so the remaining file is lighter. |
| spec/install/gemfile/git_overrides_spec.rb | New file containing the extracted local override and related git-source scenarios. |
| spec/install/gemfile/git_extensions_spec.rb | New file containing the extracted git-source extension and related scenarios. |
| spec/commands/outdated_spec.rb | Removes extracted filter/deployment/multiplatform-related scenarios into a new file. |
| spec/commands/outdated_filters_spec.rb | New file containing extracted bundle outdated filters/deployment/multiplatform scenarios. |
| spec/commands/update_spec.rb | Removes extracted scenario-heavy bundle update specs into a new file. |
| spec/commands/update_scenarios_spec.rb | New file containing extracted scenario-heavy bundle update specs. |
| spec/commands/newgem_spec.rb | Reduced by moving option-focused specs to a new companion file. |
| spec/commands/newgem_options_spec.rb | New file containing extracted option/config-matrix specs for bundle gem. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expect(out).to eq("true\ntrue") | ||
| end | ||
|
|
||
| context "with bundler is located in symlinked GEM_HOME" do |
Comment on lines
+4
to
+26
| def gem_skeleton_assertions | ||
| expect(bundled_app("#{gem_name}/#{gem_name}.gemspec")).to exist | ||
| expect(bundled_app("#{gem_name}/README.md")).to exist | ||
| expect(bundled_app("#{gem_name}/Gemfile")).to exist | ||
| expect(bundled_app("#{gem_name}/Rakefile")).to exist | ||
| expect(bundled_app("#{gem_name}/lib/#{gem_name}.rb")).to exist | ||
| expect(bundled_app("#{gem_name}/lib/#{gem_name}/version.rb")).to exist | ||
|
|
||
| expect(ignore_paths).to include("bin/") | ||
| expect(ignore_paths).to include("Gemfile") | ||
| end | ||
|
|
||
| def bundle_exec_rubocop | ||
| prepare_gemspec(bundled_app(gem_name, "#{gem_name}.gemspec")) | ||
| bundle "config set path #{rubocop_gem_path}", dir: bundled_app(gem_name) | ||
| bundle "exec rubocop --debug --config .rubocop.yml", dir: bundled_app(gem_name) | ||
| end | ||
|
|
||
| def bundle_exec_standardrb | ||
| prepare_gemspec(bundled_app(gem_name, "#{gem_name}.gemspec")) | ||
| bundle "config set path #{standard_gem_path}", dir: bundled_app(gem_name) | ||
| bundle "exec standardrb --debug", dir: bundled_app(gem_name) | ||
| 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.
Parallel spec runs distribute work per file, so a single heavy file caps the achievable wall-clock time no matter how many workers are available. Per-file runtime measurements from Windows runs of
make test-bundler-parallelshow thatspec/install/gemfile/git_spec.rbwas by far the heaviest file at about 2500 example-seconds, andspec/commands/outdated_spec.rb,spec/commands/newgem_spec.rbandspec/commands/update_spec.rbeach also exceed the ideal per-worker load of a 24-worker run.spec/runtime/setup_spec.rbdominates standalone runs of this repository, where it runs more examples than under ruby/ruby.This splits each of these files at describe block boundaries, moving blocks verbatim.
git_spec.rbbecomes three files and the others two each. Example sets are unchanged, which was verified by comparing--dry-runexample counts and full description sets before and after the split.newgem_spec.rbneeded its shared examples moved together with their consumers and its top-level helpers duplicated into both files. All new files are registered inspec/support/shards.rbunder the same shard as their original file, so shard balance is unchanged. A missing shard assignment forspec/bundler/plugin/unloaded_source_spec.rb, which warned on every run, is also fixed.With these splits the largest remaining file drops from about 2500 to about 850 example-seconds (
spec/commands/exec_spec.rb), which is below the ideal per-worker load of a 24-worker parallel run. Combined with the runtime-based grouping added in ruby/ruby#17647, this lowers the achievable wall-clock floor ofmake test-bundler-parallelto roughly the ideal per-worker load.🤖 Generated with Claude Code