← Back to issue list

tests: add reproducer for remote-build ProjectService AttributeError (#2598)

View original Github issue

Metadata

Project
charmcraft
Number
#2667
Type
pull request
State
open
Author
lengau
Labels
Created
2026-04-22 03:05:27+00:00
Updated
2026-04-22 04:23:20+00:00
Closed

Current evaluation

Adds a failing test for a remote-build ProjectService AttributeError that was subsequently fixed by correctly retrieving the project model via the service's get method.

Suggested action: needs review

Reason: The PR includes a clear reproducer test and an AI-generated fix that correctly addresses the reported AttributeError. However, it lacks maintainer review and CI validation, so it requires a human developer to verify the changes, ensure type-checking passes, and approve the merge.

Staleness: 35 Complexity: 15 Confidence: 60

Issue body

## Summary Adds a failing unit test that reproduces #2598: `charmcraft remote-build` crashes with `AttributeError: 'ProjectService' object has no attribute 'name'`. ## Bug In `charmcraft/application/commands/remote.py`, line 109: ```python project = cast(models.Charm, self._services.project) ``` `self._services.project` returns the `ProjectService` instance (via `ServiceFactory.__getattr__`), not the actual project model. The `cast` is a no-op at runtime, so calling `project.name` on a `ProjectService` raises `AttributeError`. The fix is to call `self._services.project.get()` instead. ## Reproducer ``` uv run python -m pytest 'tests/unit/commands/test_lifecycle.py::test_remote_build_project_name_attribute_error' -v ``` The test fails with: ``` AttributeError: 'ProjectService' object has no attribute 'name' ``` Closes #2598

Evaluation history

Date Model Scores Action Summary
2026-06-15 11:40:51.087735+00:00 qwen3.6-35b-a3b-mtp-q6
Staleness: 35
Complexity: 15
Confidence: 60
needs review Adds a failing test for a remote-build ProjectService AttributeError that was subsequently fixed by correctly retrieving the project model via the service's get method.
2026-06-15 11:38:26.962211+00:00 pending