Open
SEP-1727: Guard deep_dict_update against self-merge to prevent list doubling#1359
Conversation
…oubling Co-authored-by: yyyyyyyan <24644216+yyyyyyyan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] SEP-1727: Fix doubling of lists in base settings profile
SEP-1727: Guard deep_dict_update against self-merge to prevent list doubling
Aug 18, 2026
yyyyyyyan
marked this pull request as ready for review
August 18, 2026 02:07
yyyyyyyan
requested review from
marcuscruz-percona and
peter-o-addo
as code owners
August 18, 2026 02:07
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a configuration-loading edge case where YamlPrefixConfigSettingsSource can pass the same dict as both operands to deep_dict_update, causing list-valued leaves to be concatenated with themselves (doubling entries) and potentially preventing SEPSettings construction.
Changes:
- Add an identity (
is) guard todeep_dict_updateto make self-merges a no-op. - Add a unit test ensuring
deep_dict_update(d, d)does not double lists. - Add a config-source regression test ensuring selecting the base YAML profile does not double list values.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| app/core/utils/dict.py | Adds a self-merge guard to prevent list doubling during recursive merges. |
| tests/app/core/utils/test_dict.py | Adds regression coverage for self-merge behavior in deep_dict_update. |
| tests/app/core/test_config.py | Adds regression coverage for base-profile selection in YamlPrefixConfigSettingsSource and exercises list handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…cstring Co-authored-by: yyyyyyyan <24644216+yyyyyyyan@users.noreply.github.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||
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.
When the selected YAML profile is the base profile,
YamlPrefixConfigSettingsSourcepasses the same dict object as both operands todeep_dict_update. Every list-valued leaf is concatenated with itself, doubling entries. Againstsidecar/settings.yamlthis preventsSEPSettingsfrom constructing at all (duplicate resolution step validation error).Changes
app/core/utils/dict.py: Addedisidentity guard at the top ofdeep_dict_update. When both operands are the same object, the merge is a no-op — correct because every branch (scalar reassign, dict recurse, list concat) is already idempotent except list concat. The guard runs on each recursive step, so nested YAML anchors shared between two otherwise-distinct profiles are also covered.tests/app/core/utils/test_dict.py: Addedtest_deep_dict_update_self_merge_is_noop— passes the same dict as both arguments and asserts lists are not doubled.tests/app/core/test_config.py: Addedtest_yaml_prefix_config_settings_source_base_profile— selects the base profile throughYamlPrefixConfigSettingsSourceand asserts the resulting data matches the declared block exactly. Added a list field to themock_yaml_datafixture to exercise the doubling path.