Repository navigation
fix(workflows): keep condition and router branch connections when an edit re-sends the branches - #10307
Merged
Conversation
…edit re-sends the branches An operations edit that re-sent a condition's conditions or a router's routes reassigned every row id by position (<blockId>-if, -else-if-N, -else, -routeN). Rows the canvas added have ids like <blockId>-else-if-<timestamp>, and stored edges name rows as condition-<id> / router-<id>, so the edit left those edges naming no row: the branch matched at run time but routed nowhere. After a canvas reorder the renamed ids could also attach an edge to another branch's expression. Re-sent rows now keep the stored id of the same branch: the stored row with the same expression first, then the row in the same slot. New rows get the canonical id, or a fresh one when a stored row holds it. Edges from rows the edit removed are dropped in the same mutation.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge; no new actionable issues remain. SummaryKeeps stored branch IDs when edits re-send condition or router rows, and removes edges for deleted rows.
Reviews (2) · Last reviewed commit: "fix(workflows): reserve unchanged branch..." · Reviewed by Greptile |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…ndles, reject malformed condition rows - An unchanged row (same slot, same expression) keeps its id before any row is matched by expression, so editing a branch to repeat a later branch's expression no longer takes that branch's id and connection. - Condition and router handle resolution gives a row's own condition-<id> / router-<id> handle priority over another row's title or position alias, which can spell the same string after a reorder. - A condition row that is not an object is refused as invalid input instead of crashing the lint pass.
Collaborator
Author
Collaborator
Author
|
@cubic-dev-ai review |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This was referenced Nov 22, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
An operations edit (v2 operations API, Copilot
edit_workflow) that re-sends a condition block'sconditionsor a router'sroutes, for example to change one expression, disconnected branches the canvas had added. The canvas mints row ids like<blockId>-else-if-<timestamp>, and their edges are stored ascondition-<rowId>. After the edit, the stored edge named no row. The branch still matched at run time but routed nowhere, because the executor follows onlycondition-<selectedOption>. After a canvas reorder, the edit could also move an edge onto a different branch's expression.Root cause
normalizeConditionRouterIdsreassigned every row id by position (-if,-else-if-N,-else,-routeN) on every edit and never looked at the stored rows or edges. Persistence keeps the stale edge as it is.Fix
An edit that re-sends the branch list now keeps each branch's stored id. It first matches the stored row with the same expression, which covers branches inserted, removed or reordered around it. Otherwise it takes the stored row in the same slot (
if/else-if-k/else/route-k, the positional handles that ops connections use). New rows get the canonical id, or a fresh one if a stored row already holds it. Edges from rows the edit removed are dropped in the same mutation. Adding a new block is unchanged.Tests
apply-workflow-operations-branches.integration.tsruns against real Postgres throughapplyWorkflowOperationsand reads the result back from the normalized tables. It covers:All 7 fail on staging. Reverting each guard on its own (keep by slot, keep by expression, drop removed-row edges, id collision) turns at least one test red.