Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make association source and target reliable in CDB #2914

Merged

Conversation

scosta-obeo
Copy link
Contributor

@scosta-obeo scosta-obeo commented Nov 6, 2024

#2913 Merge two commands to avoid refresh between them

This commit merge two command for navigability state of association in
CDB to avoid diagram refresh (and unwanted behavior) between them.

#2913 Make association source and target reliable in CDB

This commit make association source and target reliable in CDB always
have the same source and target and to prevent a change in property from
changing the source or the target.

This commit also add migration to reverse the association edge in the
wrong direction in old project.

#2913 Add tests for relation edge migration in CDB

#2913 Migrate all data tests

@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch 3 times, most recently from b1b60b3 to 9b745ef Compare November 7, 2024 14:02
@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch from 9b745ef to e63dc35 Compare November 12, 2024 14:40
@scosta-obeo scosta-obeo requested a review from lredor November 12, 2024 14:54
Copy link
Contributor

@lredor lredor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Juste a little remark concerning a commit message (and then "approved")

@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch from e63dc35 to aa8097b Compare November 13, 2024 12:15
@scosta-obeo scosta-obeo requested a review from lredor November 13, 2024 12:17
@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch 2 times, most recently from 2abe891 to 3ef0360 Compare November 13, 2024 13:04
if (customFeatures.contains(sourceArrowFeatureName) && !customFeatures.contains(targetArrowFeatureName)) {
customFeatures.add(targetArrowFeatureName);
customFeatures.remove(sourceArrowFeatureName);
} else if (!customFeatures.contains(sourceArrowFeatureName) && customFeatures.contains(targetArrowFeatureName)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we go there, we are going to compute again the contains for both. computing it once and using local variables would gain a little computation time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

EObject targetObject = targetNode.getTarget();
return sourceObject == expectedTarget && targetObject == expectedSource;
} else {
// error
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add something to some logs or throw an exception if the data are corrupted ?
Silently ignoring errors during migration is the best way to get strange bugs and data corruption visible months later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a log message.

Copy link

@zgrtls zgrtls Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be missing something but where do you check that the migration is not run twice on the same aird, for example when migrating to 7.0.1 and then again when 7.0.5 is out and the file is migrated again ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no marker for migration in Capella. In the context mentioned, the migration will indeed be launched twice. But the check carried out in the needMigration(DEdge dEdge) method will therefore allow no changes during the second migration.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very resource (and time) expensive for the user if we no longer create old style DEdge objects. Would it be possible to bypass the whole migration by looking, for example, at the version of one of the meta models we know have increase in version 7.0.1 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some other migrations with this kind of check ? The problem seems global for all migration. No ?
For example, in Sirius, there is a common way to address this problematic.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no common way defined in capella and that's an issue. In some other add-ons, we do it like in Sirius.
It could be implemented the same way here, couldn't it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm agree but it's outside the scope of this issue. I suggest you open a new ticket.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new migration so it is in the scope of this ticket for this migration.
The refactoring to do it correctly in the other migrations will be new tickets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added version checking to the migration. There should be no more failed tests (except for BrokenLinksCheckTestCase which fails on master). You can resolve conversations if it's fine with you.

@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch from 3ef0360 to 0a5f8f4 Compare November 21, 2024 09:42
@zgrtls
Copy link

zgrtls commented Nov 21, 2024

With the lastest commit, there are still 11 failed tests compare to the single one on the master branch. They should be looked at before validating the PR.

@lredor
Copy link
Contributor

lredor commented Nov 26, 2024

With the lastest commit, there are still 11 failed tests compare to the single one on the master branch. They should be looked at before validating the PR.

Yes, after analysis, the problem is that "DT_Association" has not the same source and target mappings list. With the new solution based on the ID of the source/target to determine with a deterministic way the source and the target, these lists must be the same. @scosta-obeo will push a new PR with a modification of the common.odesign.

@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch from 0a5f8f4 to cd65e6e Compare November 26, 2024 12:38
@zgrtls
Copy link

zgrtls commented Nov 27, 2024

@scosta-obeo still 6 tests failing (+ 1 not because of this PR)

@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch 4 times, most recently from 94f37e4 to 17d5715 Compare November 29, 2024 08:53
@lredor

This comment was marked as outdated.

@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch from 17d5715 to 2829828 Compare December 2, 2024 09:48
@lredor

This comment was marked as outdated.

@lredor

This comment was marked as outdated.

@lredor

This comment was marked as outdated.

This commit merges two commands for navigability state of association in
CDB to avoid diagram refresh (and unwanted behaviour) between them.

Signed-off-by: Séraphin Costa <[email protected]>
This commit updates the CDB association edge mapping in the VSM
(source/target mappings and styles) to make association source and
target reliable in CDB, to always have the same source and target, and
to prevent a change in property from changing the source or the target.

This commit also adds a migration to reverse the association edge in the
wrong direction in existing projects.

This commit also adapts the tests
ReconnectRelationshipGroup.ReconnectRelationshipGroupSA,
ReconnectRelationshipGroup.ReconnectRelationshipGroupOA in
org.polarsys.capella.test.diagram.tools.ju.cdb to these changes.

Signed-off-by: Séraphin Costa <[email protected]>
This commit also:

* Revert some unexpected changes (data intentionally corrupted for test
Rule_I_43_ElementReferencesAirdOrProxyElement)

* Adapt tests HideAssociationLabels, HideRoleNames and ShowModifiers
because the source and target have been inverted and therefore also the
labels.

Signed-off-by: Séraphin Costa <[email protected]>
@scosta-obeo scosta-obeo force-pushed the sco/fix/cdb-edge-stability branch from 2829828 to ebeb224 Compare December 3, 2024 13:13
Copy link

@zgrtls zgrtls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lredor @scosta-obeo Looks better. Only 1 failed test left: org.polarsys.capella.test.migration.ju.testcases.basic.RelationStability.test

Copy link

sonarcloud bot commented Dec 3, 2024

@tguiu tguiu merged commit 77a9975 into eclipse-capella:master Dec 4, 2024
4 checks passed
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.

4 participants