Skip to content

Run specs in parallel, speed up CI, fix concurrency bugs in specs and code - #1167

Closed
apiology wants to merge 1635 commits into
castwide:v0.59from
apiology:parallel_rspec
Closed

Run specs in parallel, speed up CI, fix concurrency bugs in specs and code#1167
apiology wants to merge 1635 commits into
castwide:v0.59from
apiology:parallel_rspec

Conversation

@apiology

@apiology apiology commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

This allows rspec to use more than one CPU. Really useful on modern dev machines, and also useful in CI, where the default runner size has two CPUs.

See https://github.com/apiology/solargraph/pull/27/changes for a more useful diff and commentary

To do:

  • Track down slow tests and see where time is going
  • Track down rspec + rails specs slowness
  • Add developer doc on things to expect, how to write specs
  • Fix logging caching gems
  • Figure out where doc_map vs workspace fix went

Reduces the actual testing time in CI to about a minute using our small workers:

image

There are also a few fixes here:

  • For some reason, the debug level logging I tried to set in rspec wasn't persisting - this seems to do a better job and found a couple of bugs in the process that only reproduce at debug level logging.
  • Some tests didn't run individually, but did when run in sequence in the specs. We may see new failures pop up in the future; the trade-off for faster responsiveness is probably going to be less deterministic behavior in the face of buggy tests.

Includes for mergability:

Includes this build fix:

Includes the fix for this bug, which parallel running seems to trigger (more often?):

Includes to show combined effect:

Includes transitively:

  • v0.59 branch

@apiology
apiology marked this pull request as draft January 29, 2026 13:26
@apiology
apiology changed the base branch from master to v0.59 January 29, 2026 14:13
# Conflicts:
#	.github/workflows/plugins.yml
#	lib/solargraph/doc_map.rb
#	lib/solargraph/pin_cache.rb
#	lib/solargraph/position.rb
#	lib/solargraph/shell.rb
#	lib/solargraph/source/chain.rb
#	lib/solargraph/version.rb
#	lib/solargraph/workspace.rb
#	spec/doc_map_spec.rb
#	spec/pin_cache_spec.rb
#	spec/shell_spec.rb
#	spec/yard_map/mapper_spec.rb
#	spec/yardoc_spec.rb
- shell.rb: gems 'core' called PinCache.core?/cache_core, which have
  never existed; dead code inherited from master, first exercised by
  this PR's own new CI step (solargraph gems core stdlib). Use the
  real, working Solargraph::RbsMap::CoreMap#pins API instead.
- Fix 15 whole-repo RuboCop offenses (YARD/CollectionStyle,
  Style/GlobalStdStream, Style/Lambda, Style/StringConcatenation,
  Layout/MultilineOperationIndentation, RSpec/EmptyHook) and extend
  .rubocop_todo.yml's RSpec/BeforeAfterAll exclusions for two
  pre-existing before(:context) specs, matching the project's own
  auto-gen-config convention.
- Update shell_spec.rb's mocked-Workspace test to stub
  Solargraph::Workspace.new instead of ApiMap#workspace, matching the
  gems command's actual (master-derived) implementation.
Bundler::LazySpecification#materialize_for_installation is an
undocumented internal API (no changelog entry) whose arity changed
without a deprecation path via an internal refactor (rubygems/rubygems
"Pass locked platforms to materialization instead of mutating
candidates", 2026-06-15). Newer Bundler requires a locked_platforms
argument on the raw method and only exposes a safe default via the
materialized_for_installation wrapper; older Bundler has neither the
wrapper nor the argument.

The existing respond_to?(:materialize_for_installation) guard only
checked existence, not arity, so a bare &:materialize_for_installation
call raised ArgumentError on newer Bundler/RubyGems (surfaced on the
ruby-head CI matrix entry once the earlier gems-core crash was fixed).

Extract materialize_specs_for_installation, preferring the modern
wrapper when present, falling back to the old method only when its
arity is actually zero, and skipping materialization (rather than
raising) for any other/future shape. Apply the same check to the
external-bundle subprocess command string, which hits the same API.
@apiology

Copy link
Copy Markdown
Contributor Author

Superseded by apiology#44, which carries this work forward rebased on top of #1237.

@apiology apiology closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant