fix(condition): fixed deactivated edges when if and else if conditions connected to same destination block, added 100+ unit tests#2497
Merged
waleedlatif1 merged 1 commit intostagingfrom Dec 20, 2025
Conversation
…s connected to same destination block, added 100+ unit tests
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryFixed a critical bug where multiple condition branches (if/else if/else) pointing to the same destination block would incorrectly deactivate that block and its descendants. The root cause was twofold: Core Issues Fixed:
Technical Changes:
Test Coverage:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Condition as Condition Block
participant EM as EdgeManager
participant DAG as DAG Nodes
participant Target as Target Block
Note over Condition,Target: Scenario: if→A, else→A (both branches to same target)
Condition->>EM: processOutgoingEdges(output)
Note over EM: Pass 1: Categorize edges
EM->>EM: Check if edge (condition-if) should activate
EM->>EM: selectedOption !== 'if', mark for deactivation
EM->>EM: Check if edge (condition-else) should activate
EM->>EM: selectedOption === 'else', add to activatedTargets
Note over EM: Pass 2: Deactivate edges
EM->>EM: deactivateEdgeAndDescendants(condition→A-condition-if)
EM->>EM: hasActiveIncomingEdges(A, excludeEdgeKey)
Note over EM: Key fix: Checks if OTHER edges to A are active
EM->>EM: Found active edge (condition-else), skip cascade
Note over EM: Pass 3: Update incoming edges
EM->>DAG: targetNode.incomingEdges.delete(condition)
Note over EM: Pass 4: Check readiness
EM->>EM: isNodeReady(targetNode A)
EM->>EM: incomingEdges.size === 0, ready!
EM-->>Condition: return [A]
Note over Target: Target A executes (correct!)
Note over Condition,Target: Bug was: Both edges had same ID, else overwrote if<br/>Fix: Edge IDs now include sourceHandle suffix
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
Tested manually
Checklist