Repository navigation
Improve time complexity of identity node removal - #4625
Conversation
b3f3bdb to
f72edce
Compare
There was a problem hiding this comment.
Review completed against the latest diff
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
09109a0 to
425f0f5
Compare
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Confidence score: 3/5
- In
node-graph/graph-craft/src/document.rs, nested pruning can leave a removed edge in a live upstream node’s dependant list, making graph dependency state inconsistent; rebuild the cache after pruning, clearing its buckets before repopulating them.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="node-graph/graph-craft/src/document.rs">
<violation number="1" location="node-graph/graph-craft/src/document.rs:884">
P2: Nested pruning can remove an input from a live network node, but this cleanup leaves the removed edge in the live upstream node’s dependant list. Rebuild the cache after input pruning by clearing the buckets and calling `populate_dependants`, rather than filtering only deleted node IDs.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| // Remove references to nodes that have been deleted | ||
| for node in self.nodes.values_mut() { | ||
| for dependants in &mut node.original_location.dependants { | ||
| dependants.retain(|dependant| !old_nodes.contains_key(dependant)); |
There was a problem hiding this comment.
P2: Nested pruning can remove an input from a live network node, but this cleanup leaves the removed edge in the live upstream node’s dependant list. Rebuild the cache after input pruning by clearing the buckets and calling populate_dependants, rather than filtering only deleted node IDs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-craft/src/document.rs, line 884:
<comment>Nested pruning can remove an input from a live network node, but this cleanup leaves the removed edge in the live upstream node’s dependant list. Rebuild the cache after input pruning by clearing the buckets and calling `populate_dependants`, rather than filtering only deleted node IDs.</comment>
<file context>
@@ -878,13 +878,12 @@ impl NodeNetwork {
for node in self.nodes.values_mut() {
for dependants in &mut node.original_location.dependants {
- dependants.clear();
+ dependants.retain(|dependant| !old_nodes.contains_key(dependant));
}
}
</file context>
There was a problem hiding this comment.
Nested pruning can remove an input from a live network node
Hopefully not…
Head branch was pushed to by a user without write access
8af99aa to
de674d5
Compare
Improve time complexity of identity node removal (GraphiteEditor#4625)
Working towards #4572.
remove_passthrough_nodefrom O(n) to O(1) by using the cached list of dependants.OriginalLocationremove_passthrough_nodefunction works properly.