diff --git a/apps/sim/lib/workflows/comparison/compare.test.ts b/apps/sim/lib/workflows/comparison/compare.test.ts index d78be67c55..c7a36cf4b0 100644 --- a/apps/sim/lib/workflows/comparison/compare.test.ts +++ b/apps/sim/lib/workflows/comparison/compare.test.ts @@ -388,6 +388,33 @@ describe('hasWorkflowChanged', () => { }) }) + /** + * The flag lived in `data` before it had a column. `0287` moves it, but a migration + * only reaches the live tables — every deployment version already written is frozen + * jsonb that keeps the old key, and the wire schema no longer declares it, so Zod + * strips it from the live side. Compared, that read as a change no deploy could + * resolve: the next snapshot came from rows that still carried it. + */ + describe('Legacy error flag in block data', () => { + const withData = (data: Record) => + createWorkflowState({ blocks: { block1: createBlock('block1', { data }) } }) + + it.concurrent('ignores the flag wherever the old key survives', () => { + expect(hasWorkflowChanged(withData({}), withData({ errorEnabled: false }))).toBe(false) + expect(hasWorkflowChanged(withData({}), withData({ errorEnabled: true }))).toBe(false) + }) + + it.concurrent('still compares everything else in data', () => { + expect( + hasWorkflowChanged( + withData({ errorEnabled: false }), + withData({ errorEnabled: false, parallelType: 'count' }) + ) + ).toBe(false) + expect(hasWorkflowChanged(withData({ batchSize: 1 }), withData({ batchSize: 2 }))).toBe(true) + }) + }) + describe('SubBlock Changes', () => { it.concurrent('should detect subBlock value changes (string)', () => { const state1 = createWorkflowState({ diff --git a/apps/sim/lib/workflows/comparison/normalize.ts b/apps/sim/lib/workflows/comparison/normalize.ts index 94a1ba0c17..ff31ca7a07 100644 --- a/apps/sim/lib/workflows/comparison/normalize.ts +++ b/apps/sim/lib/workflows/comparison/normalize.ts @@ -51,6 +51,18 @@ export const EXCLUDED_BLOCK_DATA_FIELDS: readonly string[] = [ // Parallel fields - duplicated in parallels state and/or subBlocks 'parallelType', // Duplicated in parallels state 'distribution', // Parallel distribution (derived during execution) + + /* + * Duplicated from the block's own `errorEnabled`. The flag briefly persisted + * here before it had a column, and `0287` moves it — but a migration only + * reaches the live tables. Every deployment version ever written is frozen + * jsonb that keeps the old key forever, and the wire schema no longer declares + * it, so Zod strips it from the live side while the snapshot side keeps it. + * Compared, that reads as a change no deploy can resolve: the next snapshot is + * taken from rows that still carry the key. The block field is compared on its + * own, with `!!`, so the value itself is not lost here. + */ + 'errorEnabled', ] as const /**