[dmt] validate duplicate yaml keys#432
Open
diyliv wants to merge 3 commits into
Open
Conversation
diyliv
marked this pull request as draft
July 17, 2026 09:20
diyliv
force-pushed
the
fix/module-yaml-strict-unmarshal
branch
3 times, most recently
from
July 17, 2026 09:28
ced7d3a to
db80f03
Compare
Signed-off-by: diyliv <onlogn081@gmail.com>
diyliv
force-pushed
the
fix/module-yaml-strict-unmarshal
branch
from
July 17, 2026 09:31
db80f03 to
415b084
Compare
Signed-off-by: diyliv <onlogn081@gmail.com>
diyliv
marked this pull request as ready for review
July 17, 2026 09:44
diyliv
marked this pull request as draft
July 17, 2026 14:03
Signed-off-by: diyliv <onlogn081@gmail.com>
diyliv
marked this pull request as ready for review
July 19, 2026 11:48
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.
Summary
yaml.UnmarshalStrictformodule.yamlandChart.yamlparsing: replacesyaml.Unmarshalwithyaml.UnmarshalStrictinCheckDefinitionFile(linter rule),ParseModuleConfigFile, andParseChartFile.TestCheckDefinitionFile_DuplicateKeysreproduces the real bug wheredescriptions.enwas defined twice.pkg/linters/module/rules/module_yaml.go,internal/module/module.go,pkg/linters/module/rules/module_yaml_test.goContext
module.yamlwith duplicate keys (e.g.en:defined twice underdescriptions:) silently passed DMT validation becauseyaml.Unmarshaldrops duplicates by taking the last value. However, the Deckhouse controller uses strict parsing and crashes at runtime:{"level":"error","msg":"run","error":"start deckhouse controller: ... parse module definition ... yaml: unmarshal errors:\n line 5: mapping key \"en\" already defined at line 4"}sigs.k8s.io/yamlUnmarshalStrictwas already used elsewhere in the codebase (controller rendering, openapi parsing, values, oss.yaml) but not formodule.yaml. This aligns the parsing to strict everywhere.Example
Before (duplicate keys silently accepted):
→ dmt lint passes ✗
After (duplicate keys caught):
→ dmt lint fails ✓