Skip to content

Commit c62705a

Browse files
committed
refactor(workflow-editor): remove the dead Copilot diff overlay
The workflow diff store (proposed changes, accept/reject, baseline snapshot view) was fed only by the legacy workflow panel's Copilot tab, which called setProposedChanges after a successful edit_workflow tool result. That panel and its DiffControls were deleted in the Platform cutover, and nothing else produces a diff: edit_workflow persists on the server and announces the change through realtime and the mothership resource event, which the canvas reconciles by reloading. Every reader of the diff flags was therefore always false. Removes the diff overlay state and engine, the diff undo/redo operations and their protocol constants, the replace-state enqueue helper, the accept-diff command, the snapshot-view branches in the canvas, edges, blocks, editor, search-replace and output options, and the deploy "reviewing-diff" status. The external-update reconciliation bookkeeping that lived in the same store moves to stores/workflow-reconciliation, and applyWorkflowStateToStores to stores/workflows/apply-state.
1 parent ffaf52c commit c62705a

62 files changed

Lines changed: 397 additions & 3524 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/rules/sim-url-state.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ The workflow editor (`apps/sim/app/(product)/workspace/[workspaceId]/workflows/*
267267
- **Live cursor** and **broadcast live selection** (presence; emitted over the socket, throttled).
268268
- **Pan / zoom / viewport** (ReactFlow-owned, continuous, not persisted).
269269
- **Drag state** and **resize widths/heights** (panel/terminal/sidebar — high-frequency, persisted as local preferences).
270-
- **Ephemeral diff staging** (`hasActiveDiff`, `baselineWorkflow`, `diffAnalysis`).
271270

272271
Borderline candidates that *look* shareable but currently stay in Zustand because moving them fights existing machinery:
273272

‎.cursor/rules/sim-url-state.mdc‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ The workflow editor (`apps/sim/app/(product)/workspace/[workspaceId]/workflows/*
260260
- **Live cursor** and **broadcast live selection** (presence; emitted over the socket, throttled).
261261
- **Pan / zoom / viewport** (ReactFlow-owned, continuous, not persisted).
262262
- **Drag state** and **resize widths/heights** (panel/terminal/sidebar — high-frequency, persisted as local preferences).
263-
- **Ephemeral diff staging** (`hasActiveDiff`, `baselineWorkflow`, `diffAnalysis`).
264263

265264
Borderline candidates that *look* shareable but currently stay in Zustand because moving them fights existing machinery:
266265

‎apps/sim/app/(product)/_components/workspace/workflows/canvas/block-visual/use-block-visual.ts‎

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ import {
1111

1212
/**
1313
* The ring a block card paints, in legacy priority order: the neutral selection ring (editor open,
14-
* selected, or preview selection), then pending, deleted and the copilot diff states. Each card's
15-
* CSS paints it from `data-ring` with the legacy 1.5px ring.
14+
* selected, or preview selection), then pending. Subflow containers also take the status rings for
15+
* version-comparison diffs and preview run outcomes. Each card's CSS paints it from `data-ring` with
16+
* the legacy 1.5px ring.
1617
*/
1718
export type BlockRing = 'selected' | 'pending' | 'deleted' | 'new' | 'edited'
1819

1920
interface BlockRingOptions {
2021
isExecuting: boolean
2122
isEditorOpen: boolean
2223
isPending: boolean
23-
isDeletedBlock: boolean
24-
diffStatus: 'new' | 'edited' | null | undefined
2524
isPreviewSelection?: boolean
2625
isSelected?: boolean
2726
}
@@ -31,17 +30,12 @@ function blockRing({
3130
isExecuting,
3231
isEditorOpen,
3332
isPending,
34-
isDeletedBlock,
35-
diffStatus,
3633
isPreviewSelection,
3734
isSelected,
3835
}: BlockRingOptions): BlockRing | null {
3936
if (isEditorOpen || isSelected || isPreviewSelection) return 'selected'
4037
if (isExecuting) return null
4138
if (isPending) return 'pending'
42-
if (isDeletedBlock) return 'deleted'
43-
if (diffStatus === 'new') return 'new'
44-
if (diffStatus === 'edited') return 'edited'
4539
return null
4640
}
4741

@@ -73,8 +67,6 @@ export function useBlockVisual({
7367
const {
7468
isEnabled,
7569
isActive: isExecuting,
76-
diffStatus,
77-
isDeletedBlock,
7870
isLocked,
7971
} = useBlockState(blockId, currentWorkflow, data)
8072

@@ -105,22 +97,10 @@ export function useBlockVisual({
10597
isExecuting: isPreview ? false : isExecuting,
10698
isEditorOpen: isPreview ? isPreviewSelected : isEditorOpen,
10799
isPending: isPreview ? false : isPending,
108-
isDeletedBlock: isPreview ? false : isDeletedBlock,
109-
diffStatus: isPreview ? undefined : diffStatus,
110100
isPreviewSelection: isPreview && isPreviewSelected,
111101
isSelected: isPreview || isEmbedded ? false : isSelected,
112102
}),
113-
[
114-
isExecuting,
115-
isEditorOpen,
116-
isPending,
117-
isDeletedBlock,
118-
diffStatus,
119-
isPreview,
120-
isEmbedded,
121-
isPreviewSelected,
122-
isSelected,
123-
]
103+
[isExecuting, isEditorOpen, isPending, isPreview, isEmbedded, isPreviewSelected, isSelected]
124104
)
125105

126106
return {

‎apps/sim/app/(product)/_components/workspace/workflows/canvas/subflow-node/subflow-node.tsx‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ import {
4646
Ban,
4747
BLOCK_DIMENSIONS,
4848
CONTAINER_DIMENSIONS,
49-
type DiffStatus,
5049
getWorkflowSubflowHandleIds,
5150
HANDLE_POSITIONS,
52-
hasDiffStatus,
5351
Lock,
5452
Repeat,
5553
Split,
@@ -88,6 +86,9 @@ export interface SubflowNodeData extends Record<string, unknown> {
8886
* in. The editor-only action bar is injected via the `actionBar` slot so the
8987
* pure renderer carries no store, socket, or permission coupling.
9088
*/
89+
/** A container's change in a version comparison. */
90+
type SubflowDiffStatus = 'new' | 'edited' | undefined
91+
9192
interface SubflowNodeViewProps {
9293
id: string
9394
data: SubflowNodeData
@@ -102,7 +103,7 @@ interface SubflowNodeViewProps {
102103
/** Whether this subflow participates in the current execution handoff. */
103104
isExecutionHighlighted?: boolean
104105
/** Diff state when comparing workflow versions. */
105-
diffStatus?: DiffStatus
106+
diffStatus?: SubflowDiffStatus
106107
/** Depth in the parent container hierarchy (drives nesting styling). */
107108
nestingLevel: number
108109
canEditWorkflow: boolean
@@ -329,7 +330,7 @@ function SubflowStartView({
329330
*/
330331
function getSubflowRing(
331332
isNodeSelected: boolean,
332-
diffStatus: DiffStatus,
333+
diffStatus: SubflowDiffStatus,
333334
previewRunStatus: SubflowNodeData['executionStatus']
334335
): BlockRing | null {
335336
if (isNodeSelected) return 'selected'
@@ -722,7 +723,7 @@ type SubflowNode = Node<SubflowNodeData, 'subflowNode'>
722723
/**
723724
* Editor container for the loop/parallel node.
724725
*
725-
* Resolves the subflow's enabled/locked/focus/diff/run state from the editor
726+
* Resolves the subflow's enabled/locked/focus/run state from the editor
726727
* stores, computes its nesting depth from the ReactFlow node tree, and renders
727728
* the legacy container pixels — injecting the editor-only {@link ActionBar}.
728729
*/
@@ -733,10 +734,6 @@ export const SubflowNodeComponent = memo(({ data, id, selected }: NodeProps<Subf
733734

734735
const currentWorkflow = useCurrentWorkflow()
735736
const currentBlock = currentWorkflow.getBlockById(id)
736-
const diffStatus =
737-
currentWorkflow.isDiffMode && currentBlock && hasDiffStatus(currentBlock)
738-
? currentBlock.is_diff
739-
: undefined
740737

741738
const isEnabled = currentBlock?.enabled ?? true
742739
const isLocked = currentBlock?.locked ?? false
@@ -784,7 +781,6 @@ export const SubflowNodeComponent = memo(({ data, id, selected }: NodeProps<Subf
784781
isFocused={isFocused}
785782
isRunning={isRunning}
786783
isExecutionHighlighted={isExecutionHighlighted}
787-
diffStatus={diffStatus}
788784
nestingLevel={nestingLevel}
789785
canEditWorkflow={canEditWorkflow}
790786
onSelect={() => setCurrentBlockId(id)}

‎apps/sim/app/(product)/_components/workspace/workflows/canvas/workflow-block/workflow-block.tsx‎

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,9 @@ function migrationPrompt(name: string, target: BlockConfig): string {
198198
* Sunset state for a placed block: the block type itself (via `config.sunset`)
199199
* or its selected model. `legacy` (amber) is superseded-but-supported and needs
200200
* a resolvable successor; `deprecated` (red) is no longer supported and badges
201-
* with or without one. `null` when neither applies or in diff mode.
201+
* with or without one. `null` when neither applies.
202202
*/
203-
function getBlockSunset(
204-
config: BlockConfig,
205-
name: string,
206-
model: unknown,
207-
isDiffMode: boolean
208-
): BlockSunset | null {
209-
if (isDiffMode) return null
210-
203+
function getBlockSunset(config: BlockConfig, name: string, model: unknown): BlockSunset | null {
211204
const sunset = config.sunset
212205
if (sunset) {
213206
const target = sunset.replacedBy ? getBlock(sunset.replacedBy) : undefined
@@ -671,13 +664,7 @@ export const WorkflowBlock = memo(function WorkflowBlock({
671664
const currentBlock = currentWorkflow.getBlockById(id)
672665

673666
const { horizontalHandles, blockHeight, blockWidth, displayAdvancedMode, displayTriggerMode } =
674-
useBlockProperties(
675-
id,
676-
currentWorkflow.isDiffMode,
677-
data.isPreview ?? false,
678-
data.blockState,
679-
currentWorkflow.blocks
680-
)
667+
useBlockProperties(id, data.isPreview ?? false, data.blockState)
681668

682669
const {
683670
isWebhookConfigured,
@@ -817,7 +804,7 @@ export const WorkflowBlock = memo(function WorkflowBlock({
817804

818805
const posthog = usePostHog()
819806

820-
const sunset = getBlockSunset(config, name, blockSubBlockValues.model, currentWorkflow.isDiffMode)
807+
const sunset = getBlockSunset(config, name, blockSubBlockValues.model)
821808

822809
const onFixSunset = () => {
823810
if (!sunset) return
@@ -936,7 +923,6 @@ export const WorkflowBlock = memo(function WorkflowBlock({
936923
displayTriggerMode,
937924
data.isPreview,
938925
data.subBlockValues,
939-
currentWorkflow.isDiffMode,
940926
currentBlock,
941927
canonicalModeOverrides,
942928
canEditWorkflow,

0 commit comments

Comments
 (0)