fix: snapcraft try error shows effective base
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
Fixes #6186
Use `get_effective_base()` to resolve the effective base before constructing the error message.
### Changes
- `snapcraft/commands/lifecycle.py`: use `get_effective_base()` in `TryCommand.run()`
- `tests/unit/commands/test_lifecycle.py`: add tests for `core24` and `core26` using pytest.mark.paramterize
This change reads the project's base field via the project service so the error message accurately reports effective base the user configured.
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [ ] I've successfully run `make lint && make test`.
- [ ] I've added or updated any relevant documentation.
- [ ] In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing.
- [ ] I've updated the relevant release notes.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for snapcraft try error reporting. TryCommand.run now calls get_effective_base() to accurately display the configured base in error messages. Includes unit tests for core24 and core26. Resolves #6186. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Updated TryCommand.run to use get_effective_base() for accurate error reporting, resolving #6186. Added unit tests for core24 and core26 bases. |
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. | |
| #6186 `snapcraft try` error is outdated | snapcraft | closed | Closed after assignment. Maintainer provided implementation guidance using get_effective_base() for dynamic base detection, with parametrized tests planned for core24 and core26. | |
| #4118 init: use core22 base for `snapcraft init` | snapcraft | merged | Merged. Updates snapcraft init to use core22 as the default base instead of core20. The command was relocated from snapcraft_legacy to snapcraft, and a spread test was added. Approved by reviewer and passed CI. | |
| #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. | |
| #3836 snapcraft/meta: make Manifest.base optional | snapcraft | merged | 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. | |
| #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. | |
| #3579 snap: move base to core20 (CRAFT-509) | snapcraft | merged | Merged updates the snap base to core20. Approved by two reviewers with passing CI checks. Changes affect 13 files, increase coverage by 0.07%, and update initialization templates to core20. | |
| #3583 build providers: snapcraft's new base is core20 (CRAFT-544) | snapcraft | merged | Merged into master. Replaced core18 injection with core20 as the new snapcraft base. Approved by one reviewer, passed CI, and achieved 100% diff coverage. | |
| #4755 tests: fix devel base snap test | snapcraft | merged | Merged a fix for the devel base snap test. The update ensures snapcraft correctly creates and utilizes the devel base. Approved by two reviewers, passed CI checks, and applied with a minimal one-file change. | |
| #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. |