DYN-10693: Keep the FunctionNotFound warning across Code Block Node edits - #17267
Open
RobertGlobant20 wants to merge 1 commit into
Open
DYN-10693: Keep the FunctionNotFound warning across Code Block Node edits#17267RobertGlobant20 wants to merge 1 commit into
RobertGlobant20 wants to merge 1 commit into
Conversation
The DYN-10693 fix reported unresolved calls inside a code block node function body only on the graph-open path, which runs the two-pass compile and drains the deferred-resolution buffer. Editing a code block node instead recompiles it in a single pass, and there the warning was lost for a different reason. A code block node's previously compiled definitions stay active on the shared precompilation core, so re-appending them is rejected as a redefinition. Code generation then logs FunctionAlreadyDefined - which code block nodes deliberately filter out - and marks the definition skipMe, so DfsTraverse never walks the body. Every diagnostic inside the body is silently dropped, and because ProcessCodeDirect has already cleared the node's errors and warnings, the warning shown when the graph was opened simply vanished on any edit. Deactivate the node's own definitions before recompiling so ProcedureTable.Append replaces the stale entry instead of rejecting it. The body is compiled again and its warnings are reported. This mirrors what LiveRunner.UndefineFunctions already does for redefined subtrees. Also guard UndefineFunctionDefinitions against a null ParseParam, which is the state on a node's first compile. Adds regression coverage for the edit path: an unresolved call inside a function body keeps warning after an edit, and a forward reference within the same code block node still does not warn after an edit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10693
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a long-standing Code Block Node (CBN) recompilation issue where diagnostics inside redefined function bodies (notably FunctionNotFound) could disappear after editing the CBN, due to the node’s prior function definitions remaining active in the shared precompilation core.
Changes:
- Deactivate a CBN’s previously registered function definitions before recompiling its edited code, so function bodies are traversed again and their diagnostics are preserved.
- Add a null-guard in
UndefineFunctionDefinitionsfor first-compile scenarios whereParseParam/ParsedNodesmay not be available. - Add regression tests ensuring warnings persist across edits and valid forward references do not start warning after edits.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/DynamoCoreTests/CodeBlockNodeTests.cs | Adds regression coverage for warning persistence across CBN edits and for forward-reference non-warning behavior after edits. |
| src/DynamoCore/Graph/Nodes/CodeBlockNode.cs | Ensures prior CBN function definitions are deactivated before recompilation to avoid “skipMe” codegen paths dropping diagnostics; adds null guard for ParseParam. |
|
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.




Purpose
Follow-up fix for DYN-10693, reported by Neal Burnham during testing of #17224 on 4.3.0.5770:
#17224 only covered the graph-open path. Opening a graph runs the two-pass compile (
ReCompileCodeBlockNodesForFunctionDefinitions), and the deferred re-check inRecompileCodeBlockASTemits the warning correctly. Editing a Code Block Node recompiles it in a single pass, where the warning was lost for a different — and older — reason that #17224 made visible.Root cause
A Code Block Node's previously compiled
defis still active in the shared precompilation core when the node is recompiled after an edit:ProcedureTable.Appendfinds an active duplicate and returnskInvalidIndex.FunctionAlreadyDefinedand setsfuncDef.skipMe = true(ProtoAssociative/CodeGen.cs:3785).FunctionAlreadyDefinedis deliberately filtered out of Code Block Node warnings (CodeBlockNode.cs:870), so nothing is surfaced.DfsTraversereturns early onskipMe(ProtoAssociative/CodeGen.cs:6050), so the function body is never traversed — the unresolved call inside it is never visited and noFunctionNotFoundis raised.ProcessCodeDirecthas already calledClearErrorsAndWarnings(), so the warning shown at graph open simply disappears.This is not specific to
FunctionNotFound: any diagnostic inside a redefined function body was being dropped on recompile.Fix
Deactivate the node's own definitions in
ProcessCodebefore recompiling, soProcedureTable.Appendtakes its!existingProcNode.IsActivebranch and replaces the stale entry in place. The body is compiled again and its warnings are reported. This mirrors whatLiveRunner.UndefineFunctionsalready does for redefined subtrees.Also guards
UndefineFunctionDefinitionsagainst a nullParseParam, which is the state on a node's first compile.Behavior change worth a look during review: a Code Block Node that renames or deletes a
defnow leaves the old name genuinely undefined, instead of leaving a permanently-registered definition behind. That is more correct, but it does change what other Code Block Nodes resolve when they next recompile.Declarations
Check these if you believe they are true
No public API surface changes —
UndefineFunctionDefinitionsisinternaland already existed.Release Notes
Fixed an issue where the "Method not found" warning on a Code Block Node disappeared after the node was edited and the graph re-executed, leaving broken code silently returning null.
Reviewers
@jasonstratton (reviewed and merged #17224)
@edwin-vasquez-ucaldas
Notes for testers — the repro is the same as DYN-10693, with an extra step:
defbody, e.g.def tostr(x) { return = ToString(x); }; tostr(3.1415);Also worth confirming that valid forward references still do not warn after an edit, both within one Code Block Node and across two.
Testing performed
CodeBlockNodeTests:FunctionCall_KeepsWarning_WhenCodeBlockIsEditedAfterUnresolvedCallInBodyandFunctionCall_NoWarning_WhenForwardReferenceInSameCodeBlockIsEdited.FunctionCall_*/ImperativeFunctionCall_*tests pass, plus the fullCodeBlockNodeTestsfixture (79 tests) andCodeBlockNodeTests2/DynamoDefects/CallsiteTests/CoreTests(109 tests).Name~Function|Cbn|CodeBlocksweep surfaced 4 failures (UsingFunctionObject01,UsingFunctionObject02,TestMigration_Core_Functions,ImperativeArrayIndexingInCodeBlockToCode). These were verified to fail identically on cleanmasterwith this change stashed, so they are pre-existing and unrelated.FYIs
Neal Burnham (reported the regression in testing)
🤖 Generated with Claude Code