DataContext attribute tracking#5446
Draft
knstvk wants to merge 11 commits into
Draft
Conversation
On a root non-fresh merge of a fuller copy onto a pre-existing managed instance, the copy loops read isLoaded from a stale CachingLoadedPropertiesInfo and skipped newly available values; the end-of-merge reset then made those attributes report loaded while holding null, so save wrote null over real database values. Reset the destination's loaded-state cache before the copy loops (resetLoadedInfoBeforeCopy in mergeState) so copy decisions recompute from the unioned fetch group and apply the values. Remove mergeFromChild's now-redundant manual pre-merge reset. Add two DataContextMergeTest regressions.
#4907) mergeFromChild now marks the merged composition child's owner chain in a dedicated compositionModifiedOwners set, consulted by isModified so the reopen gate keeps the in-context instance instead of reloading a stale copy. Owners are kept out of modifiedInstances, so they are not persisted and the composition-save contract holds. Fixes #4907 half (ii).
…arrower merge Generalize the increment-03 cold reset to the fresh path: widen isColdResetTarget from `isRoot && !isFresh` to `(isRoot || isFresh)` so a fresh merge onto a pre-existing caching instance recomputes loaded-state from the unioned fetch group instead of copying the narrower source's cache. A genuinely fetched attribute the narrower source omits no longer reverts to unloaded. Safe because mergeFetchGroups always unions, never narrows. Fuzz I2 83->0, I1 held at 0.
…d injected edits (#4071, #1258) Replace the disableListeners boolean with a mergeDepth counter, a recorded mergeApplied set of the merge's own (entity, attribute) writes, and a deferred ChangeEvent queue flushed when the outermost merge unwinds. - #4071: a property edit merged into an already-managed instance now fires a ChangeEvent (before: the whole merge ran suppressed). - #1258: a change fired during a merge that the merge did not apply is a listener-injected user edit and is now tracked, not dropped. Clear mergeApplied before the flush so a throwing flush listener cannot leak stale entries into the next merge. Pinned by four DataContextMergePolicyTest cases; fuzz gate a pure no-regression net.
…ntext identity map
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.
No description provided.