Skip to content

DataContext attribute tracking#5446

Draft
knstvk wants to merge 10 commits into
masterfrom
data-context-attribute-tracking
Draft

DataContext attribute tracking#5446
knstvk wants to merge 10 commits into
masterfrom
data-context-attribute-tracking

Conversation

@knstvk

@knstvk knstvk commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@knstvk knstvk changed the title data-context-attribute-tracking DataContext attribute tracking Jul 12, 2026
knstvk added 8 commits July 17, 2026 09:58
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant