← Back to issue list

snapcraftctl: add checks for empty string for set-version & set-grade

View original Github issue

Metadata

Project
snapcraft
Number
#3325
Type
pull request
State
merged
Author
cjp256
Labels
Created
Updated
Closed

Current evaluation

Merged validation checks for empty strings in snapcraftctl set-version and set-grade. Empty inputs previously caused cryptic metadata errors. The change now explicitly rejects invalid values with clear error messages. Approved and merged.

Suggested action:

No scores available.

Issue body

It's a pretty common mistake for scriplets to end up setting "" in set-version, leading the the following error: `Failed to generate snap metadata: 'adopt-info' refers to part <part>, but that part is lacking the 'parse-info' property.` Setting an empty grade effectively just ignores the invalid value, relying on the default grade later. Explicitly error out with helpful messages when invalid options are used. 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
qwen/qwen3.6-35b-a3b Merged validation checks for empty strings in snapcraftctl set-version and set-grade. Empty inputs previously caused cryptic metadata errors. The change now explicitly rejects invalid values with clear error messages. Approved and merged.
qwen3.6-35b-a3b-mtp-q6 Merged. Adds validation for empty strings in snapcraftctl's set-version and set-grade. Prevents metadata errors by rejecting empty values with clear messages instead of relying on defaults.
qwen3.6-35b-a3b-mtp-q6 Merged. Adds validation checks for empty strings in snapcraftctl's set-version and set-grade commands. Replaces confusing metadata errors with explicit, helpful error messages when invalid inputs are provided.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2067 many: add snapcraftctl set-grade snapcraft merged Merged. Introduces snapcraftctl set-grade for scriptlet-based snap grade configuration and adds final YAML validation before snap.yaml generation. Resolves #2064. Approved, passed CI, and modified 20 files.
73%
#1379 blank version should not be allowed in snapcraft.yaml snapcraft merged Merged after two approvals. Prevents blank versions in snapcraft.yaml, addressing part of bug LP #1660076. Minor flake8 test failures were noted but did not block integration. Full validation for empty version strings remains pending.
72%
#2230 snap: use set-version and set-grade snapcraft merged Merged updates to snap handling that implement set-version and set-grade commands, resolving Launchpad bug #1789695. Approved by reviewer, passed CI, and increased test coverage by 0.01%.
70%