Shared directories are not properly cleaned when partitions are enabled
Metadata
Current evaluation
Shared-directory cleanup was fixed by partition-aware state tracking merged in PR #1109 (commit 8810ccc2), preventing cleanup from affecting every partition.
Resolution: closed resolved
Reason: PR #1109 was merged as commit 8810ccc2, adding partition-aware content tracking. Maintainer @cmatsuopa identified it as the likely fix after duplicate-file cleanup tests passed in the current tree.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### What needs to get done
- Redesign the state manager to track the partition where files are located
- Redesign the `clean_shared_area()` function to remove the correct files from the list of tracked files from the `StateManager`'s state files
The solution could leverage the data structures added by #664.
### Why it needs to get done
If the same file exists in multiple partitions in a shared directory (`stage` or `prime`), cleaning doesn't work as expected. It will indiscriminately remove the file from all partitions. See [this test](https://github.com/canonical/craft-parts/pull/666/files#diff-0d1cfe4b47f2489eca5633ebe11745aadfdc8e83893f931870ab2399091b70d6R181-R201) for an example.
This is because the `StateManager` does not track files per-partition.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Shared-directory cleanup was fixed by partition-aware state tracking merged in PR #1109 (commit 8810ccc2), preventing cleanup from affecting every partition. | |
| stealth/space-bunny-alpha | — | closed resolved | Partition-aware migration state tracking in merged PR #1109 (commit 8810ccc2) fixed shared-directory cleanup, so duplicate paths are removed only from the relevant partition. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #1109 (commit 8810ccc2), which added partition-specific migration-content tracking so shared-directory cleaning no longer removes files indiscriminately from all partitions. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in PR #1109 by @upils. Shared directory cleaning now correctly handles partitions by making migration state partition-aware. Handlers populate partition-specific state, resolving the cross-partition file removal bug. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
70
Complexity:
90
Confidence:
75
Support Request:
0
|
keep open | Known architectural limitation where clean_shared_area() removes files from all partitions instead of tracking them per-partition. Requires StateManager redesign. Documented as technical debt with no simple fix. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
85
Confidence:
80
Support Request:
10
|
keep open | Known architectural limitation where shared directory cleanup removes files across all partitions instead of tracking them per-partition. Requires StateManager redesign. Acknowledged by maintainers but inactive for a year, awaiting prioritization. |
Update history
| Date | Change |
|---|---|
| closed |
Related work
-
Related To:
canonical/craft-parts#666
(confidence 99%)
Merged regression test covering duplicate files across partitions; it exposed the bug but contained no implementation fix.
-
Likely Fixed By:
canonical/craft-parts#1109
(confidence 98%)
Merged partition-aware migration tracking, cited by the maintainer as the likely resolution.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #810 Warn when cleaning shared directories when partitions are enabled | craft-parts | closed | Closed as obsolete after PR #1109 (commit 8810ccc2) fixed partition-aware shared-directory cleaning, removing the need for the proposed warning. |