fix(core22): report invalid projects instead of crashing
Metadata
Current evaluation
PR #6451 proposed validation and error-formatting fixes for invalid core22 projects, including #5613, but was closed unmerged; no resolving commit was found and #5613 remains open.
Resolution: closed stale
Reason: PR #6451 passed CI but was closed without review, a merge commit, or an explanation from a maintainer. Issue #5613 remains open, confirming the proposed fix was not incorporated.
Evaluated by: mr-cal-bot
No scores available.
Issue body
For core22 projects, validation errors from `Project.unmarshal()` in the classic lifecycle weren't handled, so any invalid value in `snapcraft.yaml`, such as `grade: foo`, was shown as a pydantic traceback. These errors are now raised as `ProjectValidationError` and formatted with craft-application's `format_pydantic_errors()`, so they look the same as for core24 and newer projects:
```
Bad snapcraft.yaml content:
- input should be 'stable' or 'devel' (in field 'has-base.core22.grade', input: 'foo')
```
Grammar processing also crashed with `TypeError: 'NoneType' object is not iterable` on keys without a value, like the empty root-level `build-packages:` from the issue. These keys are now left for the project model to validate:
```
Bad snapcraft.yaml content:
- input should be a valid list (in field 'has-base.core22.parts.snapcraft/core.build-packages', input: None)
```
An empty part-level `stage-packages:` still fails with an internal error, on core24 as well, because craft-parts' `PartSpec` validator iterates over the value before type validation. That needs a separate fix in craft-parts.
Fixes #5613
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test`.
- [ ] I've added or updated any relevant documentation.
- [ ] In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing.
- [ ] I've updated the relevant release notes.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed stale | PR #6451 proposed validation and error-formatting fixes for invalid core22 projects, including #5613, but was closed unmerged; no resolving commit was found and #5613 remains open. | |
| qwen/qwen3.8-27b | — | closed stale | PR to fix core22 crash on invalid snapcraft.yaml (raise ProjectValidationError instead of pydantic traceback) was closed without merging. No reviewers assigned, no merge commit found, and target issue #5613 remains open. | |
| stealth/space-bunny-alpha |
Impact:
45
Quick Win:
23
Complexity:
28
Confidence:
84
Actionability:
72
|
needs review | Wraps core22 Project.unmarshal() pydantic ValidationErrors as ProjectValidationError using craft-application's format_pydantic_errors, and skips grammar processing for value-less keys so they hit model validation. Fixes #5613. Open, no reviews yet. |
Update history
| Date | Change |
|---|---|
| closed | |
| updated | |
| created |
Related work
-
Related To:
snapcraft#5613
(confidence 100%)
The PR explicitly targeted #5613, which remains open.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4608 fix(project): fix core24/devel validation | snapcraft | merged | Merged PR #4608 fixed core24/devel project validation by passing complete input values to the regular validator instead of only fields validated so far. |