Preserve first matching workflow step for duplicate original names

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
Rudy Celekli committed 2026-10-01 21:46:39 -04:00
1 parent e948045a3b
commit 01060dbd51
1 file changed
+5 -3
+5 -3
View File
@@ -182,12 +182,14 @@ class WorkflowOptimizer:
opportunities: List[Dict]) -> List[ProcessStep]:
"""Create optimized future state workflow"""
optimized_steps = current_steps.copy()
# Opportunities refer to the original names; display names change below.
step_indexes = {step.name: i for i, step in enumerate(current_steps)}
for opportunity in opportunities:
step_name = opportunity["step"]
step_index = step_indexes[step_name]
# Resolve against original names; earlier improvements rename the copy.
step_index = next(
i for i, step in enumerate(current_steps)
if step.name == step_name
)
current_step = optimized_steps[step_index]