Skip to content

fix(merge_overlay): pass node object, not its name string, to merge_nodes#164

Open
SoundMatt wants to merge 1 commit into
COVESA:masterfrom
SoundMatt:fix/merge-overlay-wrong-arg-to-merge-nodes
Open

fix(merge_overlay): pass node object, not its name string, to merge_nodes#164
SoundMatt wants to merge 1 commit into
COVESA:masterfrom
SoundMatt:fix/merge-overlay-wrong-arg-to-merge-nodes

Conversation

@SoundMatt

Copy link
Copy Markdown

In merge_nodes, when recursing into a pair of nested dataclass fields the call was:

merged_value = merge_nodes(value1, name_only(value2))

name_only() returns a plain str (the node name stripped of any +/- prefix), so the second argument was never a dataclass. merge_nodes immediately short-circuits on not is_dataclass(node2) and returns node2 or node1 — meaning the overlay node was silently discarded every time. Fix by passing value2 directly.

The same else branch (scalar fields) also called name_only(value2) unconditionally, which corrupts non-string scalars such as int or bool. Guard it so name_only is only invoked when value2 is a str.

…_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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant