Skip to content

[2528] Export successions with an implicit target inline - #2532

Open
HuiJun wants to merge 1 commit into
eclipse-syson:mainfrom
Open-MBEE:fix/succession-implicit-target
Open

HuiJun wants to merge 1 commit into
eclipse-syson:mainfrom
Open-MBEE:fix/succession-implicit-target

Conversation

@HuiJun

@HuiJun HuiJun commented Sep 22, 2026 •

Copy link
Copy Markdown

Symptom

A succession written with the then shorthand and an implicit target (the next body member) is exported as a dangling then; followed by the target on its own line, which is invalid SysML v2:

// reference
action a1;
then decide;
// exported
action a1;
then;
decide ;

This is #2528 (Batmobile template export); the same happens in state definitions (first X then;, the first item of #2429). Additionally an unnamed composite DecisionNode is exported as decide ; (trailing space).

Root cause

  • The target EndFeatureMembership owns a bare ReferenceUsage with no (or only implied) ReferenceSubsetting: the target is implicitly the following member. caseSuccessionAsUsage always emitted then followed by appendConnectorEndMember, which has nothing to emit for such an end. The implicit source case was already handled (isSuccessionUsageImplicitSource), the target case was not.
  • caseDecisionNode appended "decide " with a hard-coded trailing space before an (empty) declaration.

Fix

SysMLElementSerializer:

  • isSuccessionUsageImplicitSource is generalized to isImplicitEnd (unnamed ReferenceUsage whose specializations are all implied) and used for both ends.
  • New getNextMembership / getImplicitSuccessionTarget: when the next not-yet-serialized member of the owning type is an ActionUsage (incl. control nodes, states; TransitionUsage excluded) and the target end is implicit or references exactly that member, the member is serialized inline as then <member> and added to childrenMembershipToSkip so it is not emitted a second time. This produces then decide;, then merge;, then fork;, then join;, then action x {...}, then state s2;.
  • Implicit target with no usable following member: nothing is emitted for the succession (no dangling then;) and a warning is reported through reportConsumer.
  • A body on a succession with an inlined target cannot be represented; it is dropped with a warning.
  • caseDecisionNode emits decide via appendWithSpaceIfNeeded like the other keywords.

Tests

  • SysMLElementSerializerTest: successionUsageWithImplicitControlNodeTargets (then decide; / then merge;), successionUsageWithImplicitNamedActionTarget (then action a_2;), successionUsageWithImplicitTargetInStateDefinition (then state s2;), successionUsageWithImplicitTargetAndNoFollowingMember (no output + warning), successionUsageWithExplicitSourceAndUnresolvedImplicitTarget (succession omitted instead of a partial first a1;), decisionNodeWithoutName.
  • ImportExportTests: new checkSuccessionWithImplicitTargets round trip (then decide;, then merge;, then action a3;); checkDecisionWithNamedTransition and the then action expectation updated to the inline form.
  • CHANGELOG.adoc entry added.

Fixes #2528. Also fixes the first X then; item of #2429 (the other items of that issue are not covered). Part of #2213.

PLEASE READ ALL ITEMS AND CHECK ONLY RELEVANT CHECKBOXES BELOW

Auto review

  • Have you reviewed this PR? Please do a first quick review, It is very useful to detect typos and missing copyrights, check comments, check your code... The reviewer will thank you for that :)

Project management

  • Has the pull request been added to the relevant milestone?
  • Have the priority: and pr: labels been added to the pull request? (In case of doubt, start with the labels priority: low and pr: to review later)
  • Have the relevant issues been added to the pull request?
  • Have the relevant labels been added to the issues? (area:, type:)
  • Have the relevant issues been added to the same project milestone as the pull request?

Changelog and release notes

  • Has the CHANGELOG.adoc + doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc been updated to reference the relevant issues?
  • Have the relevant API breaks been described in the CHANGELOG.adoc?
  • Are the new / upgraded dependencies mentioned in the relevant section of the CHANGELOG.adoc?
  • In case of a change with a visual impact, are there any screenshots in the doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?
  • In case of a key change, has the change been added to Key highlights section in doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?

Documentation

  • Have you included an update of the documentation in your pull request? Please ask yourself if an update (installation manual, user manual, developer manual...) is needed and add one accordingly.

