fix(copilot): copilot edit router block accepts semantic handles#2857
Merged
fix(copilot): copilot edit router block accepts semantic handles#2857
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR enhances the copilot router block validation to accept semantic handle formats in addition to internal UUID-based handles. The changes enable the copilot to use more readable handle formats like Key changes:
The implementation mirrors the existing Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Copilot
participant EditWorkflow
participant Validation
participant Sanitizer
participant UI
Note over Copilot,UI: Copilot Edit Flow with Semantic Handles
Copilot->>EditWorkflow: edit_workflow with semantic handles<br/>(e.g., router-{blockId}-route-1)
EditWorkflow->>Validation: validateSourceHandleForBlock
alt Block type is router_v2
Validation->>Validation: Check handle starts with "router-"
Validation->>Validation: validateRouterHandle
Validation->>Validation: Accept UUID format: router-{uuid}
Validation->>Validation: Accept semantic format: router-{blockId}-route-N
Validation->>Validation: Accept title format: router-{blockId}-{title}
Validation-->>EditWorkflow: valid=true
else Block type is condition
Validation->>Validation: validateConditionHandle
Validation-->>EditWorkflow: valid=true/false
end
EditWorkflow-->>Copilot: Edge created successfully
Note over Sanitizer,UI: Sanitization for Training Data
UI->>Sanitizer: sanitizeForCopilot(workflowState)
Sanitizer->>Sanitizer: extractConnectionsForBlock
loop For each edge
Sanitizer->>Sanitizer: convertToSemanticHandle
alt Router block
Sanitizer->>Sanitizer: convertRouterHandleToSemantic<br/>(router-{uuid} → router-{blockId}-route-N)
else Condition block
Sanitizer->>Sanitizer: convertConditionHandleToSemantic<br/>(condition-{uuid} → condition-{blockId}-if)
end
end
Sanitizer-->>UI: CopilotWorkflowState with semantic handles
|
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
Fix copilot router block
Type of Change
Testing
Manual
Checklist