← Back to issue list

test: unit tests for lifecycle service

View original Github issue

Metadata

Project
debcraft
Number
#57
Type
pull request
State
open
Author
Copilot
Labels
Created
Updated
Closed

Current evaluation

Adds unit tests for the Lifecycle service (prime_dirs, get_prime_dir, partition-to-package mapping) per review feedback on #54. Merged main in Dec 2025 to resolve conflicts; CI mostly green but Conventional Commits and lint checks still failing. No maintainer review yet.

Suggested action: needs review

Reason: Maintainer lengau actively drove this PR through rebase and conflict resolution (Dec 2025), and Copilot fixed the lint issue in commit 975c0e4, but the Conventional Commits and lint CI checks are still failing and no maintainer has reviewed or approved. The PR needs a maintainer to verify the fixes and land it, per cmatsuoka's note that it can land directly on main after #54.

Impact: 25 Quick Win: 21.25 Staleness: 55 Complexity: 15 Confidence: 70

Issue body

- [x] Have you followed the guidelines for contributing? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] Have you successfully run `make lint && make test`? --- Addresses review feedback from #54 requesting unit test coverage for the `Lifecycle` service class. ### Changes - Add `tests/unit/services/test_lifecycle.py` with tests covering: - `_get_prime_dirs_from_project()` helper function (partition-to-package name mapping) - `Lifecycle.get_prime_dir()` method (including error handling for non-existent packages) - `Lifecycle.prime_dirs` property ### Test Coverage ```python # Tests verify partition prefix stripping works correctly project_info.prime_dirs = { "package/my-package": Path("/work/partitions/package/my-package/prime"), } result = _get_prime_dirs_from_project(project_info) # Returns: {None: default_prime, "my-package": package_prime} ``` Tests also verify: - Non-package partitions are ignored - Empty partition keys are handled - `DebcraftError` is raised for non-existent package lookups <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/canonical/debcraft/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 25
Quick Win: 21.25
Staleness: 55
Complexity: 15
Confidence: 70
needs review Adds unit tests for the Lifecycle service (prime_dirs, get_prime_dir, partition-to-package mapping) per review feedback on #54. Merged main in Dec 2025 to resolve conflicts; CI mostly green but Conventional Commits and lint checks still failing. No maintainer review yet.
qwen/qwen3.6-35b-a3b
Staleness: 68
Complexity: 15
Confidence: 80
needs review Adds unit tests for the Lifecycle service class, addressing feedback from PR #54. CI passes after fixes. Maintainers indicated it can be merged after #54, but it has been inactive for over seven months with no assigned reviewers.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 15
Confidence: 85
needs review Adds unit tests for the Lifecycle service class, addressing review feedback from #54. CI passes, conflicts resolved, and maintainers indicated it is ready to land on main.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 15
Confidence: 85
needs review Adds unit tests for the Lifecycle service class, covering prime directory mapping and error handling. Addresses #54 feedback. Rebased on main, linting fixed, and conflicts resolved. Awaiting final approval and merge.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/debcraft#54 (confidence 90%)

    PR body states it addresses review feedback from #54 requesting unit test coverage for the Lifecycle service; #54 is merged and this PR was rebased onto it.

Related issues

Issue Project State Summary Similarity
#138 feat: post-prime hook for LifecycleService craft-application merged Merged feature adding a post-prime hook to LifecycleService. Approved by two reviewers, maintaining 99.18% test coverage. Changes span two files with a net addition of 55 lines.
71%
#3719 tests: fix lifecycle tests to run on new directory snapcraft merged Merged a fix for lifecycle tests to run in a new directory instead of the current one. Approved by a reviewer, passed CI, and changed three lines.
71%