parts: raise error when duplicate keys are used
Metadata
Current evaluation
Merged. Refactored YAML loading into a new yaml_utils module and forward-ported safe loading to raise errors for duplicate keys in parts configuration. Approved by reviewer and passed CI.
Suggested action: —
No scores available.
Issue body
- Move yaml loading to a new module in the part package: yaml_utils
- Forward port the safe loading implementation from legacy
LP: #1942217
Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh tests/unit`?
-----
CRAFT-829
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Refactored YAML loading into a new yaml_utils module and forward-ported safe loading to raise errors for duplicate keys in parts configuration. Approved by reviewer and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Refactors YAML loading into a new yaml_utils module within the part package, forward-porting safe loading from legacy to raise errors on duplicate keys. Addresses LP: #1942217 and CRAFT-829, with a related test fix in PR #3670. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Raises an error for duplicate YAML keys in parts by moving loading logic to a new yaml_utils module and forward-porting safe loading from legacy code. Addresses LP #1942217 and CRAFT-829. Related test fixes were applied in PR #3670. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #807 Fix parts integration tests | snapcraft | merged | Merged a fix for parts integration tests failing due to YAML dictionary ordering differences. Tests now load and compare dictionaries directly instead of relying on serialized output order. Approved by two reviewers and passed CI. | |
| #4342 refactor(parts): separate yaml parsing from base errors | snapcraft | merged | Merged into main after passing CI and receiving two approvals. The refactor separates YAML parsing from base errors to allow base validation without raising exceptions. No functional changes were made, and coverage increased by 0.01%. | |
| #2065 many: update the yaml loading logic | snapcraft | merged | Merged after approval and CI checks, updating YAML loading to use safe loading where possible and resolving issue #2033. | |
| #2781 yaml_utils: move _load_yaml from project for re-use (and add tests) | snapcraft | merged | Merged. Moved _load_yaml to yaml_utils as load_yaml_file, added tests, and improved error handling to raise YamlValidationError. Approved, passed CI, and changed 3 files. Logic will be reused for snapcraft config files. |