-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary Expressions deleted by live runner make their first input symbols null. #10512
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mjkkirschner I didn't realize this was submitted only in 2.0 but you're right, this is the breaking change. Good find!
The reason why only the UI nodes (for logic operators) cause the issue and not the &&
or ||
node (neither the operators used in a CBN), is because in the latter cases, the expression is actually a function call (in order to support replication) and in the case of the UI nodes, we are specifically building a binary expression AST:
AstFactory.BuildBinaryExpression(node, current, _op))) |
For the same reason, replication doesn't work for
And
and Or
UI nodes as we are not building function call ASTs. I can therefore think of a couple of ways to solve this:
- Change the
BuildOutputAST
method to generate function calls for the logic UI nodes instead of binary exp. ASTs. Doing this will fix this issue and also enable replication to work for these nodes thereby making them consistent with the other ways of using these operators. - Revert @ke-yu's change to walk the AST in
BuildNullAssignments
- in other words, just assign the top-level expression tonull
OR - Leave
BuildNullAssignments
as it is, just add a check here to specifically check if the binary exp. AST is an assignment - meaning assign it tonull
only if it is an assignment expression, not otherwise.
ignore all expressions which are not assigments in the nullifyBinaryExpression code
@aparajit-pratap please take another look, went with your third suggestion and added 2 tests. I still need to run the self serve to see if it breaks anything. |
@aparajit-pratap |
Curious, what did you think about making the UI logic nodes support replication? |
@@ -982,7 +983,7 @@ private List<BinaryExpressionNode> BuildNullAssignments(List<AssociativeNode> as | |||
} | |||
|
|||
IdentifierNode leftNode = bNode.LeftNode as IdentifierNode; | |||
if (leftNode == null || leftNode.ArrayDimensions != null) | |||
if (leftNode == null || leftNode.ArrayDimensions != null || bNode.Optr != Operator.assign) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but why not have this check on line 980?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, that seems like a more appropriate place, where the binary node is validated, I can move it.
I thought that could get very difficult because the ZT versions only support two inputs and the UI ones support more than 2 - so I believe we'd end up doing binary expressions anyway - we could do both though? This fix and also the change to UI nodes? |
@@ -852,6 +852,93 @@ public void GraphILTest_DeletedNode01() | |||
|
|||
} | |||
|
|||
[Test] | |||
public void GraphILTest_DeletedBinaryExpresionDoesNotEffectReferences() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Effectively this test is simulating the same thing that would happen in the Dynamo UI when running the graph, deleting the node, and rerunning it or is it testing something additionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simulating the same thing as in the UI - I verified it failed before this change.
Probably that's something to think about for later, add to the backlog maybe? For now, I think this fix looks good. |
@aparajit-pratap the self serve and parallel tests all pass, gonna merge this in. |
Purpose
When a binary expression is deleted by the live runner - the binary AST is walked and all binary expressions within that subtree are assigned to null...
the change was from:
#7282
The behavior before this PR was that top level binary expressions were assigned to null and no AST walking was done.
I'm guessing @ke-yu was trying to support multiple assignments like:
a = 3;
b = a;
all being set to null.
but the consequence was other binary expressions like
a && b
end up resulting in thisa = null
I'm opening this PR for feedback because I'm not clear on what binary expressions should actually be set to null, only assignments? Right now I am only stopping
OR
andAND
- since that effects this particular bug, but I don't think thats the whole story.all good.
still good!
Declarations
Check these if you believe they are true
*.resx
files