Skip to content

fix(deploy): fix workflow change detection to handle old variable reference format - #2623

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/deploy
Dec 29, 2025
Merged

fix(deploy): fix workflow change detection to handle old variable reference format#2623
waleedlatif1 merged 1 commit into
stagingfrom
fix/deploy

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • fix workflow change detection to handle old variable reference format

Type of Change

  • Bug fix

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 Dec 29, 2025

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentReviewUpdated (UTC)
docsSkippedSkippedDec 29, 2025 10:05am

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixed workflow change detection to properly handle legacy variable storage formats and UI-only fields. The fix addresses two issues:

  • Old deployed workflows stored variables as empty arrays instead of objects, causing comparison failures
  • The validationError field (UI-only) was triggering false change detection

Changes:

  • Added normalizeVariables() to convert legacy empty array format to object
  • Added sanitizeVariable() to strip UI-only validationError field before comparison
  • Updated variable comparison in hasWorkflowChanged() to use both normalization functions
  • Added 6 comprehensive test cases covering all edge cases

The implementation follows existing patterns (sanitizeTools, sanitizeInputFormat) and ensures backward compatibility.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is well-tested with comprehensive test coverage, follows existing code patterns, maintains backward compatibility, and addresses a specific bug without introducing new complexity
  • No files require special attention

Important Files Changed

FilenameOverview
apps/sim/lib/workflows/comparison/normalize.tsAdded sanitizeVariable to remove UI-only validationError field and normalizeVariables to handle legacy empty array format
apps/sim/lib/workflows/comparison/compare.tsUpdated variable comparison to normalize variables and sanitize before comparison, preventing false change detection
apps/sim/lib/workflows/comparison/compare.test.tsAdded comprehensive test coverage for variable comparison edge cases including validation errors and empty array handling

Sequence Diagram

sequenceDiagram
participant Client as hasWorkflowChanged
participant Norm as normalizeVariables
participant San as sanitizeVariable
participant Comp as normalizeValue
Note over Client: Compare current vs deployed state
Client->>Norm: normalizeVariables(currentState.variables)
alt variables is null/undefined
Norm-->>Client: {}
else variables is Array
Norm-->>Client: {} (legacy format)
else variables is object
Norm-->>Client: variables
end
Client->>Norm: normalizeVariables(deployedState.variables)
Norm-->>Client: normalized variables
Note over Client: Sanitize each variable
loop For each variable
Client->>San: sanitizeVariable(variable)
San-->>Client: variable without validationError
end
Client->>Comp: normalizeValue(sanitized variables)
Comp-->>Client: normalized for comparison
Note over Client: Compare stringified normalized values
alt Values differ
Client-->>Client: return true (changed)
else Values same
Client-->>Client: return false (unchanged)
end
Loading

@waleedlatif1
waleedlatif1 merged commit 8806508 into stagingDec 29, 2025
11 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/deploy branch December 29, 2025 10:09
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