← Back to Pull requests

fix(workflow): prevent self-referential node connections #3726

Open
unknown opened this pull request with 493 lines diff across 6 files
View on GitHub
unknown unknown commented on Oct 07, 2026 17:02 UTC
Author

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

  • Bug fix

  • Enhancement

  • Tests

  • Documentation

  • Other (please specify)
  • Risk Analysis - REQUIRED

  • High — Broad platform impact (e.g., SWR config, shared framework components, authentication, routing, API wrappers, build/bundler config). Changes affect multiple workspaces or could cause widespread regressions.

  • Medium — Scoped but cross-cutting (e.g., shared utility functions, changes to multiple pages within one workspace, component library updates, test infrastructure). Limited blast radius but touches common code paths.

  • Low — Narrowly scoped (e.g., single page fix, styling tweak, documentation, test-only changes, copy/string updates). Minimal risk of unintended side effects.
  • Dependencies

    None.

    Testing

    Ephemeral E2E Tests

    Once PR is ready and preliminary checks pass, trigger tests by posting a comment /run-playwright on this PR.

    Tests run against a fresh AAP instance (version based on branch).

    External Server E2E Runs

    Not applicable.

    Manual Testing

    Prerequisites

  • Log in to Automation Controller with a user who can edit workflow job templates.

  • Have at least three usable resources available, such as:

  • - Two or three job templates, or
    - Project sync templates.
  • Use a workflow job template that can be safely modified or create a temporary one.
  • 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 → C

    3. 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.

    Diff: 493 lines (+369 / -124) across 6 files Reviewer: h-kataria Review duration: 11169m
    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
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.4% (MEDIUM) · Higher = larger blast radius
    47.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.3% · Safe to merge
    25.3%