Skip to content

Commit 5ece9f9

Browse files
Vikhyath Mondreticlaude
andcommitted
fix(deploy): keep ignoring the error flag's old home in block data
Deploying never converged: the badge asked to redeploy again the moment it finished, forever. 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. The wire schema no longer declares it either, so Zod strips it from the live state on its way to the client. So the two sides of the check genuinely differ: live `data: {}` against a snapshot's `data: {errorEnabled: false}`, reported as `data.errorEnabled` changed. Deploying cannot fix that — the next snapshot is taken from rows that still carry the key. Confirmed against a real stuck workflow: 18 versions, both blocks reporting `data.errorEnabled`, and the same two states comparing equal with this restored. Removing the exclusion in 7934df7 assumed the migration could reach every copy of the value. It cannot reach a frozen snapshot, so the comparison has to keep tolerating the old key regardless of where it survives. The block field is still compared on its own, with `!!`, so the flag itself is not ignored. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 3c29476 commit 5ece9f9

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

‎apps/sim/lib/workflows/comparison/compare.test.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,33 @@ describe('hasWorkflowChanged', () => {
388388
})
389389
})
390390

391+
/**
392+
* The flag lived in `data` before it had a column. `0287` moves it, but a migration
393+
* only reaches the live tables — every deployment version already written is frozen
394+
* jsonb that keeps the old key, and the wire schema no longer declares it, so Zod
395+
* strips it from the live side. Compared, that read as a change no deploy could
396+
* resolve: the next snapshot came from rows that still carried it.
397+
*/
398+
describe('Legacy error flag in block data', () => {
399+
const withData = (data: Record<string, unknown>) =>
400+
createWorkflowState({ blocks: { block1: createBlock('block1', { data }) } })
401+
402+
it.concurrent('ignores the flag wherever the old key survives', () => {
403+
expect(hasWorkflowChanged(withData({}), withData({ errorEnabled: false }))).toBe(false)
404+
expect(hasWorkflowChanged(withData({}), withData({ errorEnabled: true }))).toBe(false)
405+
})
406+
407+
it.concurrent('still compares everything else in data', () => {
408+
expect(
409+
hasWorkflowChanged(
410+
withData({ errorEnabled: false }),
411+
withData({ errorEnabled: false, parallelType: 'count' })
412+
)
413+
).toBe(false)
414+
expect(hasWorkflowChanged(withData({ batchSize: 1 }), withData({ batchSize: 2 }))).toBe(true)
415+
})
416+
})
417+
391418
describe('SubBlock Changes', () => {
392419
it.concurrent('should detect subBlock value changes (string)', () => {
393420
const state1 = createWorkflowState({

‎apps/sim/lib/workflows/comparison/normalize.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ export const EXCLUDED_BLOCK_DATA_FIELDS: readonly string[] = [
5151
// Parallel fields - duplicated in parallels state and/or subBlocks
5252
'parallelType', // Duplicated in parallels state
5353
'distribution', // Parallel distribution (derived during execution)
54+
55+
/*
56+
* Duplicated from the block's own `errorEnabled`. The flag briefly persisted
57+
* here before it had a column, and `0287` moves it — but a migration only
58+
* reaches the live tables. Every deployment version ever written is frozen
59+
* jsonb that keeps the old key forever, and the wire schema no longer declares
60+
* it, so Zod strips it from the live side while the snapshot side keeps it.
61+
* Compared, that reads as a change no deploy can resolve: the next snapshot is
62+
* taken from rows that still carry the key. The block field is compared on its
63+
* own, with `!!`, so the value itself is not lost here.
64+
*/
65+
'errorEnabled',
5466
] as const
5567

5668
/**

0 commit comments

Comments
 (0)