← Back to issue list

clean: error out on invalid or missing yaml

View original Github issue

Metadata

Project
snapcraft
Number
#2458
Type
pull request
State
merged
Author
sergiusens
Labels
Created
Updated
Closed

Current evaluation

Merged. Modifies the clean command to fail if snapcraft.yaml is missing or lacks a name field, preventing accidental cleanup of non-snapcraft projects. Resolves LP #1777501. Approved, passed CI, and merged.

Suggested action:

No scores available.

Issue body

Reduce the risk of cleaning a non snapcraft base project by erroring out if the snapcraft.yaml or the name is not defined in it. LP: #1777501 Signed-off-by: Sergio Schvezov <sergio.schvezov@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/)? - [ ] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [ ] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh tests/unit`? -----

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged. Modifies the clean command to fail if snapcraft.yaml is missing or lacks a name field, preventing accidental cleanup of non-snapcraft projects. Resolves LP #1777501. Approved, passed CI, and merged.
qwen3.6-35b-a3b-mtp-q6 Merged. Adds validation to the clean command to fail if snapcraft.yaml is missing or lacks a name field, preventing accidental cleanup of non-snapcraft projects. Code coverage reports 100% diff.
qwen3.6-35b-a3b-mtp-q6 Merged. Updates the clean command to error out if snapcraft.yaml or the project name is missing, preventing accidental cleanup of non-snapcraft projects. Resolves Launchpad bug #1777501.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1007 lifecycle: clean without parsing if possible. snapcraft merged Merged an optimization that skips YAML parsing during snapcraft clean when no parts or steps are specified, fixing invalid YAML failures and improving performance. Resolved after correcting step argument handling to pass CI tests.
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.
71%
#1777501 snapcraft clean should require a minimal valid yaml with at least a name snapcraft (launchpad) closed Abandoned without a recorded fix. The requirement to validate minimal YAML before snapcraft clean was never implemented.
71%
#2517 project: ensure yaml load returns a dictionary snapcraft merged Merged fix for SNAPCRAFT-JQ ensuring yaml.load returns an empty dictionary instead of None for empty files. Prevents validation crashes when Snapcraft processes empty YAML. Approved by reviewer and passed all CI checks.
71%
#5924 docs: clean up 'snapcraft.yaml' snapcraft merged Merged documentation cleanup for snapcraft.yaml, including typo fixes, docstring link updates, and JSON schema regeneration. Reviewers approved the non-functional changes, and the schema workflow was resolved by running make schema.
70%