tests: add reproducer for upload crash outside project directory (#2492)
Metadata
Current evaluation
Adds a test reproducing an upload crash outside project directories and includes a fix that catches the resulting RuntimeError, currently awaiting review.
Suggested action: needs review
Reason: The PR contains a proposed fix for a reported crash but has been inactive for over 7 weeks without maintainer review or labels. It requires technical review to validate the fix, address the type-checking warnings, and proceed with merging or requesting changes.
Staleness:
40
Complexity:
20
Confidence:
60
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 |
|---|---|---|---|---|
| 2026-06-15 11:48:34.798512+00:00 | qwen3.6-35b-a3b-mtp-q6 |
Staleness:
40
Complexity:
20
Confidence:
60
|
needs review | Adds a test reproducing an upload crash outside project directories and includes a fix that catches the resulting RuntimeError, currently awaiting review. |
| 2026-06-15 11:45:36.099225+00:00 | pending | — | — | — |