fix(workflow): detect duplicate trigger paths when first node has no id (#409)

validate_trigger_paths used seen_paths.get(trigger_path) and treated a None
result as "path not seen yet". But None is also what node.get("id") returns
for a node without an id, so when the first trigger node sharing a path had no
id, it was stored as None and every later node with the same path was silently
accepted as unique — duplicate trigger paths slipped through validation.

Use a membership test (trigger_path not in seen_paths) so "first occurrence"
and "node_id happens to be None" are no longer conflated. Behavior is
unchanged for nodes that have ids.

Adds a regression test that fails before and passes after.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Mubashir R 2026-06-19 13:23:34 +05:00 committed by GitHub
parent fc37d5058f
commit ed06de73a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 2 deletions

View file

@ -127,8 +127,7 @@ def validate_trigger_paths(
)
)
first_node_id = seen_paths.get(trigger_path)
if first_node_id is None:
if trigger_path not in seen_paths:
seen_paths[trigger_path] = node_id
else:
issues.append(