every libs/*.py and hooks/*.py now starts with a one-line module docstring; every bin/* script starts with a `# purpose:` header. discovery-by-`ls`-and-read instead of by index. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
17 lines
564 B
Python
17 lines
564 B
Python
"""unique_node_ids: bw-test + pre-apply gate ensuring metadata `id` is unique across all nodes."""
|
|
|
|
|
|
def test_unique_node_ids(repo):
|
|
ids = {}
|
|
for node in repo.nodes:
|
|
if node.metadata.get('id') in ids:
|
|
raise ValueError(f"Duplicate node ID found: {node.metadata.get('id')} in node {node.name} and {ids[node.metadata.get('id')]}")
|
|
ids[node.metadata.get('id')] = node.name
|
|
|
|
|
|
def apply_start(repo, target, nodes, interactive=False, **kwargs):
|
|
test_unique_node_ids(repo)
|
|
|
|
|
|
def test(repo, **kwargs):
|
|
test_unique_node_ids(repo)
|