Skip to content

feat(workflow-block): added redeploy action to workflow header for workflow block - #1875

Merged
waleedlatif1 merged 1 commit into
stagingfrom
feat/workflow-block
Nov 10, 2025
Merged

feat(workflow-block): added redeploy action to workflow header for workflow block#1875
waleedlatif1 merged 1 commit into
stagingfrom
feat/workflow-block

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • added redeploy action to workflow header for workflow block

Type of Change

  • New feature

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Nov 10, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 10, 2025 11:51pm

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR adds a visual indicator when a child workflow referenced in a workflow block has been modified since its last deployment. It introduces a needsRedeploy flag that compares the workflow's updatedAt timestamp with the active deployment's createdAt timestamp. When changes are detected, the badge changes from green "deployed" to orange "redeploy" and becomes clickable to trigger redeployment.

Key changes:

  • Added parallel API fetching for deployment versions and workflow metadata in use-child-deployment.ts
  • Implemented timestamp comparison logic to detect when workflow changes require redeployment
  • Updated UI to display orange "redeploy" badge with clickable action when redeployment is needed
  • Maintains existing deployment functionality while adding improved workflow state visibility

Confidence Score: 4/5

  • This PR is mostly safe to merge with minimal risk of breaking existing functionality
  • The implementation is straightforward and well-structured, introducing a new feature without modifying core deployment logic. Parallel API fetching improves performance. The timestamp comparison logic is sound since both timestamps come from the database. However, the confidence is 4 (not 5) due to one consideration: the timestamp comparison doesn't account for timezone differences or clock skew, though this is unlikely to cause issues in practice since both timestamps are from the same database server
  • Pay attention to use-child-deployment.ts - the timestamp comparison logic assumes database timestamps are consistent and monotonic

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/hooks/use-child-deployment.ts4/5Adds needsRedeploy logic by comparing workflow updatedAt with deployment createdAt timestamps, fetching both endpoints in parallel

Sequence Diagram

sequenceDiagram
participant UI as Workflow Block UI
participant Hook as useChildDeployment
participant API1 as /api/workflows/{id}/deployments
participant API2 as /api/workflows/{id}
participant DB as Database
UI->>Hook: Mount with childWorkflowId
Hook->>Hook: fetchActiveVersion(childWorkflowId)
par Parallel API Calls
Hook->>API1: GET /deployments (fetch active version)
API1->>DB: Query deployment versions
DB-->>API1: versions with createdAt
API1-->>Hook: {versions: [{version, isActive, createdAt}]}
and
Hook->>API2: GET /workflow (fetch metadata)
API2->>DB: Query workflow
DB-->>API2: workflow with updatedAt
API2-->>Hook: {data: {updatedAt}}
end
Hook->>Hook: Compare timestamps:<br/>needsRedeploy = workflow.updatedAt > deployment.createdAt
Hook-->>UI: Return {isDeployed, needsRedeploy, activeVersion}
alt needsRedeploy is true
UI->>UI: Show orange "redeploy" badge
Note over UI: Badge is clickable
UI->>UI: User clicks badge
UI->>API2: POST /api/workflows/{id}/deploy
API2->>DB: Create new deployment version
DB-->>API2: New deployment with new createdAt
API2-->>UI: Deployment success
UI->>Hook: refetchDeployment()
Hook->>Hook: Increment refetchTrigger
Note over Hook,API2: Repeat fetch cycle
end
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor
  • This PR is mostly safe to merge with minimal risk of breaking existing functionality
  • The implementation is straightforward and well-structured, introducing a new feature without modifying core deployment logic. Parallel API fetching improves performance. The timestamp comparison logic is sound since both timestamps come from the database. However, the confidence is 4 (not 5) due to one consideration: the timestamp comparison doesn't account for timezone differences or clock skew, though this is unlikely to cause issues in practice since both timestamps are from the same database server
  • Pay attention to use-child-deployment.ts - the timestamp comparison logic assumes database timestamps are consistent and monotonic

The timestamp comparison is safe because deployWorkflow explicitly does not update
workflow.updatedAt (only sets isDeployed and deployedAt), while
saveWorkflowToNormalizedTables always updates updatedAt on any change. This means
updatedAt > deploymentCreatedAt reliably indicates workflow changes occurred after the
last deployment, with no risk of false positives

@waleedlatif1
waleedlatif1 merged commit 0ed0a26 into stagingNov 10, 2025
9 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/workflow-block branch November 10, 2025 23:59
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@waleedlatif1