← 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 #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.

Suggested action: needs review

Reason: Issue #1917 is still open and the fix (catching InvalidVersion in ProviderService.instance) is absent from the main branch — grep for 'InvalidVersion' in provider.py returns no matches and no commit referencing 177e89a or #1917 exists in git log. The PR is 128 days old with 0 reviewers, but the underlying bug remains unfixed and the upstream craft-providers#661 was closed without resolution, so the charmcraft-side fix is still needed. A maintainer should review and land this.

Impact: 45 Quick Win: 29.25 Staleness: 55 Complexity: 35 Confidence: 75

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
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29.25
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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 15
Confidence: 90
needs review Fixes a crash in ProviderService.instance() when Multipass uses non-PEP-440 dev versions by catching InvalidVersion and raising a CraftError. The reproducer test passes, but unrelated type checking errors remain.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#1917 (confidence 95%)

    PR body explicitly states 'Closes #1917'; issue is still open with no fix in main branch.

  • Related To: canonical/craft-providers#661 (confidence 90%)

    Upstream root cause: multipass.is_supported_version() calls packaging.version.parse() which raises InvalidVersion for non-PEP-440 strings. Closed without resolution, so charmcraft must handle it locally.

Related issues

No related issues found above the similarity threshold.