project: validate snapcraft yaml before using it (CRAFT-55)
Metadata
Current evaluation
Merged PR #3526 in commit 38891b17d, validating project YAML in get_project() before extensions or snap metadata consume potentially invalid data.
Resolution: closed resolved
Reason: Git history records commit 38891b17d for PR #3526, confirming the change was merged to validate snapcraft.yaml before returning the Project object.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Multiple places utilize the yaml before it gets checked by
conduct_project_sanity_check(). Instead of requiring the
sanity check, verify it before returning the Project object
in get_project(). The sanity checks can occur later as well.
(1) Config may use it to apply extensions on broken yaml.
(2) Snap meta assumptions may break when unmarshaling
because the JSON schema check hasn't yet happened.
LP: 1853682
CRAFT-55
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #3526 in commit 38891b17d, validating project YAML in get_project() before extensions or snap metadata consume potentially invalid data. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #3526, validating snapcraft.yaml in get_project() before extensions or snap metadata can consume malformed YAML. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged as 38891b17d: snapcraft.yaml is validated in get_project() before extensions or metadata are used. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged into master as 38891b17d: snapcraft.yaml is now validated in get_project() before extensions or metadata use (CRAFT-55). | |
| qwen/qwen3.6-35b-a3b | — | — | Merged into master. Moves snapcraft YAML validation to get_project() to prevent errors during extension application and JSON schema checks. Approved by two reviewers. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Validates snapcraft YAML earlier in the pipeline to prevent errors during extension application and JSON schema checks, resolving CRAFT-55. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2388 project: early snapcraft.yaml validation | snapcraft | merged | Merged PR #2388 (ba65313cc) adds early snapcraft.yaml validation, preventing invalid Multipass instances and speeding up feedback; fixes LP #1794507. | |
| #3633 projects: add project model and validation (CRAFT-763) | snapcraft | merged | Merged PR #3633 as d6636e12c, adding Pydantic models and validators for snapcraft.yaml, tests, and a package layout change to avoid cyclic imports. | |
| #3654 projects: add grammar validation | snapcraft | merged | Merged #3654 via commit 17fcb85f8, validating snapcraft.yaml with craft-grammar Pydantic models before processing grammar-aware properties. | |
| #2458 clean: error out on invalid or missing yaml | snapcraft | merged | Merged #2458 via commit bf5dbbb3f, making clean fail safely when snapcraft.yaml is missing, invalid, or lacks a project name. |