Skip to content

[Feature]: Session updates the current model incrementally from a commit diff #447

Open

Description

@antoineatsoprasteria

What type of issue is this?

  • Bug report
  • Feature request

Prerequisites

  • I have written a descriptive issue title
  • 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:

  1. 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.
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions