Fix Gradient tool inserting new nodes in the wrong position when updating a Fill node's gradient chain#4203
Conversation
…ting a Fill node's gradient chain
There was a problem hiding this comment.
Code Review
This pull request introduces a new helper method insert_node_before_input to simplify and improve node splicing on wires feeding input connectors, especially for unencapsulated secondary-input branches where the upstream branch needs to be shifted to make room. A test was also added to verify this behavior. The review feedback highlights a potential issue where shared upstream nodes could be shifted multiple times due to a lack of deduplication in upstream_flow_back_from_nodes, and suggests querying node positions before mutating the network to ensure safety.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
2 issues found across 3 files
Confidence score: 3/5
- There is a concrete regression risk in
editor/src/messages/portfolio/document/utility_types/network_interface.rs:insert_node_before_inputmay rewire a downstream input even when the inserted node lacks input 0, which can break the splice and drop the upstream connection. upstream_flow_back_from_nodesineditor/src/messages/portfolio/document/utility_types/network_interface.rsmay emit duplicateNodeIds in shared/diamond subgraphs, which can lead to incorrect or repeated downstream processing behavior.- The score is 3 because both findings are user-impacting graph wiring/traversal issues with moderate-to-high severity and good confidence, so this is not a low-risk merge until addressed.
- Pay close attention to
editor/src/messages/portfolio/document/utility_types/network_interface.rs- node rewiring and upstream traversal may mis-handle missing input 0 and shared-path deduplication.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Fixes a bug/limitation of #4177.