-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix: enforce workflow validation before deploy and run #3473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
The deploy endpoint only validated schedule data but never checked workflow state (block types, edges, tool references). The Run button had validation hardcoded to `false`. Redeployments (Update) skipped all pre-deploy checks entirely. Changes: - Backend: call validateWorkflowState() before deploying to reject workflows with unknown block types, dangling edges, or invalid tool references (returns 400 with details) - Frontend panel: replace hardcoded `hasValidationErrors = false` with a check that blocks are connected via edges - Frontend deploy hook: run pre-deploy checks for redeployments too, not just first deploys Fixes #3444 This PR was authored by Claude Opus 4.6 (AI), operated by @MaxwellCalkin Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -356,7 +356,11 @@ export const Panel = memo(function Panel() { | |
| // Compute run button state | ||
| const canRun = userPermissions.canRead // Running only requires read permissions | ||
| const isLoadingPermissions = userPermissions.isLoading | ||
| const hasValidationErrors = false // TODO: Add validation logic if needed | ||
|
|
||
| // Validate workflow has connected blocks (at least one edge means blocks are wired together) | ||
| const hasEdges = useWorkflowStore((state) => state.edges.length > 0) | ||
| const hasValidationErrors = hasBlocks && !hasEdges | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Single-block workflows incorrectly blocked by edge check
The intent (catching disconnected/dangling blocks) is good, but using |
||
|
|
||
|
cursor[bot] marked this conversation as resolved.
|
||
| const isWorkflowBlocked = isExecuting || hasValidationErrors | ||
| const isButtonDisabled = !isExecuting && (isWorkflowBlocked || (!canRun && !isLoadingPermissions)) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type assertion papers over a missing
variablesfieldnormalizedDatamay not include avariablesproperty, so the castas WorkflowStatesilently satisfies TypeScript while potentially producingundefinedat runtime for that field.validateWorkflowStateonly usesblocksandedges, but if the function signature ever evolves, this cast could hide a real gap.Consider spreading a safe default instead: