sources: validate unknown source-type in yaml
Metadata
Current evaluation
Merged. Validates unknown source types in snapcraft.yaml using an enum. Updates the handler dictionary to raise a KeyError on invalid input instead of silently defaulting to Local. Approved by reviewer, passed CI, and achieved 100% diff coverage.
Suggested action: —
No scores available.
Issue body
Invalid source-type defaults to Local source (handler) and it doesn't print an error message
LP: [#1650943](https://bugs.launchpad.net/snapcraft/+bug/1650943)
I canceled previous PR cause I commited some changes using an incorrect email.
Based on the feedback provided on the canceled PR:
1. I added the list of valid source types in the snapcraft.yaml using an enum
2. I changed the way _source_handler dict is called, so we can get a KeyError if the source type is invalid for API users
3. I added the Local source type to the _source_handler dict, so it can be used as the default value
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Validates unknown source types in snapcraft.yaml using an enum. Updates the handler dictionary to raise a KeyError on invalid input instead of silently defaulting to Local. Approved by reviewer, passed CI, and achieved 100% diff coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Validates unknown source types in snapcraft.yaml, raising a KeyError instead of silently defaulting to Local. Introduces enum checks, sets Local as the explicit default, supersedes a prior PR, and achieves 100% diff coverage. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1276 sources: validate unknown source-type in yaml | snapcraft | closed | Closed without merging due to unresolved review comments and a failing CLA check caused by an email mismatch. The proposed validation for unknown source types in snapcraft.yaml was abandoned. |