← Back to issue list

is_effective_base_eol() crashes with UnknownVersionError on build-base: devel

View original Github issue

Metadata

Project
craft-application
Number
#1152
Type
issue
State
closed
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Closed. The is_effective_base_eol() crash on build-base devel was fixed by adding UnknownVersionError handling, treating unrecognized bases as supported to match sibling methods.

Suggested action:

No scores available.

Issue body

> **Note:** This issue was drafted by an AI assistant (GitHub Copilot CLI) on behalf of @lengau, based on investigation of a spread test failure in `canonical/imagecraft`. ### Bug Description `ProjectService.is_effective_base_eol()` does not handle a `build-base`/`base` of `devel` (or any base unrecognized by `distro-support`) the same way its sibling methods do, causing an unhandled `UnknownVersionError` crash. Both `check_base_is_supported()` and `base_eol_soon_date()` already special-case or defensively catch this: - `check_base_is_supported()` explicitly treats a `devel` series as always-supported: ```python if build_base.series == "devel": build_base = None ``` - `base_eol_soon_date()` catches the error and assumes the base is supported: ```python except (UnknownDistributionError, UnknownVersionError): # If distro-support doesn't know about this base, assume it's supported. return None ``` However, `is_effective_base_eol()` has neither protection: ```python def is_effective_base_eol(self) -> bool: """Determine whether the base on which to build is end-of-life.""" base = craft_platforms.DistroBase.from_str(self.get().effective_base) return not self._is_supported_on(base=base, date=datetime.date.today()) ``` This method is called from `commands/lifecycle.py::_check_supported_base()` specifically on the `--ignore=unmaintained` path: ```python if "unmaintained" in ignore_items: if project_service.is_effective_base_eol(): ... ``` So any project with `build-base: devel` (or `base: devel`) that runs `pack --ignore=unmaintained` crashes with: ``` distro_support.errors.UnknownVersionError: Unknown version ubuntu devel ``` This is closely related to #986, but that issue was about an outdated pinned `distro-support` version for a *real* series (`ubuntu@26.04`), fixed by bumping the dependency. This case is different: `devel` is never going to be a version `distro-support` recognizes, so bumping the dependency won't fix it — the code path itself needs the same `devel`/`UnknownVersionError` handling used elsewhere. ### To Reproduce 1. Create a project with: ```yaml base: bare build-base: devel ``` 2. Run `<app> pack --ignore=unmaintained`. ### Relevant log output ``` imagecraft internal error: UnknownVersionError('Unknown version ubuntu devel') Traceback (most recent call last): ... File ".../craft_application/commands/lifecycle.py", line 227, in _check_supported_base if project_service.is_effective_base_eol(): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".../craft_application/services/project.py", line 761, in is_effective_base_eol base = craft_platforms.DistroBase.from_str(self.get().effective_base) File ".../craft_application/services/project.py", line 694, in _is_supported_on support_range = distro_support.get_support_range(base.distribution, base.series) File ".../distro_support/__init__.py", line 19, in get_support_range raise UnknownVersionError(distribution, version) distro_support.errors.UnknownVersionError: Unknown version ubuntu devel ``` ### Suggested fix Give `is_effective_base_eol()` the same treatment as `check_base_is_supported()`/`base_eol_soon_date()`: treat a `devel` series as always-supported (not EOL), and/or catch `(UnknownDistributionError, UnknownVersionError)` and assume the base is supported when `distro-support` doesn't recognize it.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Closed. The is_effective_base_eol() crash on build-base devel was fixed by adding UnknownVersionError handling, treating unrecognized bases as supported to match sibling methods.
qwen/qwen3.6-35b-a3b
Staleness: 0
Complexity: 15
Confidence: 90
Support Request: 5
needs triage is_effective_base_eol() crashes with UnknownVersionError when build-base is devel, unlike sibling methods. Untriaged, awaiting maintainer review.

Update history

Date Change
closed
created

Related issues

Issue Project State Summary Similarity
#1153 fix(project): handle devel bases in is_effective_base_eol() craft-application merged Merged fix for is_effective_base_eol() crash on devel or unrecognized bases. Now treats devel as never EOL and catches unknown errors, matching sibling methods. Includes unit tests and passed review.
77%