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

[core] Detect and handle UID conflicts when loading a graph #2059

Merged
merged 4 commits into from
Jun 16, 2023

Conversation

cbentejac
Copy link
Contributor

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

  • Add a message for the UidConflict compatibility issue;
  • Detect UID conflicts and create the corresponding Compatibility nodes.

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.

The `UidConflict` is not detected per se within the node factory as a
node's UID cannot be computed accurately from there, since its expressions
(which may impact the UID computation) have not been resolved yet.

Instead, the `UidConflict` is detected externally, and the information
is transferred to the node factory, which will create a corresponding
compatibility node with the regular process.

The created `UidConflict` compatibility node will be handled by the
Compatibility Manager like any other compatibility node.
@cbentejac cbentejac added this to the Meshroom 2023.2.0 milestone Jun 15, 2023
@cbentejac cbentejac self-assigned this Jun 15, 2023
@cbentejac cbentejac marked this pull request as draft June 15, 2023 18:17
@cbentejac cbentejac force-pushed the dev/uidCompatibility branch from b2db741 to e792bff Compare June 16, 2023 06:58
When loading the graph, once all the nodes have been created and the
links resolved, the computed nodes' UID can be compared with those
stored in the graph.

If a mismatch is detected, the node that presents the UID conflict is
removed from the graph and replaced with a CompatibilityNode, set with
`UidConflict`.

Nodes that come from templates are ignored as no UID is stored in
templates. Similarly, nodes that are already Compatibility nodes are left
out as they do not have a UID.
@cbentejac cbentejac force-pushed the dev/uidCompatibility branch from e792bff to 91b6045 Compare June 16, 2023 07:03
@cbentejac cbentejac marked this pull request as ready for review June 16, 2023 07:03
@cbentejac cbentejac added the feature new feature (proposed as PR or issue planned by dev) label Jun 16, 2023
@mugulmd mugulmd merged commit 90c562f into develop Jun 16, 2023
@mugulmd mugulmd deleted the dev/uidCompatibility branch June 16, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new feature (proposed as PR or issue planned by dev)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants