Skip to content

fix(deploy): resolve the error-output flag from edges on both sides of change detection - #6754

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/deploy-change-detection-rvt
Aug 16, 2026
Merged

fix(deploy): resolve the error-output flag from edges on both sides of change detection#6754
waleedlatif1 merged 2 commits into
stagingfrom
fix/deploy-change-detection-rvt

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • A block can hold errorEnabled: false while an error edge still leaves it — setBlockErrorEnabled doesn't remove existing error edges, both block renderers draw the port on errorEnabled || hasErrorConnection, and the executor never reads the flag at all (the edge alone decides routing). The two spellings are one state.
  • Only the deployed side reconciled them: materializeDeploymentState backfills errorEnabled: true for any block with an error edge, while the live normalized tables are read verbatim. Change detection compared the raw flag and saw true against false for a block that hadn't changed.
  • No redeploy could clear it — deploying snapshots the live false, which the next read backfills straight back to true. The deploy button sat on "Update" permanently, and checkNeedsRedeployment (raw jsonb, skips the backfill) disagreed with the button.
  • Lifted the rule into @sim/workflow-types as collectErrorSourceBlockIds / resolveEffectiveErrorEnabled so the backfill and the comparison share one definition, and applied it to both sides of the diff. Compared outside the structural gate, since the flag can match while the edges disagree.

Type of Change

  • Bug fix

Testing

  • 3 regression tests in compare.test.ts; verified they go red when the fix is neutered
  • Full apps/sim suite: 25742 passed, 0 failed
  • bunx turbo run type-check (24 packages) and bun run check:audits (27 audits) clean
  • Confirmed against a real affected workflow: deployed snapshot and live normalized tables matched byte-for-byte across blocks, edges, loops, parallels and variables, so the only difference was the one-sided backfill

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

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 16, 2026 12:31am

Request Review

@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches deploy/change-detection logic for error routing, but the change aligns comparison with existing UI and executor behavior and is covered by targeted regression tests.

Overview
Fixes workflows stuck on Update when a block has errorEnabled: false but still has a connected error edge — a state the UI and executor already treat as “error output on.”

Shared rule in @sim/workflow-types: collectErrorSourceBlockIds and resolveEffectiveErrorEnabled treat the flag and error edges as one state (flag or error edge ⇒ on).

Change detection now uses that rule on both live and deployed snapshots when comparing errorEnabled, instead of only backfilling the deployed side in materializeDeploymentState. That one-sided compare made redeploy snapshot the live false, which the next read backfilled to true again.

Regression tests cover flag-only vs edge-backed cases in compare.test.ts.

Reviewed by Cursor Bugbot for commit af0fb83. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes error-output change detection resolve the effective state from both the block flag and outgoing error edges, sharing that logic with deployment materialization.

  • Adds shared helpers for collecting error-edge sources and resolving effective error-output state.
  • Applies the effective state symmetrically during workflow comparison.
  • Adds regression coverage for stale false flags with live error edges.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/workflows/comparison/compare.ts Compares effective error-output state outside the structural block gate and contains the requested documentation-comment fix.
apps/sim/lib/workflows/persistence/utils.ts Reuses the shared error-source collector while preserving deployment-state backfilling.
packages/workflow-types/src/workflow.ts Introduces shared canonical helpers for interpreting error edges and effective error-output state.
apps/sim/lib/workflows/comparison/compare.test.ts Adds regression tests covering symmetric edge-derived state and genuine flag-only changes.

Reviews (2): Last reviewed commit: "chore(deploy): use TSDoc for the error-o..." | Re-trigger Greptile

Comment thread apps/sim/lib/workflows/comparison/compare.ts Outdated
…f change detection

A block can hold `errorEnabled: false` while an error edge still leaves it.
`setBlockErrorEnabled` does not remove existing error edges, both block renderers
draw the port on `errorEnabled || hasErrorConnection`, and the executor never
reads the flag at all — the edge alone decides routing. So the two spellings are
one state, and nothing about the block has functionally changed.

Only the deployed side reconciled them. `materializeDeploymentState` backfills
`errorEnabled: true` for any block with an error edge, while the live normalized
tables are read verbatim. Change detection compared the raw flag, saw `true`
against `false` for a block that had not changed, and no redeploy could clear it:
deploying snapshots the live `false`, which the next read backfills straight back
to `true`. The deploy button sat on "Update" permanently, and the server path
(`checkNeedsRedeployment`, which reads the raw jsonb and skips the backfill)
disagreed with it.

Lift the rule into `@sim/workflow-types` as `collectErrorSourceBlockIds` /
`resolveEffectiveErrorEnabled` so the backfill and the comparison share one
definition, and apply it to both sides of the diff. Compared outside the
structural gate, since the flag can match while the edges disagree.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit af0fb83. Configure here.

@waleedlatif1
waleedlatif1 merged commit 4f722c6 into staging Aug 16, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/deploy-change-detection-rvt branch August 16, 2026 00:48
Sign up for free to 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