snapcraft/meta: make Manifest.base optional
Metadata
Current evaluation
Merged a fix making Manifest.base optional to resolve a validation error crashing manifest generation for core22 base snaps. Approved and merged after passing CI. Reviewers suggested adding a spread test for base building cases.
Suggested action: —
No scores available.
Issue body
I recently ran into a problem building a core22 based base snap that had been working fine last week:
https://github.com/canonical/ubuntu-core-desktop/runs/7294752999?check_suite_focus=true
```
Generating snap manifest... Traceback (most recent call last):
...
File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 308, in _generate_manifest
manifest.write(
File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/meta/manifest.py", line 97, in write
manifest = Manifest(
File "pydantic/main.py", line 331, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for Manifest
base
none is not an allowed value (type=type_error.none.not_allowed)
Failed to execute pack in instance.
```
The conditions to reproduce seem to be:
* The snap mustn't use legacy snapcraft (in this case, we have `build-base: core22`)
* The snap must be missing the "base" attribute (in this case, because we're building a base snap)
* Snapcraft must be asked to generate a manifest (which the Github action does by default)
It looks like the problem was introduced in #3824, where the manifest generation feature was reintroduced. The validation logic expects the base attribute to be a string, which is not always going to be the case.
- [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 `make lint`?
- [ ] Have you successfully run `pytest tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged a fix making Manifest.base optional to resolve a validation error crashing manifest generation for core22 base snaps. Approved and merged after passing CI. Reviewers suggested adding a spread test for base building cases. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix making Manifest.base optional to resolve pydantic validation errors when generating manifests for core22 base snaps lacking a base attribute. PR merged with 100% diff coverage; reviewer suggested adding a spread test. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix making Manifest.base optional to resolve validation errors when building core22 base snaps without a base attribute. Integrated into main with 100% diff coverage; reviewer suggested adding a spread test. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #5388 fix: don't fail when checking the base | snapcraft | merged | Merged a fix preventing snapcraft from failing early during base checks. Enables user-friendly error reporting for incorrect bases. Approved by two reviewers and merged with 10 additions and 30 deletions across three files. | |
| #6193 fix: snapcraft try error shows effective base | snapcraft | merged | Merged fix for #6186 that updates the snapcraft try error message to accurately display the effective base using get_effective_base(). Approved by reviewers and merged with added unit tests for core24 and core26. | |
| #2309 snap: improve early base detection logic | snapcraft | merged | Merged. Resolved early base detection failure in build providers by updating logic to account for snapcraft's non-project directory execution. Approved by reviewer, passed CI, and merged with minimal changes. | |
| #384 manifest: add bases support to create_manifest() (CRAFT-63) | charmcraft | merged | Merged after approval and CI checks. Adds an optional bases_config parameter to create_manifest() and relocates it to a dedicated module to prevent import loops. Runtime retains legacy behavior while new tests prepare for future bases implementation. | |
| #6150 docs: use core26 as the default base | snapcraft | merged | Merged documentation updates for Snapcraft 9, setting core26 as the default base and standardizing terminology. Approved by two reviewers and passed CI checks. Force-pushed to resolve a squash-merge email error before final merge. | |
| #2689 schema: build-base support for the snapd type | snapcraft | merged | Merged into master. Implements build-base keyword support for the snapd snap type, enabling its construction. Approved by reviewer, passed CI, and updated four files. | |
| #4580 fix: do not propagate build-base to snap.yaml | snapcraft | merged | Merged a fix preventing build-base from propagating to snap.yaml. The pull request received two approvals, passed CI checks and code coverage, and was successfully integrated. | |
| #2411 cli: snapcraft init with a base | snapcraft | merged | Merged. Adds a syntax documentation link after snapcraft init execution. Approved by one reviewer, passed CI checks, modified five files, and achieved 100% diff coverage. Resolves LP #1803776. | |
| #6338 docs: update supported bases | snapcraft | merged | Merged documentation update reflecting Snapcraft 9 as the preferred version for core22, core24, and core26 bases. Approved by three reviewers and passed CI checks. |