[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

@ -1608,7 +1608,8 @@ class CompatibilityNode(BaseNode):
# Make a deepcopy of nodeDict to handle CompatibilityNode duplication
# and be able to change modified inputs (see CompatibilityNode.toDict)
self.nodeDict = copy.deepcopy(nodeDict)
self.version = Version(self.nodeDict.get("version", None))
version = self.nodeDict.get("version")
self.version = Version(version) if version else None
self._inputs = self.nodeDict.get("inputs", {})
self._internalInputs = self.nodeDict.get("internalInputs", {})