You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Session updates the current model incrementally from a commit diff #447
I have verified that I am running the latest version of the SysML2.NET
I have searched open and closed issues to ensure it has not already been reported
Description
Depends on #446 . When GetModel moves to another commit of the same project — typically a branch head that advanced — the session reloads every element of the new commit, although usually only a few changed.
Proposal
When the target commit belongs to the project of CurrentCommit, call DiffAsync(projectId, CurrentCommit.commitId, targetCommitId) and apply the DataDifference records (API & Services §7.2.3 diff) to the current Assembler, in this order:
Synchronize the compareData.Payload of every difference that has a compareData (added or modified elements). This also evicts the top of every deleted subtree, since its owner is modified and drops it from OwnedRelationship / OwnedRelatedElement.
Assembler.Cache.TryRemove(id) for every difference whose compareData is empty. This evicts what Synchronize cannot reach: descendants of a deleted subtree and deleted root namespaces. Running it after step 1 avoids spurious "could not be found in the cache" warnings.
CurrentCommit then moves to the target commit. Fall back to a full reload when the diff fails or the project differs. No change to IAssembler is needed.
Tasks
Diff-based path in Session.GetModel, with full-reload fallback
Tests: added, modified and removed elements are reflected in the POCO cache after a head move; deleting a subtree leaves no orphaned descendant in the cache; a deleted root namespace is evicted; the result equals a full reload of the target commit; a different project triggers a full reload
Steps to Reproduce
Not applicable — feature request.
System Configuration
SysML2.NET version: 0.26.0 (SysML2.NET.REST)
Environment (Operating system, version and so on): any
.NET Framework version: netstandard2.1, net10.0
Additional information: Systems Modeling API & Services 1.0 REST/HTTP PSM
Activity