Add tests for partitioned multi-tenant child queries#4161
Closed
erdtsieck wants to merge 1 commit intoJasperFx:masterfrom
Closed
Add tests for partitioned multi-tenant child queries#4161erdtsieck wants to merge 1 commit intoJasperFx:masterfrom
erdtsieck wants to merge 1 commit intoJasperFx:masterfrom
Conversation
Add tests to verify querying within nested/child collections is correctly scoped per tenant when using partitioning. Updates in: - src/CoreTests/Partitioning/partitioning_configuration.cs: add Marten using and new test cannot_query_within_child_collections_across_partition_tenants which seeds targets with nested objects in two tenants and asserts queries return only tenant-specific results. - src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy_with_partitioning.cs: add several usings (Collections.Generic, Diagnostics, Marten.Linq), initialize nested objects for test fixtures, and add cannot_query_within_child_collections_across_tenants with similar assertions. These tests ensure child-collection Any() queries are correctly limited to the active tenant/partition.
jeremydmiller
added a commit
that referenced
this pull request
Mar 8, 2026
…tables DocumentMapping.TenancyStyle was only synced to QueryMembers.TenancyStyle once during the constructor, before builder alterations ran. When tenancy was configured via Schema.For<T>().MultiTenantedWithPartitioning(), the builder set TenancyStyle after construction, so QueryMembers kept the default Single value. This caused SubQueryFilter to skip adding the tenant_id filter to the outer query, allowing ctid collisions across partitions to return rows from other tenants. Fix: make DocumentMapping.TenancyStyle setter always sync to QueryMembers.TenancyStyle. Add regression tests for both hash and list partitioning. Closes GH-4161. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Add tests to verify querying within nested/child collections is correctly scoped per tenant when using partitioning. Updates in:
These tests ensure child-collection Any() queries are correctly limited to the active tenant/partition.