RUBY-3824 Restore conditional skip logic in transactions spec runner#3033
Merged
comandeo-mongo merged 2 commits intomongodb:masterfrom Apr 29, 2026
Merged
Conversation
A rubocop autocorrect in commit 8db6431 flattened the original guarded skips into bare `skip` calls inside a single before(:all) block, so every transactions and transactions_api example was unconditionally pending with "Requirements not satisfied" (or "No reason given") regardless of topology or other requirements. Restore the original behavior: skip on `test.skip_reason` only when one is set, skip on unmet requirements only when `req.satisfied?` is false. Receive `req` from the block instead of `_req`.
Contributor
There was a problem hiding this comment.
Pull request overview
Restores correct conditional skipping behavior in the transactions spec runner so that transaction spec tests execute when applicable instead of always being marked pending.
Changes:
- Reintroduces conditional guard for
test.skip_reasonbefore callingskip. - Reintroduces conditional guard for spec
reqsatisfaction before skipping due to unmet requirements. - Restores use of the
reqargument yielded bydefine_spec_tests_with_requirements.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The transactions runner triggers Session#unpin twice for the same network error on the bulk_write code path: once from the unpin_maybe handler in Operation::Executable#do_execute, and again from the unpin_maybe handler in BulkWrite#execute_operation wrapping the same OpMsg execution. The second call tried to check the connection back into the pool that had already received it, raising "Trying to check in a connection which is not currently checked out by this pool". This regression had been hidden since the rubocop autocorrect on the runner (commit 8db6431) skipped all transactions tests; it surfaced as soon as PR 3033 re-enabled them on sharded clusters. Guard Session#unpin to return early when there is no pinned state. The single-document path is unaffected (only one unpin_maybe layer there).
jamis
approved these changes
Apr 28, 2026
Contributor
jamis
left a comment
There was a problem hiding this comment.
Great catch! I was afraid something like this might slip through the cracks, after I discovered that the supposedly "safe" Rubocop autocorrect mode (-a) is not actually guaranteed to be safe. Thanks for fixing this. 👍
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.
A rubocop autocorrect in commit
8db64312b
("Enable rubocop on all files, with exceptions" — #3005) flattened
the original
if test.skip_reasonandunless req.satisfied?guardsin
spec/runners/transactions.rbinto bareskipcalls inside asingle
before(:all)block:Effect: every
transactions_spec.rbandtransactions_api_spec.rbexample reports as
PENDINGregardless of topology or actualrequirements. The transactions spec test suite has not run locally on
master since that commit (2026-03-27).
The fix restores the conditional checks and passes
reqthrough tothe block (it was renamed to
_reqbecause it had become unused afterthe regression).
Test plan
Against a local 3-node replica set (
replicaSet=replset):bundle exec rspec spec/spec_tests/transactions_spec.rb— 1809 examples, 0 failures, 965 pending (sharded-only). Before: all pending.bundle exec rspec spec/spec_tests/transactions_api_spec.rb— 370 examples, 0 failures, 185 pending (sharded-only). Before: all pending.bundle exec rubocop spec/runners/transactions.rb— clean