Repository navigation
fix: an included member of a value object in a 5.x snapshot is read as its property's column - #273
Merged
Merged
Conversation
…s its property's column 5.x resolved an entry of IncludeProperties by the walk it had for a key, which goes one step past a converted property: "Email.Value" was the column of Email. The readers of 5.x's indexes told a path from a column's name with a walk that did not, and refused the snapshot. On a snapshot's property the member is now taken as it is, as the resolver takes it there; the entry is handed on as the path, and the resolver says which column it is. Both readers build through ComplexIndexes5xIndexes.Build, so the index of an entity type and the index of a property had the one refusal and have the one fix. Refs #263 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…pshot is read Refs #263 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Owner
Author
|
Reviewed at 68de442 by the coordinating session.
Nothing to change. |
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.
Closes #263
Problem
A 5.x snapshot whose index includes a member of a value object was refused:
5.x resolved an entry of
IncludeProperties(…)by the walk it had for a key (ResolveIncludeList→ResolveProperty→FindConvertedMember, read atv5.6.0), which goes one step past a converted property: the index in the database carries the column ofEmail. The same path as a key or in a filter was read already, through the resolver. The reader told an included path from a column's name with a walk of its own, which did not take that step.The index of a property (
CustomIndex:IsIndexedwithNpgsql:IndexIncludebeside it) had the same refusal: both readers build throughComplexIndexes5xIndexes.Build.Change
ComplexIndexes5xIndexes.IncludedPathtakes an entry one step past a property as a path where the declaring type is a property bag and the property an indexer property. That is the resolver's rule for a snapshot (PropertyPaths.Walk) and 5.x's own. The entry is handed on as it stands, and the resolver says which column it is, as for a key.Email.Value.Length), a step past a property that is not there, a step past a complex property (Address.Value), and a member on a type that has its CLR type.CHANGELOG.mdhas the line under a new### Fixedofpreview.3;CLAUDE.mdsays the rule where it describes the index readers. The guide says nothing this makes false and is unchanged.One answer changes for an input the reader took before: an entry that is one step past a snapshot's property and the literal name of another property's column (a column named
Email.Value) is the path now, where it was that column. 5.x's snapshot side read it as the path from 5.3.0.Read from 5.x's tags: before 5.1.0 an included entry was a column's name as written, and before 5.2.0 no walk went past a property, so
Email.Valuefailed when the migration was applied. No version built such an index over another column thanEmail's, so the entry is read alike whatever the snapshot's rendering version.Tests
No server is needed.
dotnet testwith--filter "TestCategory!=Integration": PostgreSQL 489 passed, kernel 897 passed.New, each run with the reader as on
main(source restored with a new timestamp and rebuilt):An_included_entry_one_step_past_a_snapshots_property_is_that_propertys_column(ComplexIndexes5xIndexReaderTests): the entry is read, the create hasINCLUDE ("Email"), also below a complex property; four entries stay refusedAn_included_member_declared_as_the_property_is_no_operations(LegacyValueObjectHandoverTests): the snapshot againstinclude: [x => x.Email], Up and DownAn_included_member_on_an_index_of_a_property_is_the_property_too: the same for the marker on a property, with its drop and createWhat_is_declared_instead_creates_what_5x_declared, new row: dropped byIX_members_Kind, created asCREATE INDEX "IX_members_Kind" ON members ("Kind") INCLUDE ("Email");The_lambda_through_the_member_is_refused_and_the_refusal_says_what_to_write, new row:include: [x => x.Email.Value]in the model gets the resolver's refusal with what to writeWhat stays refused, each condition taken out in turn:
i == segments.Length - 2, the reader's row fails:Email.Value.Lengthis read;What_an_index_declaration_cannot_say_is_refused_by_namefails:Email.Lengthon a type with its CLR type is read. Either alone still passes: a property bag's properties are indexer properties. Both are there because the resolver and 5.x state both.The snapshot is written in the test in 5.x's form, not scaffolded by 5.x: no fixture has a value object. The
MemberofLegacyValueObjectHandoverTestsgained a complex propertyAddress.City, in the model and in the snapshot, since 5.x put its marker on a property of a complex type alone; the tests that were there pass unchanged.migration-safety-review, sections 2 and 6: no stored form moves (a declaration read from a snapshot is never stored, andPgIndexDeclarationTestspasses), the resolver is untouched so there is no new epoch, and the annotation is read in the same models as before.🤖 Generated with Claude Code