Skip to content

Fix: Insertion Order During Lattice Expansion#19

Open
ax3l wants to merge 1 commit intomainfrom
fix-insert-order
Open

Fix: Insertion Order During Lattice Expansion#19
ax3l wants to merge 1 commit intomainfrom
fix-insert-order

Conversation

@ax3l
Copy link
Copy Markdown
Member

@ax3l ax3l commented Apr 2, 2026

In src/yaml_c_wrapper.cpp the expand_internal() function was creating a brand new empty YAML::Node(Map) and re-inserting all entries from a cloned map. This unnecessary reconstruction could lose insertion order because re-inserting keys by string into a fresh node goes through yaml-cpp's map lookup path, which doesn't guarantee the same ordering as the source.

The fix modifies map values in-place on the already-cloned new_map node instead of rebuilding a new map, preserving yaml-cpp's internal insertion order throughout lattice expansion.

Fix #18

In `src/yaml_c_wrapper.cpp` the `expand_internal()` function was
creating a brand new empty `YAML::Node(Map)` and re-inserting all
entries from a cloned map. This unnecessary reconstruction could
lose insertion order because re-inserting keys by string into a
fresh node goes through `yaml-cpp`'s map lookup path, which doesn't
guarantee the same ordering as the source.

The fix modifies map values in-place on the already-cloned `new_map`
node instead of rebuilding a new map, preserving `yaml-cpp`'s
internal insertion order throughout lattice expansion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Preserve Insertion Order

1 participant