← 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
Updated
Closed

Current evaluation

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.

Suggested action: close stale

Reason: PR #2681 (commit dea7d9a0) already fixed the remote.py bug and added its own regression test (test_remote_build_project_name_attr_regression in tests/unit/commands/test_remote.py), making this PR's primary purpose obsolete. The PR has been inactive for 128 days. The remaining lifecycle.py fix (line 116 still uses self._services.project without .get()) is a separate concern better addressed in a fresh PR.

Impact: 35 Quick Win: 28.0 Staleness: 75 Complexity: 20 Confidence: 82

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
qwen/qwen3.8-27b
Impact: 35
Quick Win: 28.0
Staleness: 75
Complexity: 20
Confidence: 82
close stale 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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 55
Complexity: 15
Confidence: 85
needs review Adds a reproducer test and a proposed fix for a ProjectService AttributeError in remote-build. Currently pending maintainer review with zero approvals and no recent human activity.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 10
Confidence: 85
needs review Adds a failing unit test reproducing a ProjectService AttributeError in remote-build. Inactive for 76 days, awaiting maintainer decision on merging the test or applying the fix.
qwen3.6-35b-a3b-mtp-q6
Staleness: 55
Complexity: 15
Confidence: 80
needs review Adds a reproducer and fix for a remote-build AttributeError where self._services.project returns a ProjectService instead of the model. The fix calls .get() in remote.py and lifecycle.py. Awaiting maintainer review after ~2.5 months of inactivity.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 15
Confidence: 75
needs review Reproduces a ProjectService AttributeError in charmcraft remote-build via a failing unit test, then fixes the bug in remote.py and lifecycle.py by calling .get() on the service. Resolved.

Update history

No update history recorded yet.

Related work

  • Caused By: canonical/charmcraft#2598 (confidence 95%)

    Original bug report: remote-build crashes with AttributeError on ProjectService.name; now closed

  • Likely Fixed By: canonical/charmcraft#2681 (confidence 90%)

    Commit dea7d9a0 fixed remote.py to use .get() and added test_remote_build_project_name_attr_regression, superseding this PR's test and remote.py fix

Related issues

Issue Project State Summary Similarity
#2669 tests: add reproducer for pack retaining deleted files between builds (#710) charmcraft open Adds failing reproducer test for #710 plus a fix (PartsLifecycle._clean_stale_parts) that cleans stale pulled files before each lifecycle run; test now passes. Awaiting review; several CI checks failing.
71%
#2665 tests: add reproducer for upload crash outside project directory (#2492) charmcraft open 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.
71%