← Back to issue list

projects: add grammar validation

View original Github issue

Metadata

Project
snapcraft
Number
#3654
Type
pull request
State
merged
Author
cmatsuoka
Labels
Created
Updated
Closed

Current evaluation

Merged after review and CI approval. Adds pydantic validation for snapcraft.yaml grammar using craft-grammar models. A follow-up update was noted to align with a craft-grammar version change that switched grammar entries to lists.

Suggested action:

No scores available.

Issue body

Validate snapcraft.yaml using pydantic validation models supplied by craft-grammar before processing grammar-aware properties. - [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/)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh tests/unit`? ----- CRAFT-826

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged after review and CI approval. Adds pydantic validation for snapcraft.yaml grammar using craft-grammar models. A follow-up update was noted to align with a craft-grammar version change that switched grammar entries to lists.
qwen3.6-35b-a3b-mtp-q6 Merged after implementing pydantic-based grammar validation for snapcraft.yaml via craft-grammar models. The author noted a necessary update to a patched craft-grammar version. Codecov confirmed 100% diff coverage and a 0.16% overall increase.
qwen3.6-35b-a3b-mtp-q6 Merged into snapcraft/7.0, adding pydantic validation for snapcraft.yaml via craft-grammar. Coverage increased by 0.16% with 100% diff coverage. Aligned with a fixed craft-grammar version for list-based entries.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#3633 projects: add project model and validation (CRAFT-763) snapcraft merged Merged into snapcraft/7.0 after approval and CI checks. Added pydantic models and validators for snapcraft.yaml project files, adjusted package layout to prevent cyclic imports, and increased coverage by 2.02%.
77%
#4 models: create grammar-aware pydantic models (CRAFT-856) craft-grammar merged Merged. Introduces grammar-aware Pydantic models (GrammarStr, GrammarStrList, GrammarSingleEntryDictList) for lifecycle part build-environment attributes. Approved by one reviewer, passed CI, and modified 10 files.
75%
#3 grammar: import from Snapcraft (CRAFT-818) craft-grammar merged Merged import of grammar processing logic from Snapcraft. Refactored grammarProcessor and transformer signatures to remove Snapcraft coupling and enforce kwargs. Updated linting and type checking tooling. Approved and passed CI.
74%
#3526 project: validate snapcraft yaml before using it (CRAFT-55) snapcraft closed Merged into master. Moves snapcraft YAML validation to get_project() to prevent errors during extension application and JSON schema checks. Approved by two reviewers.
74%
#3814 extensions: use pydantic to validate yaml before expanding snapcraft merged Merged updates implementing pydantic validation for snapcraft.yaml prior to expansion and correcting an underscore-to-hyphen alias mapping. Approved by two reviewers with passing CI checks, advancing core22 architecture support.
72%
#5462 docs: migrate 'Snapcraft advanced grammar' snapcraft merged Merged documentation migration for the Snapcraft advanced grammar reference. Approved by two reviewers and passed CI checks before being squashed into the main branch.
72%
#401 build!: update to pydantic 2 craft-application merged Merged to update the codebase to Pydantic 2. Approved by two reviewers and passed CI. The change modified 23 files (+531/-342). Initial test failures were resolved after the craft-grammar dependency received a corresponding update.
71%