← Back to issue list

tests: add reproducer for upload crash outside project directory (#2492)

View original Github issue

Metadata

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

Current evaluation

Adds failing unit test reproducing #2492 (charmcraft upload RuntimeError outside project dir) plus a try/except fix in UploadCommand.run(). Pending review, 0 reviewers, 128 days inactive. Bug still present in main.

Suggested action: needs review

Reason: Issue #2492 is still open and the unconditional self._services.get("project").get() call at store.py:625 is still present in main, confirming the bug persists. The PR (from maintainer lengau) includes both a reproducer test and a Copilot-proposed fix (commit 80f7efa, unverified in main), but has sat 128 days with 0 reviewers and no maintainer sign-off. Needs a review to validate the fix and land it.

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

Issue body

## Summary Adds a failing unit test that reproduces #2492: `charmcraft upload` crashes with an internal `RuntimeError` when run from outside a charm project directory. ## Bug `UploadCommand.run()` calls `self._services.get("project").get()` unconditionally at line 586 after a successful upload. When no `charmcraft.yaml` is present in the current directory, the project service raises `RuntimeError('Project not configured yet.')` — this propagates as an unhandled internal error instead of completing gracefully. ## Reproducer ``` uv run python -m pytest tests/unit/commands/test_store.py::test_upload_outside_project_dir_no_runtime_error -v ``` The test fails with: ``` RuntimeError: Project not configured yet. ``` Closes #2492

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29.25
Staleness: 55
Complexity: 35
Confidence: 65
needs review Adds failing unit test reproducing #2492 (charmcraft upload RuntimeError outside project dir) plus a try/except fix in UploadCommand.run(). Pending review, 0 reviewers, 128 days inactive. Bug still present in main.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 15
Confidence: 80
needs review Adds a failing unit test reproducing a RuntimeError in charmcraft upload when run outside a project directory. Currently pending maintainer review with no follow-up on the requested fix.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 20
Confidence: 65
needs review Adds a failing unit test reproducing an upload crash outside a project directory. An AI-generated fix was committed to address the RuntimeError, but the PR lacks maintainer review and has been inactive for 76 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 55
Complexity: 10
Confidence: 75
needs review Adds a unit test reproducing a RuntimeError crash during upload outside a project directory. A maintainer requested a fix via Copilot, which claims to have patched it, but the PR has been inactive for over two months without human verification.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 20
Confidence: 85
needs review Fixes a charmcraft upload crash when executed outside a project directory. The failure stems from an unhandled RuntimeError when the project service is uninitialized. A try-except fix was applied in commit 80f7efa. Awaiting review.

Update history

No update history recorded yet.

Related work

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

    PR explicitly states 'Closes #2492'; issue is still open and the bug (RuntimeError on upload outside project dir) is confirmed present in current main.

Related issues

Issue Project State Summary Similarity
#2497 Fix upload crash when run outside project directory charmcraft closed Fixed charmcraft upload crash when run outside a project directory. Added configuration checks, unit tests, and a spread test to prevent RuntimeError when accessing an unconfigured project service.
71%
#2666 tests: add reproducer for fetch-lib unhelpful error message (#2204) charmcraft open Adds failing unit test reproducing #2204 (fetch-lib prints 'Library None not found in Charmhub') plus a fix using lib_data.full_name fallback. Pending review, 0 reviewers, CI passing.
71%
#2667 tests: add reproducer for remote-build ProjectService AttributeError (#2598) charmcraft open Adds failing unit test reproducing #2598 (remote-build AttributeError) plus fix in remote.py and lifecycle.py. Superseded: #2681 already fixed remote.py and added its own regression test. lifecycle.py fix still unmerged. Inactive 128 days.
71%