Repository navigation
Fix Active Record connection checkout in keyset pagination - #931
Merged
Merged
Conversation
Owner
|
Thank you! |
ddnexus
pushed a commit
that referenced
this pull request
Oct 18, 2026
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.
The shared Active Record adapter for Keyset and Keynav calls
Relation#connectionwhile quoting SQL identifiers. This raises whenActiveRecord.permanent_connection_checkout = :disallowed, emits deprecation warnings with:deprecated, and can retain a checked-out connection beyond the quoting operation.Use the relation model's
connection_pool.with_connectionto scope that work. A connection borrowed here is returned to its pool, while an existing caller-owned lease is preserved. Regression tests cover both cases, and the shared Active Record test setup now disallows deprecated permanent checkouts so the entire API suite checks for them.Audited the gem, example apps, tests, scripts and tasks using text search and a Prism call scan. This was the only deprecated connection checkout found; fixing the shared adapter covers both Keyset and Keynav.
Validation
ActiveRecord::Base.connectionerror.bundle exec thor test:api:coverage: 608 current-API tests and 597 next-API tests pass; combined line and branch coverage remain 100%.bundle exec thor test:e2e:apps: 19 tests pass.bundle exec rubocop: 208 files, no offenses.Tested with Ruby 4.0.7 and the locked Active Record 8.1.4 dependencies.