Repository navigation
Fix duplicate node ids when adding Bots to one Parallel step - #2665
Merged
Merged
Conversation
CreateModal.add numbered a new node by layer count, but a Parallel step joins the last layer and never grows it, so a third Add a Bot reused the second Bot's id and the host refused the whole graph. Allocate over the flat node list with the same nextNodeId helper the canvas drop path uses. Refs #2663 Docs-not-needed: node-id allocation fix in the New workflow dialog, no architecture change (#2663)
Collaborator
Author
|
Verdict: PASS at cae6bd0 Ran at this tip: The three runs above are, in order: the tip as pushed (green, 177/177); the tip with only the Review points:
|
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.
Written-by: Dev
Fixes #2663
Owner: Dev
Reviewer: Reviewer
Docs-not-needed: node-id allocation fix in the New workflow dialog, no architecture change (#2663)
What changed
CreateModal.addinplugins/workflow/client.jsallocated a new node's id from the layer count (n${list.length + 1}). A Parallel step joins the last layer, so the count stops growing and the third Add a Bot producedn2again;validateGraphinplugins/workflow/src/graph.jsthen refused the whole Create withNode n2 is listed twice.The id now comes from
nextNodeId(list.flat()), the same collision-aware helper the canvas drop path already uses atclient.js:1232. One call site changes:nextNodeIditself, the canvas drop path andgraph.jsare untouched.Tests in
plugins/workflow/test/client.test.jsdrive the real dialog through the hook renderer: under Parallel, three Add a Bot clicks produce three distinct ids, one flat layer, and a graphvalidateGraphaccepts; with Parallel unticked the ids stayn1,n2,n3with one layer each.Changelog:
changelog.d/2663-parallel-node-id.fixed.md.Verification
Red first — source reverted to
mainwith the new tests kept:not ok 136 … three Bots in one Parallel step got n1,n2,n2,# pass 176 / fail 1.Ran at this tip:
cae6bd0c0e27095d1914ed8752e5f0db9c0c8388(tarball of that commit, byte-identical to the working copy for the three changed paths).Result: 177 tests, 177 pass, 0 fail, including both #2663 cases (136 and 137).
Not run:
npm run verifyand the full plugin suite — the brief says not to run it while other work is in parallel, and this diff touches one test file.node .github/scripts/changelog.mjs checkran in the implementation step and parsed the fragments; not re-run here.Checkpoint
{ "pr": 2665, "claim": "Dev", "issue": 2663, "summary": "CreateModal.add numbered each new node from the layer count, so a third Bot added to a Parallel step reused the second Bot's id and Create failed with `Node n2 is listed twice`. It now allocates over the flat node list with nextNodeId, the same helper the canvas drop path uses. Two tests drive the real dialog: Parallel gives three distinct ids that validateGraph accepts, and the sequential path still numbers n1, n2, n3. The change is confined to this dialog; nextNodeId, the canvas drop path and graph.js are untouched.", "files": [ "plugins/workflow/client.js", "plugins/workflow/test/client.test.js", "changelog.d/2663-parallel-node-id.fixed.md" ], "checks": { "ran": "cd plugins/workflow && TZ=UTC node --import ./test/resolve.mjs --test test/client.test.js", "result": "green", "at": "cae6bd0c0e27095d1914ed8752e5f0db9c0c8388" }, "next": "none — ready for review" }