[core][graphIO] Improve node type version handling

* Deserialization: Replace the logic that defaulted the node type version to "0.0" when unspecified,
and assume that unspecified version on a node is targetting current node type version.
* Serialization: Only serialize node type versions for which a version info is available.

* Test suites:
  * Add helper context manager to manually override the version of a given node type.
  * Add new unit tests to cover version conflicts handling is various scenarios.
This commit is contained in:
Yann Lanthony 2025-02-06 16:46:05 +01:00
parent d9e59e330a
commit 87fbcee06d
7 changed files with 98 additions and 9 deletions

View file

@ -95,7 +95,10 @@ class _NodeCreator:
nodeCreatedFromCurrentVersion = self.version is None
if nodeCreatedFromCurrentVersion:
return True
nodeTypeCurrentVersion = meshroom.core.nodeVersion(self.nodeDesc, "0.0")
nodeTypeCurrentVersion = meshroom.core.nodeVersion(self.nodeDesc)
# If the node type has not current version information, assume compatibility.
if nodeTypeCurrentVersion is None:
return True
return Version(self.version).major == Version(nodeTypeCurrentVersion).major
def _checkDescriptionCompatibility(self) -> bool: