[core] Detect and handle UID conflicts when loading a graph #2059
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR relates to #2038, which invalidates all the nodes in all the existing graphs by changing the way UIDs are computed. Without it, all nodes will be invalidated silently, without letting the user know why or giving them the chance to still use their computed data before doing the upgrade.
With this PR, UID conflicts - differences between the UIDs that are saved in a project file and the UIDs that are computed in the graph once all the links have been resolved - are detected and handled like any other compatibility issue, meaning they can be solved with the Compatibility Manager.
When a project file is loaded, the graph is built normally (compatibility issues on nodes' versions and descriptions are raised as usual) and then evaluated to check for UID conflicts. If a node presents a UID conflict, it is removed from the graph and replaced with a Compatibility node that has a
UidConflict
compatibility issue.Features list
UidConflict
compatibility issue;Implementation remarks
The comparison between the nodes' actual UIDs and the expected one cannot be performed while the graph is being built, as there is no way to compute accurate UIDs until the links for all the nodes have been resolved. It is necessary to build the graph and resolve all the links first before performing the comparison, and replacing nodes that present UID conflicts.
Nodes from templates are excluded from the comparison since no UID is saved in template files. Nodes that were created in the graph as Compatibility nodes (with versions or descriptions compatibility issues) are also ignored, since the UID of Compatibility nodes are not resolved.