Fix AnyTenant() with child collection Any() in separate Where clauses (GH-4146)#4150
Merged
jeremydmiller merged 1 commit intomasterfrom Feb 24, 2026
Merged
Fix AnyTenant() with child collection Any() in separate Where clauses (GH-4146)#4150jeremydmiller merged 1 commit intomasterfrom
jeremydmiller merged 1 commit intomasterfrom
Conversation
When AnyTenant() was in a separate .Where() clause from a child collection .Any() query, SubQueryFilter.Apply() still hardcoded a tenant_id filter based on the builder's TenantId. Added BypassTenantFilter flag to SubQueryFilter, set during compileAnySubQueries when AnyTenant() is detected among the top-level filters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 25, 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.
Summary
AnyTenant()in a separate.Where()clause from a child collection.Any()query was still filtering bytenant_idSubQueryFilter.Apply()hardcoded atenant_idfilter based onbuilder.TenantId, regardless of whetherAnyTenant()was specifiedBypassTenantFilterflag toSubQueryFilter, set duringcompileAnySubQuerieswhenAnyTenant()is detected among the top-level filtersTest plan
any_tenant_with_child_collection_any_in_separate_where_clausesverifies SQL does not containtenant_idBug_1884_multi_tenancy_and_Any_querystill pass🤖 Generated with Claude Code