diff --git a/src/exportify/export_manager/graph.py b/src/exportify/export_manager/graph.py index ce272f2..a1902c1 100644 --- a/src/exportify/export_manager/graph.py +++ b/src/exportify/export_manager/graph.py @@ -13,6 +13,7 @@ from __future__ import annotations +import collections from dataclasses import dataclass, field from enum import IntEnum from typing import TYPE_CHECKING, Literal @@ -284,16 +285,21 @@ def _add_propagated_export(self, node: ModuleNode, entry: ExportEntry) -> None: node.propagated_exports[name] = entry def _validate_no_duplicates(self) -> None: - """Validate no duplicate exports in same module.""" - for module_path, node in self.modules.items(): - # Check for duplicates in own_exports - export_names = list(node.own_exports.keys()) - if len(export_names) != len(set(export_names)): - duplicates = [name for name in export_names if export_names.count(name) > 1] - raise ValueError( - f"❌ Error: Duplicate exports in module {module_path}\n\n" - f" Duplicates: {', '.join(set(duplicates))}" - ) + """Validate no duplicate exports in same module. + + Notes + ----- + `ModuleNode.own_exports` is a `dict` keyed by export name, so it + cannot contain duplicate keys by construction: inserting the same + name multiple times will simply overwrite the previous entry. + + As a result, detecting duplicates by inspecting + `node.own_exports.keys()` can never succeed. If duplicate detection + is required, it must be implemented at insertion time (for example, + in the code that populates `own_exports`) *before* overwriting any + existing entry. + """ + return def _validate_propagation_sources(self) -> None: """Validate all propagated exports have valid source modules."""