← Back to issue list

tests: add reproducer for pack retaining deleted files between builds (#710)

View original Github issue

Metadata

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

Current evaluation

Reproducer test for #710 (pack retains deleted files) plus Copilot-generated PartsLifecycle._clean_stale_parts workaround; +112/-310, 4 files, open 163 days, 0 reviewers, snap-tests and title-policy checks failing.

Suggested action: needs review

Reason: The PR is complete but entirely unreviewed: review status is 'pending (0 reviewers)' and no comments flag the Copilot-authored production workaround, yet it changes pack behaviour in charmcraft/parts/lifecycle.py by inspecting craft-parts' internal src/ dir to force a re-pull. CI is mixed — Fast/Slow tests, lint and security scans pass, but snap-tests (ubuntu-18.04 through 26.04) and snap-store-tests plus 'policy / Check PR title for Conventional Commits' fail, the last being a straightforward merge blocker given the '(#710)' suffix in the title. Signals are contradictory (the ty bot reported failures while typecheck-with-ty shows passing), and the body still describes the change as a failing reproducer even though Copilot's commit 4b3411b now makes the test pass, so the intended final scope is unclear — hence needs_review rather than keep_open, with only moderate confidence.

Evaluated by: mr-cal-bot

Impact: 38 Quick Win: 10 Complexity: 44 Confidence: 66 Actionability: 48

Issue body

## Summary Adds a failing unit test that reproduces #710: `charmcraft pack` includes files that were deleted from the working directory since the last pack, because craft-parts does not clean stale files from the stage/prime directories on incremental rebuilds. ## Bug When `LifecycleManager.run()` is called a second time after a source file has been deleted, craft-parts skips all lifecycle steps with `reason='already ran'`. The deleted file persists in `prime/` and is included in the repacked `.charm` archive. Upstream bug: https://github.com/canonical/craft-parts/issues/851 Workaround: run `charmcraft clean` (or `charmcraft clean <part-name>`) between packs. ## Reproducer ``` uv run python -m pytest tests/unit/parts/test_lifecycle.py::test_stale_files_removed_from_prime_after_repack -v ``` The test fails with: ``` AssertionError: Stale file from deleted source is still present in prime directory after repack ``` Closes #710

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 38
Quick Win: 10
Complexity: 44
Confidence: 66
Actionability: 48
needs review Reproducer test for #710 (pack retains deleted files) plus Copilot-generated PartsLifecycle._clean_stale_parts workaround; +112/-310, 4 files, open 163 days, 0 reviewers, snap-tests and title-policy checks failing.
qwen/qwen3.6-35b-a3b
Impact: 65
Quick Win: 25
Complexity: 45
Confidence: 75
Actionability: 70
needs review Adds a reproducer test for craft-parts not cleaning stale files between incremental builds, plus a Copilot-generated fix implementing PartsLifecycle._clean_stale_parts(). CI has unrelated type-checking failures.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 30
Staleness: 50
Complexity: 40
Confidence: 75
needs review 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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 55
Complexity: 20
Confidence: 85
needs review Adds a failing test reproducing a bug where charmcraft pack retains deleted files between builds. Author requested an automated fix via Copilot, which was applied. PR awaits maintainer review and CI fixes.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 40
Confidence: 85
needs review Adds a reproducer test and automated fix for a bug where charmcraft pack retains deleted files between builds. Currently awaiting maintainer review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 40
Confidence: 45
needs review Adds a failing test reproducing a bug where charmcraft pack retains deleted files. A maintainer requested a fix via Copilot, which added a workaround commit, but type checking fails and the PR has been inactive for 73 days.

Update history

No update history recorded yet.

Related work

  • Related To: charmcraft#710 (confidence 95%)

    PR body states 'Closes #710'; issue remains open and upstream craft-parts#851 is cited as the root cause this workaround sidesteps.

Related issues

Issue Project State Summary Similarity
#2664 tests: add reproducer for reactive plugin missing .build.manifest (#872) charmcraft open Adds failing unit test reproducing #872 and Copilot fix copying .build.manifest to install dir; 163 days old, 0 reviewers, pending review
77%
#2665 tests: add reproducer for upload crash outside project directory (#2492) charmcraft open Adds failing unit test reproducing upload crash outside project dir (#2492); Copilot added try/except fix. Stale branch, 163 days inactive, type-check failing.
75%