Tests: broaden #4602 coverage across all four storage selectors#4604
Merged
Conversation
PR #4603 fixed the QueryOnly ordinal mismatch and shipped a 5-test repro covering the headline case (tenant-mapped projection document). The bug envelope is meaningfully wider: - NOT projection-target-specific. UseNumericRevisions / UseOptimisticConcurrency turned on directly on a non-projection mapping (e.g. via o.Schema.For<T>().UseNumericRevisions(true)) hits the same descriptor state and the same crash. - NOT tenant_id-specific. Any after-version metadata member mapped via .Metadata(m => m.X.MapTo(...)) shifts the QueryOnly ordinals: last_modified, created_at, correlation_id, causation_id, last_modified_by. - Affects hierarchical mappings too. doc_type sits before the version binder so it reads correctly, but the version → tenant_id shift still trips QueryOnly (error bound becomes "0 and 2" instead of "0 and 1" because the SELECT is one column wider). Adds 5 probes covering this envelope, each parameterized across all four selectors (QueryOnly, Lightweight, IdentityMap, DirtyTracking) for a 20-test matrix. The QueryOnly case in each probe is the regression proof; the Lightweight / IdentityMap / DirtyTracking cases are canaries — those selectors were never broken (their SELECTs include mt_version for the write-back path), so they pin the fix scope. A future refactor that accidentally trimmed ReadBinders itself (instead of just QueryOnlyReadBinders) would crash all 15 non-QueryOnly cases immediately. Verified on master: - Bare master: 5/20 fail (exactly the 5 QueryOnly cases) - After #4603: 20/20 pass Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Jun 3, 2026
Merged
This was referenced Jun 11, 2026
This was referenced Jun 15, 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.
Follow-up to #4603, which fixed the QueryOnly ordinal mismatch and shipped a 5-test repro covering the headline case (tenant-mapped projection document). The bug envelope is meaningfully wider than that framing suggests, and the fix scope deserves a structural lock.
What this adds
Five probes covering the full bug envelope, each parameterized across all four storage selectors (
QueryOnly,Lightweight,IdentityMap,DirtyTracking) for a 20-test matrix insrc/EventSourcingTests/Bugs/Bug_4602_query_versioned_with_mapped_metadata.cs.Probes (5)
UseNumericRevisions(true)+ mappedtenant_ido.Schema.For<T>().UseNumericRevisions(true)hits the same crash.UseOptimisticConcurrency(true)+ mappedtenant_idVersionColumnbranch lines 70-81). If a fix only addresses the numeric path, this stays broken.LastModified(no tenancy)tenant_id-specific. Any after-version mapped member shifts QueryOnly.UseNumericRevisions(true)+ mappedCorrelationIdtenant_iddoc_typesits before the version binder so it reads correctly, but the version → tenant_id shift still trips QueryOnly. Error bound becomes"0 and 2"because the SELECT is one column wider.Selector matrix (× 4)
Each probe runs against
QueryOnly,Lightweight,IdentityMap, andDirtyTrackingsessions:mt_versionfor the write-back path even without a member), so they stayed green on master. They pin the fix scope: a future refactor that accidentally trimmedReadBindersitself (instead of justQueryOnlyReadBinders) would crash all 15 non-QueryOnly cases immediately.Verification
8921251682(post-#4603)Re-ran the closed-shape regression bands as a sanity check:
CoreTestsclosed_shape_*— 82/82 passDocumentDbTestsConcurrency+Metadata+Version— 168/168 passWhy this lives in a separate file
Bug_4602_query_tenant_mapped_projection_document.cs(from #4603) is the public-facing bug repro and stays untouched. This file documents the broader envelope and is the structural canary; keeping them separate makes the issue's reproduction obvious and lets this matrix evolve independently if more after-version metadata column types get added later.🤖 Generated with Claude Code