fix(workflow): prevent self-referential node connections #3726
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 493 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.371
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #3726"
general
weight: 0.35
h-kataria
Summary
Prevent workflow visualizer users from creating self-referential node connections. Self-drops are rejected before graph state or edge visibility changes, and ancestor validation now treats the source node as an invalid target while safely terminating on self-loops.
Type of Change
Risk Analysis - REQUIRED
Dependencies
None.
Testing
Ephemeral E2E Tests
Once PR is ready and preliminary checks pass, trigger tests by posting a comment
/run-playwrighton this PR.External Server E2E Runs
Not applicable.
Manual Testing
Prerequisites
- Two or three job templates, or
- Project sync templates.
1. Open the Workflow Visualizer
1. Go to Automation Execution → Templates.
2. Create a new Workflow Job Template, or open an existing one.
3. Select View workflow visualizer.
4. Confirm the visualizer loads and the Add step button is available.
2. Create a small workflow graph
1. Add node A using Add step.
2. Add node B using Add step and link from node A.
3. Add node C using Add step and link from node B.
4. Click Save and confirm the success notification.
5. Confirm the graph contains the expected links:
Start → A → B → C3. Verify a node cannot be connected to itself
1. Start a connector drag from node A.
2. Drop the connector back onto node A.
3. Confirm that:
- No self-referential edge is created.
- The graph remains unchanged.
- No extra edge or loop appears.
- The Save button does not become enabled because of the rejected action.
4. Repeat the same test with nodes B and C.
4. Verify invalid cycle targets are disabled
1. Start a connector drag from node B.
2. Observe the available target nodes.
3. Confirm that:
- Node B itself is shown as an invalid target.
- Node A, which is an ancestor of B, is shown as an invalid target.
- Node C, which is a direct child of B, is shown as an invalid target.
4. Attempt to drop the connector on each invalid target.
5. Confirm that no new edge is created and the existing graph is unchanged.
5. Verify a valid connection still works
1. Add another independent node D, if necessary.
2. Start a connector drag from a node where a valid target is available.
3. Drop it on a node that does not create a self-reference or cycle.
4. Confirm that:
- The new edge is created.
- The graph is laid out correctly.
- Save becomes enabled.
5. Save the workflow and confirm the success notification.
6. Verify persistence after reload
1. Reload the Workflow Visualizer page.
2. Confirm that:
- Valid edges remain.
- No self-referential or cyclic edge was persisted.
- The workflow still opens without errors.
Screenshots
Not applicable; no visual changes.