← Back to issue list

fix: remove deleted files from local source on update

View original Github issue

Metadata

Project
craft-parts
Number
#1556
Type
pull request
State
open
Author
copilot-swe-agent
Labels
—
Created
Updated
Closed
—

Current evaluation

Adds a manifest so local-source updates remove upstream deletions without deleting destination-only artifacts; the concern is addressed, but three review threads and 13 CI matrix jobs remain unresolved

Suggested action: needs review

Reason: The author reports the artifact-deletion concern was fixed in bf342c6 by tracking the source tree in a manifest and added a test proving destination-only files are preserved. Core tests and policy checks pass, but no reviewer has approved it, three unresolved threads remain, and 13 matrix jobs are pending; historical PR #132 also makes maintainer scrutiny of this deletion behavior important.

Evaluated by: mr-cal-bot

Impact: 52 Quick Win: 12 Complexity: 64 Confidence: 91 Actionability: 62

Issue body

When a file was deleted from a local source, `update()` left the stale file in `part_src_dir` because `check_if_outdated()` only scanned the source for new/modified files and never detected deletions. ## Changes - **`pull()`** — after copying source files, writes a `.craft-parts-source-manifest` file to `part_src_dir` recording all source entries (files, directories, and directory symlinks) at that point in time. - **`check_if_outdated()`** — reads the manifest and compares it against the current source to detect deletions. Only the *source* is walked; the destination is never compared directly. If no manifest exists (e.g. before the first pull, or after a clean), deletion detection is skipped for backward compatibility. - **`update()`** — after copying new/modified files, removes stale files (`os.remove`) and directories (`shutil.rmtree`) detected via the manifest. Refreshes the manifest afterwards, but only if one already exists — preventing inadvertent manifest creation in contexts where `pull()` is never called (e.g. the `part_src_dir → part_build_dir` update in `_update_build`). - **Tests** — adds `test_file_removed`, `test_file_removed_from_subdirectory`, and `test_non_source_files_in_destination_not_deleted` to `TestLocalUpdate`. The last test explicitly verifies that files in the destination that were never in the source (e.g. build artifacts) are never removed. ## Example ```python # Before fix: file1 persists in destination even after being deleted from source os.remove("source/file1") local.update() assert not os.path.exists("destination/file1") # ← would FAIL before this fix ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 52
Quick Win: 12
Complexity: 64
Confidence: 91
Actionability: 62
needs review Adds a manifest so local-source updates remove upstream deletions without deleting destination-only artifacts; the concern is addressed, but three review threads and 13 CI matrix jobs remain unresolved
stealth/space-bunny-alpha
Impact: 52
Quick Win: 10
Complexity: 58
Confidence: 86
Actionability: 45
needs review Adds a source manifest so local-source updates remove upstream deletions without deleting destination-only artifacts; three review threads remain unresolved and several CI jobs are pending.
stealth/space-bunny-alpha
Impact: 55
Quick Win: 11
Complexity: 64
Confidence: 86
Actionability: 58
needs review Adds a source-state manifest so local-source updates remove deleted files without deleting destination-only artifacts; author feedback was addressed, but three comments and several CI jobs remain unresolved.
qwen/qwen3.6-35b-a3b
Impact: 70
Quick Win: 23
Complexity: 45
Confidence: 75
Actionability: 60
needs review Fixes deleted files from local sources persisting in part_src_dir by introducing a manifest-based deletion detection approach. PR is open, 152 days old, with 0 reviewers and passing CI.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 20
Staleness: 45
Complexity: 60
Confidence: 70
needs review Adds a .craft-parts-source-manifest to LocalSource so update() removes files deleted from the source, fixing open issue #851. Author revised the approach after maintainer feedback; review pending with 0 reviewers and only the CLA check passing.
qwen/qwen3.6-35b-a3b
Staleness: 55
Complexity: 30
Confidence: 85
needs review Fixes stale file cleanup during local source updates by introducing a manifest file to track source entries. Currently pending maintainer review with passing CI and recent author response to feedback.
qwen3.6-35b-a3b-mtp-q6
Staleness: 55
Complexity: 45
Confidence: 65
needs review Fixes stale file cleanup during local source updates by introducing a manifest file to track source entries. Author addressed maintainer feedback with a commit, but the PR has been inactive for 78 days and awaits maintainer validation.

Update history

Date Change
updated
updated
updated
updated
updated

Related work

  • Related To: craft-parts#132 (confidence 97%)

    Previously merged deleted-file synchronization was reverted because it removed build artifacts and override-pull files; the manifest design is intended to preserve that safety.

Related issues

No related issues found above the similarity threshold.