From 42aeafd0e92ffcfcee8eed3885f97cac21f89c7c Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Thu, 2 Jul 2026 20:43:28 +0200 Subject: [PATCH] Fail closed on starred mapping alias duplicate safety --- .../test_generate_popular_node_signatures.py | 44 +++++++++++++++++++ tools/generate_popular_node_signatures.py | 2 + 2 files changed, 46 insertions(+) diff --git a/tests/test_generate_popular_node_signatures.py b/tests/test_generate_popular_node_signatures.py index bab788e..603f6b8 100644 --- a/tests/test_generate_popular_node_signatures.py +++ b/tests/test_generate_popular_node_signatures.py @@ -476,6 +476,50 @@ alias = NODE_CLASS_MAPPINGS "multi-target-alias-duplicate-node-pack", ) + def test_duplicate_node_id_from_starred_collection_mapping_alias_skips_static_node(self): + source_a = ''' +class StaticDupNode: + RETURN_TYPES = ("IMAGE",) + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "image": ("IMAGE",), + }, + } + + +NODE_CLASS_MAPPINGS = { + "DupNode": StaticDupNode, +} +''' + source_b = ''' +class DynamicDupNode: + RETURN_TYPES = ("MASK",) + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "mask": ("MASK",), + }, + } + + +NODE_CLASS_MAPPINGS = {} +*ALIASES, = (NODE_CLASS_MAPPINGS,) +ALIASES[0]["DupNode"] = DynamicDupNode +''' + result = self._extract_two_sources( + source_a, + source_b, + "starred-collection-alias-duplicate-node-pack", + ) + + self.assertEqual({}, result["nodes"]) + self.assertEqual("no_static_nodes", result["pack"]["status"]) + def test_ambiguous_mapping_mutation_key_suppresses_static_nodes(self): source_a = ''' class StaticDupNode: diff --git a/tools/generate_popular_node_signatures.py b/tools/generate_popular_node_signatures.py index 459780f..aff5b06 100644 --- a/tools/generate_popular_node_signatures.py +++ b/tools/generate_popular_node_signatures.py @@ -2298,6 +2298,8 @@ def _node_class_mapping_keys(tree): keys.update(literal_keys) if literal_ambiguous: return _INVALID + if _module_dict_alias_invalidated(stmt, module_dict_aliases): + return _INVALID mutation_keys = _node_class_mapping_mutation_string_keys( stmt, env,