fix: report the full key path in MergeStrict type-mismatch error#418
Merged
Conversation
mergeStrict computes newFullKey (the full dotted path to the current key) and
uses it for the recursive call, but the type-mismatch error reported the
parent fullKey instead. A top-level conflict therefore showed an empty key
name ("incorrect types at key , ...") and a nested conflict dropped the
leaf key. Use newFullKey so the error names the actual conflicting key.
Maks1mS
pushed a commit
to stplr-dev/stplr
that referenced
this pull request
May 30, 2026
This PR contains the following updates: | Package | Type | Update | Change | OpenSSF | |---|---|---|---|---| | [github.com/knadh/koanf/v2](https://github.com/knadh/koanf) | require | patch | `v2.3.4` → `v2.3.5` | [](https://securityscorecards.dev/viewer/?uri=github.com/knadh/koanf) | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/23) for more information. --- ### Release Notes <details> <summary>knadh/koanf (github.com/knadh/koanf/v2)</summary> ### [`v2.3.5`](https://github.com/knadh/koanf/releases/tag/v2.3.5) [Compare Source](knadh/koanf@v2.3.4...v2.3.5) #### What's Changed - go-toml v3.3.0 by [@​GreyXor](https://github.com/GreyXor) in [#​410](knadh/koanf#410) - Bump github.com/go-jose/go-jose/v4 from 4.1.0 to 4.1.4 in /providers/vault by [@​dependabot](https://github.com/dependabot)\[bot] in [#​411](knadh/koanf#411) - go-toml v2.3.1 by [@​GreyXor](https://github.com/GreyXor) in [#​414](knadh/koanf#414) - feat: Add k8smount provider by [@​mattdowdell](https://github.com/mattdowdell) in [#​409](knadh/koanf#409) - Bools: return the matched \[]bool, not the nil intermediate by [@​c-tonneslan](https://github.com/c-tonneslan) in [#​416](knadh/koanf#416) - fix: report the full key path in MergeStrict type-mismatch error by [@​koriyoshi2041](https://github.com/koriyoshi2041) in [#​418](knadh/koanf#418) #### New Contributors - [@​mattdowdell](https://github.com/mattdowdell) made their first contribution in [#​409](knadh/koanf#409) - [@​c-tonneslan](https://github.com/c-tonneslan) made their first contribution in [#​416](knadh/koanf#416) - [@​koriyoshi2041](https://github.com/koriyoshi2041) made their first contribution in [#​418](knadh/koanf#418) **Full Changelog**: <knadh/koanf@v2.3.4...v2.3.5> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday (`* 0-4,22-23 * * 1-5`) - Only on Sunday and Saturday (`* * * * 0,6`) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xOTUuMyIsInVwZGF0ZWRJblZlciI6IjQzLjE5NS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY2llcyJdfQ==--> Reviewed-on: https://altlinux.space/stapler/stplr/pulls/445
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.
mergeStrict(maps/maps.go) buildsnewFullKey, the full dotted path to the key currently being merged, and passes it to the recursive call. But the type-mismatch error reports the parentfullKeyinstead:So the error names the wrong key:
fullKey == "", producingincorrect types at key , type int != string(blank key name).parent.childinstead ofparent.child.key.This is reachable from public API via
MergeStrictandKoanf.LoadwithConf{StrictMerge: true}. The fix usesnewFullKey, matching what the recursive call already uses.Added
TestMergeStrictErrorKeyintests/maps_test.goasserting the error names the full path for both a top-level and a nested conflict (the existingTestMergeStrictonly checked that an error occurred, not its contents).go testpasses.