fix(merge_overlay): pass node object, not its name string, to merge_nodes#164
Open
SoundMatt wants to merge 1 commit into
Open
fix(merge_overlay): pass node object, not its name string, to merge_nodes#164SoundMatt wants to merge 1 commit into
SoundMatt wants to merge 1 commit into
Conversation
…_nodes
In `merge_nodes`, when both `value1` and `value2` are dataclasses, the
recursive call was:
merge_nodes(value1, name_only(value2))
`name_only()` returns a plain string (the node name with any +/- prefix
stripped), so the second argument to `merge_nodes` was a `str` instead
of a dataclass node. The first guard in `merge_nodes` checks
`is_dataclass()`, which is False for a string, so the node pair was
never merged — value2 was silently discarded and replaced by value1.
Fix by passing `value2` directly.
The same function's `else` branch (scalar fields) also called
`name_only(value2)` unconditionally, which would corrupt any non-string
scalar (int, bool, …). Guard it so `name_only` is only called when
value2 is a string.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
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.
In
merge_nodes, when recursing into a pair of nested dataclass fields the call was:name_only()returns a plainstr(the node name stripped of any+/-prefix), so the second argument was never a dataclass.merge_nodesimmediately short-circuits onnot is_dataclass(node2)and returnsnode2 or node1— meaning the overlay node was silently discarded every time. Fix by passingvalue2directly.The same
elsebranch (scalar fields) also calledname_only(value2)unconditionally, which corrupts non-string scalars such asintorbool. Guard it soname_onlyis only invoked whenvalue2is astr.