Skip to content

fix(project): handle devel bases in is_effective_base_eol() - #1153

Open
lengau wants to merge 3 commits into
mainfrom
work/fix-1152
Open

fix(project): handle devel bases in is_effective_base_eol()#1153
lengau wants to merge 3 commits into
mainfrom
work/fix-1152

Conversation

@lengau

@lengau lengau commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #1152

ProjectService.is_effective_base_eol() did 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.

This gives is_effective_base_eol() the same treatment as check_base_is_supported() and base_eol_soon_date():

  • Treat a devel series as never EOL.
  • Catch (UnknownDistributionError, UnknownVersionError) and assume the base is supported when distro-support doesn't recognize it.

Testing

Added test_is_effective_base_eol covering supported, EOL, devel build-base, and unrecognized-base cases. Full tests/unit/services/test_project.py suite passes (2199 passed, 54 skipped).

Copilot AI lite review requested due to automatic review settings August 10, 2026 21:29
is_effective_base_eol() did not handle a devel series or a base
unrecognized by distro-support, causing an unhandled UnknownVersionError
crash (e.g. build-base: devel with --ignore=unmaintained). Give it the
same treatment as check_base_is_supported()/base_eol_soon_date(): treat
devel as never EOL, and assume unknown bases are supported.

Fixes #1152

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in ProjectService.is_effective_base_eol() when the project’s effective base is devel or otherwise unrecognized by distro-support, aligning the behavior with the existing base-support helper methods.

Changes:

  • Treat effective_base with series == "devel" as never EOL (returns False).
  • Catch UnknownDistributionError / UnknownVersionError from distro-support and assume the base is supported (not EOL).
  • Add a new parametrized unit test for is_effective_base_eol() covering supported, EOL, devel build-base, and unknown distribution cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
craft_application/services/project.py Adds devel handling and exception fallback to prevent UnknownVersionError/UnknownDistributionError crashes in is_effective_base_eol().
tests/unit/services/test_project.py Introduces a new unit test for is_effective_base_eol() across several base/build-base scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/unit/services/test_project.py
lengau and others added 2 commits August 10, 2026 21:41
Simplify is_effective_base_eol() to special-case a devel series the
same way check_base_is_supported() does, rather than broadly catching
UnknownDistributionError/UnknownVersionError for any unrecognized
base. This more precisely fixes the crash on build-base: devel
without silently treating other unrecognized bases as non-EOL.

Also add a spread test that packs a project with build-base: devel
and --ignore=unmaintained, and update/split the unit tests to cover
the devel special-case versus genuinely unknown bases (which now
correctly propagate the underlying distro-support error).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds the newly-available Ubuntu 26.04 LTS multipass image as a spread
test system, matching the existing openstack backend coverage. Verified
locally by running the pack-devel-build-base regression test on
multipass:ubuntu-26.04-64.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lengau
lengau requested a balanced review from Copilot August 10, 2026 21:55
@lengau
lengau requested a review from a team August 10, 2026 21:56
@lengau
lengau marked this pull request as ready for review August 10, 2026 21:56
@lengau lengau changed the title fix(project): handle devel/unknown bases in is_effective_base_eol() fix(project): handle devel bases in is_effective_base_eol() Aug 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (1)

tests/spread/witchcraft/pack-devel-build-base/task.yaml:8

  • This says the regression test covers any base unknown to distro-support, but the implementation only special-cases series == "devel", and test_is_effective_base_eol_unknown_base_raises explicitly verifies that other unknown distributions/versions still raise. Narrow this explanation to the devel case so the test documentation matches the behavior.
# ProjectService.is_effective_base_eol() did not handle a build-base of "devel"
# (or any base unrecognized by distro-support), crashing with an unhandled
# UnknownVersionError. This is only exercised when the --ignore=unmaintained

lengau added a commit to canonical/imagecraft that referenced this pull request Aug 10, 2026
is_effective_base_eol() crashes with UnknownVersionError when
build-base: devel is used with --ignore=unmaintained, since it lacks
the same devel/unknown-base handling as its sibling methods
check_base_is_supported()/base_eol_soon_date(). This broke
tests/spread/pack/non-sequential-partitions and
tests/spread/pack/sector-write on all systems.

Point craft-application at the canonical/craft-application#1153 fix
branch until it's merged and released, then switch back to a
released craft-application~=7.1.

Fixes canonical/craft-application#1152

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants