Inherit Tenanted::GlobalId::Locator from UnscopedLocator - #332
Merged
Conversation
`Tenanted::GlobalId::Locator` subclassed nothing, so it inherited none of GlobalID's locator behavior. It did not implement `#model_class`, which GlobalID 1.4.0 deprecated. It did not implement `#locate_many`, which `GlobalID::Locator.fetch` requires, so Active Job on Rails edge could not deserialize GlobalID arguments. It also applied a model's `default_scope` to GlobalID lookups, unlike Rails, whose default locator resolves GlobalIDs unscoped. `Tenanted::GlobalId::Locator` will inherit from `GlobalID::Locator::UnscopedLocator`, the locator Rails installs by default, and will keep only the tenant safety check. `#locate_many` will enforce the same tenant checks as `#locate`.
There was a problem hiding this comment.
Pull request overview
Updates the tenant-aware GlobalID locator to inherit standard unscoped lookup behavior while preserving tenant safety.
Changes:
- Adds unscoped single and batch GlobalID lookup support.
- Expands unit and Active Job integration coverage.
- Updates Rails/GlobalID dependencies and changelog.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib/active_record/tenanted/global_id.rb |
Inherits unscoped locator behavior and validates batch tenants. |
test/unit/global_id_test.rb |
Tests lookup, batching, tenant errors, and default scopes. |
test/integration/test/active_job_test.rb |
Verifies wrapped tenant errors during deserialization. |
Gemfile.lock |
Updates Rails, GlobalID, and resolved dependencies. |
CHANGELOG.md |
Documents the corrected locator behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Aug 4, 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.
Tenanted::GlobalId::Locatorsubclassed nothing, so it inherited none of GlobalID's locator behavior. It did not implement#model_class, which GlobalID 1.4.0 deprecated. It did not implement#locate_many, whichGlobalID::Locator.fetchrequires, so Active Job on Rails edge could not deserialize GlobalID arguments. It also applied a model'sdefault_scopeto GlobalID lookups, unlike Rails, whose default locator resolves GlobalIDs unscoped.Tenanted::GlobalId::Locatorwill inherit fromGlobalID::Locator::UnscopedLocator, the locator Rails installs by default, and will keep only the tenant safety check.#locate_manywill enforce the same tenant checks as#locate.