Overview
Workflow versioning provides complete change tracking, rollback capability, and an immutable audit trail for compliance. Every time you publish a workflow, a permanent snapshot is created that preserves the exact state of nodes, edges, and canvas viewport.Key Concepts
Versions vs. Drafts
- Draft Edits: Changes made in the workflow editor are not versioned automatically
- Publishing: Creates an immutable version snapshot with an incremented version number
- Version Numbers: Sequential integers starting at 1: v1, v2, v3, etc.
- Immutability: Once published, versions cannot be edited or deleted
Immutability
Workflow versions are permanently immutable:- Cannot be edited after creation
- Cannot be deleted (preserves complete audit trail)
- Rollback creates a new version (doesn’t modify the old one)
- All versions remain accessible forever
Use Cases
1. Production Issue Recovery
Quickly rollback when workflow changes break production:2. Compliance Audit
Track who changed what and when for regulatory requirements:- Who:
published_byuser ID links to profile - What: Complete snapshot of workflow state
- When:
published_attimestamp - Why: Optional
notesfield for change descriptions
- Version history timeline
- Changes between versions (visual diff)
- Rollback events and reasons
- User attribution for each change
3. Debugging
Compare versions to understand what changed:4. A/B Testing
Run different workflow versions and compare results:5. Staged Rollouts
Use tags to manage deployment stages:API Reference
useWorkflowVersions Hook
Complete workflow version management hook.Creating a Version
Rolling Back
Comparing Versions
Getting Specific Version
Database Schema
fw_workflow_versions Table
Execution Version Linking
Thefw_workflow_executions table links each execution to the version used:
Best Practices
1. Publish Before Major Changes
Create a version before making risky changes:2. Add Descriptive Notes
Help future maintainers understand changes:3. Use Meaningful Tags
Organize versions with consistent tagging:4. Review Diff Before Rollback
Always compare versions before rolling back:5. Link Versions to Issues
Reference issue tracking systems in notes:Security & Compliance
Immutability
Versions cannot be modified or deleted:- No UPDATE policy on
fw_workflow_versions - No DELETE policy on
fw_workflow_versions - Even platform admins cannot alter versions
Multi-Tenant Isolation
Row-Level Security (RLS) ensures:- Users can only see versions in their organization
- Cross-tenant version access is blocked
- Execution version links are organization-scoped
Audit Trail
Every version captures:- Who: User ID of publisher
- When: Timestamp of publication
- What: Complete workflow state
- Why: Optional notes explaining changes
Troubleshooting
Version Creation Fails
Symptom:create_workflow_version() returns error
Causes:
- No workflow definition exists for the rule
- User lacks organization access
- Invalid rule_id
Rollback Creates Wrong Version
Symptom: Rolled back version doesn’t match target Cause: Snapshot stored incorrectly Solution:Version Comparison Incorrect
Symptom: Diff shows wrong changes Cause: Node IDs changed between versions Solution: Version comparison uses node IDs as identity. If you manually change node IDs, comparison will treat them as different nodes.Migration Guide
Adding Versioning to Existing Workflows
If you have workflows created before versioning was implemented:Related Documentation
- Workflow Builder Guide - Visual editor usage
- Workflow API Reference - Complete API documentation
- FW-07 Specification - Implementation details