← Back to issue list

tests: add reproducer for dev multipass version causing InvalidVersion (#1917)

View original Github issue

Metadata

Project
charmcraft
Number
#2668
Type
pull request
State
open
Author
lengau
Labels
—
Created
Updated
Closed
—

Current evaluation

Adds a failing unit test reproducing multipass dev-version InvalidVersion crash (#1917); root cause was fixed upstream in craft-providers#662, and charmcraft now requires craft-providers>=3.7.1.

Suggested action: close superseded

Reason: The upstream root cause was fixed by canonical/craft-providers#662, and charmcraft's pyproject.toml now pins craft-providers>=3.7.1, which includes that fix. Current main has no InvalidVersion handling or the proposed test, and the PR has had no activity for 163 days, so the charmcraft-side workaround is obsolete.

Evaluated by: mr-cal-bot

Impact: 20 Quick Win: 2 Complexity: 30 Confidence: 85 Actionability: 15

Issue body

## Summary Adds a failing unit test that reproduces #1917: when multipass has a dev version string like `1.15.0-dev.2929.pr661+gc67ef6641.mac`, charmcraft crashes with an unhandled `packaging.version.InvalidVersion` internal error. ## Bug The root cause is in `craft_providers`: `multipass.is_supported_version()` calls `packaging.version.parse()` which raises `InvalidVersion` for non-PEP-440 strings. Charmcraft's `ProviderService.instance()` does not catch this exception, so it propagates as an internal error. Upstream bug: https://github.com/canonical/craft-providers/issues/661 The fix in charmcraft would be to catch `InvalidVersion` in `ProviderService.instance()` and convert it to a user-friendly `CraftError`. ## Reproducer ``` uv run python -m pytest 'tests/unit/services/test_provider.py::test_instance_handles_invalid_multipass_version' -v ``` The test fails with: ``` packaging.version.InvalidVersion: Invalid version: '1.15.0-dev.2929.pr661' ``` Closes #1917

Evaluation history

Date Model Scores Action Summary
~deepseek/deepseek-pro-latest
Impact: 20
Quick Win: 2
Complexity: 30
Confidence: 85
Actionability: 15
close superseded Adds a failing unit test reproducing multipass dev-version InvalidVersion crash (#1917); root cause was fixed upstream in craft-providers#662, and charmcraft now requires craft-providers>=3.7.1.
qwen/qwen3.6-35b-a3b
Impact: 50
Quick Win: 32
Complexity: 20
Confidence: 75
Actionability: 80
needs review Adds a failing unit test reproducing #1917 (InvalidVersion crash with dev multipass versions). Fix applied in commit 177e89a wrapping ProviderService.instance() in try/except InvalidVersion. Test now passes, CI green, awaiting maintainer review.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29
Staleness: 55
Complexity: 35
Confidence: 75
needs review Adds a failing unit test reproducing #1917 (multipass dev version causes InvalidVersion crash) and a fix catching InvalidVersion in ProviderService.instance(). 128 days old, 0 reviewers, issue still open, fix not yet in main branch.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 80
close stale Adds a failing unit test reproducing a multipass dev version parsing crash. The issue was reportedly fixed in a separate commit, but this PR remains unreviewed and inactive for 90 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 15
Confidence: 80
needs review Adds a unit test reproducing a crash when Multipass returns a non-PEP-440 dev version string. Includes a proposed fix to catch InvalidVersion and raise a CraftError. Currently awaiting maintainer review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 15
Confidence: 90
needs review Adds a reproducer test for a multipass version parsing crash and applies a fix to catch InvalidVersion in ProviderService.instance(). The test now passes.

Update history

No update history recorded yet.

Related work

  • Superseded By: canonical/craft-providers#662 (confidence 90%)

    Merged upstream fix parses dev multipass versions, resolving the InvalidVersion root cause.

  • Related To: charmcraft#1917 (confidence 90%)

    The issue this PR's test reproduces.

Related issues

Issue Project State Summary Similarity
#1917 Charmcraft cannot parse a dev version build for multipass charmcraft open Charmcraft pack fails on dev multipass versions like 1.15.0-dev.2929.pr661 due to invalid version parsing in craft-providers; fixed upstream and current charmcraft dependency includes the fix.
72%
#4421 build(deps): bump craft-providers to 1.19.1 snapcraft merged Merged PR #4421 bumped craft-providers to 1.19.1, added devel-base tests, and fixed Multipass test execution in commit caa3c9c23.
71%