Tests

  • Is the code properly tested? Any pull request (fix, enhancement or new feature) should come with a test (or several). It could be unit tests, integration tests or cypress tests depending on the context. Only doc and releng pull request do not need for tests.

@AxelRICHARD

Copy link
Copy Markdown
Member

Hello,

Thank your for providing this PR.
Could you also sign the Eclipse Contributor Agreement (ECA) https://www.eclipse.org/legal/eca/ please ? I won't be able to merge the PR if you don't sign it, because SysON is a project of the Eclipse Foundation.

If this PR is related to #2429 as it seems to be, please add a comment on this issue saying that you want to work on this issue. I will affect it to you.

Also it seems you added a fix for #2213. Please provide a separate PR for this issue and add a comment on this issue saying that you want to work on this issue. I will affect it to you.

Then I will perform a review.

Thank you for your understanding.

Regards,

@AxelRICHARD AxelRICHARD added this to the 2026.11.0 milestone Sep 22, 2026
@devin-ai-integration
devin-ai-integration Bot force-pushed the fix/succession-implicit-target branch from f7ccd69 to 81b0aa8 Compare September 23, 2026 13:31
@HuiJun HuiJun changed the title Export successions with an implicit target inline and satisfy without a dangling by Export successions with an implicit target inline Sep 23, 2026
@HuiJun HuiJun changed the title Export successions with an implicit target inline [2429] Export successions with an implicit target inline Sep 23, 2026
@HuiJun HuiJun changed the title [2429] Export successions with an implicit target inline [2528] Export successions with an implicit target inline Sep 23, 2026
@devin-ai-integration
devin-ai-integration Bot force-pushed the fix/succession-implicit-target branch 2 times, most recently from 280f79e to 948d2c9 Compare September 23, 2026 14:10
@AxelRICHARD

Copy link
Copy Markdown
Member

Hello @HuiJun,

Here is my review:

  • Possible data loss: the serializer (backend/services/syson-sysml-metamodel-services/src/main/java/org/eclipse/syson/sysml/metamodel/services/textual/SysMLElementSerializer.java:1338) drops a succession with an explicit source when its following target is unnamed. It reports a warning, but the exported model loses that connection. The warning also says there is “no following action” when one exists. For a complete fix, give the unnamed target a unique name in the exported text and reference it: first source then generatedName; followed by decide generatedName;. Named targets already use this form in the PR’s tests. Generate the name for serialization without changing the model, and test that importing the result preserves the connection.
  • Existing body content can be lost: the inline branch (backend/services/syson-sysml-metamodel-services/src/main/java/org/eclipse/syson/sysml/metamodel/services/textual/SysMLElementSerializer.java:1371) warns about remaining succession children but does not serialize them. Previously, the serializer wrote that content. This needs either preservation or a test establishing that such content cannot occur.
  • Please squash all your commit to only provide one
  • Please update the doc/content/modules/user-manual/pages/release-notes/2026.11.0.adoc release note

Thank you!

@devin-ai-integration
devin-ai-integration Bot force-pushed the fix/succession-implicit-target branch 2 times, most recently from 81cd00c to d47e340 Compare September 28, 2026 21:59
A succession whose second end is implicit is now exported by inlining the following member after then, matching the then shorthand. When the succession has an explicit first source or owns body content, the following member is referenced by name instead, and an unnamed member gets a unique generated name in the exported text only. An unnamed composite DecisionNode is now exported as decide; without a trailing space.

Bug: eclipse-syson#2528
Signed-off-by: Jason Han <jason.han@jpl.nasa.gov>
@devin-ai-integration
devin-ai-integration Bot force-pushed the fix/succession-implicit-target branch from d47e340 to aef7e87 Compare September 28, 2026 22:07
@HuiJun

HuiJun commented Sep 30, 2026

Copy link
Copy Markdown
Author

Done! Sorry for the delay in responding!

@AxelRICHARD

Copy link
Copy Markdown
Member

Done! Sorry for the delay in responding!

Hello @HuiJun, there is no problem, you can take all the time you need for taking into account my remarks et comments.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Textual export emits then; for successions whose target is an anonymous control node (then decide;)

2 participants