Skip to content

Fix generic parallel adapter opt-out and result wait ordering - #1209

Merged
sferik merged 5 commits into
simplecov-ruby:mainfrom
kettle-dev:fix-generic-parallel-opt-out
Jun 21, 2026
Merged

sferik merged 5 commits into
simplecov-ruby:mainfrom
kettle-dev:fix-generic-parallel-opt-out

Conversation

@pboling

@pboling pboling commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two parallel coordination issues found while using SimpleCov with an env-var-only parallel runner:

  • SimpleCov.parallel_tests false now disables the generic TEST_ENV_NUMBER adapter as well as the parallel_tests gem adapter.
  • The current worker's result is stored before waiting for sibling resultsets, so the final worker no longer times out at N-1 of N before producing a complete merged report.

Closes #1208.

Why

The generic adapter honors the same TEST_ENV_NUMBER / PARALLEL_TEST_GROUPS environment shape as several parallel runners. If a project opts out with SimpleCov.parallel_tests false, SimpleCov should not re-enter parallel coordination through the generic adapter.

For result merging, the previous ordering waited for all expected resultset entries before storing the final worker's own result. That made PARALLEL_TEST_GROUPS impossible to satisfy in the final worker until after the wait had already timed out.

Test

SIMPLECOV_NO_DOGFOOD=1 bundle exec rspec spec/simplecov_spec.rb spec/parallel_adapters_spec.rb

Copilot AI review requested due to automatic review settings June 21, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes two parallel coordination edge cases in SimpleCov: (1) ensuring SimpleCov.parallel_tests false truly opts out of env-var-driven parallel coordination, and (2) fixing result merge ordering so the reporting worker’s own result is counted before waiting for siblings.

Changes:

  • Store the current worker’s result before waiting for other workers, avoiding N-1 of N wait timeouts in the reporting process.
  • Make the generic TEST_ENV_NUMBER parallel adapter respect SimpleCov.parallel_tests false.
  • Add regression specs covering the new wait/store ordering and the generic adapter opt-out behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spec/simplecov_spec.rb Adds a spec asserting store → wait → merge call ordering during result merging.
spec/parallel_adapters_spec.rb Adds a spec ensuring GenericAdapter is inactive when SimpleCov.parallel_tests is explicitly false.
lib/simplecov/result_processing.rb Reorders store vs wait to include the reporting worker’s result before polling for siblings.
lib/simplecov/parallel_adapters/generic.rb Prevents GenericAdapter from activating when parallel coordination is opted out.
CHANGELOG.md Documents the behavior changes for adapter opt-out and merge ordering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md Resolved

This comment was marked as duplicate.

@sferik
sferik merged commit e06a888 into simplecov-ruby:main Jun 21, 2026
10 checks passed
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.

Parallel coordination opt-out and final worker wait ordering issues

3 participants