craft-parts doesn't track primed files when using `override-prime`
Metadata
Current evaluation
override-prime stores empty file metadata instead of tracking scriptlet-created content, breaking primed-stage-package manifests and related Snapcraft workflows.
Suggested action: needs triage
Reason: The supplied reproducer deterministically shows files as an empty set with override-prime versus {"hello.txt"} without it. The current code returns StepContents(stage=...) immediately after any scriptlet, bypassing built-in filesystem collection; the issue has no labels or maintainer triage despite being 479 days old.
Evaluated by: mr-cal-bot
Impact:
58
Quick Win:
34
Complexity:
35
Confidence:
93
Actionability:
91
Issue body
### Bug Description
When using `override-prime`, craft-parts doesn't track what files are primed.
This is because craft-parts returns an empty fileset when using an `override-` script: https://github.com/canonical/craft-parts/blob/53f7d3602e6b083bb6a96e2eae1205861cff7e6d/craft_parts/executor/part_handler.py#L535
This causes downstream issues:
- https://github.com/canonical/snapcraft/issues/4547
- https://github.com/canonical/snapcraft/issues/5552
### To Reproduce
```python
import pathlib
import logging
import yaml
import craft_parts
from craft_parts import LifecycleManager, Step
# logging.basicConfig(level=logging.DEBUG)
parts_yaml = {
"no override-prime": {
"parts": {
"hello": {
"plugin": "nil",
"override-build": "touch $CRAFT_PART_INSTALL/hello.txt\ncraftctl default",
},
},
},
"override-prime": {
"parts": {
"hello": {
"plugin": "nil",
"override-build": "touch $CRAFT_PART_INSTALL/hello.txt\ncraftctl default",
"override-prime": "craftctl default",
},
},
},
}
for name, parts in parts_yaml.items():
lcm = LifecycleManager(
parts,
application_name="example",
cache_dir=".",
)
lcm.clean()
actions = lcm.plan(Step.PRIME)
with lcm.action_executor() as aex:
aex.execute(actions)
prime_state = pathlib.Path("parts/hello/state/prime")
prime_data = yaml.safe_load(prime_state.read_text())
print(f"Primed files tracked with {name}: {prime_data.get('files')}")
```
### Relevant log output
```shell
Primed files tracked with no override-prime: {'hello.txt'}
Primed files tracked with override-prime: set()
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
58
Quick Win:
34
Complexity:
35
Confidence:
93
Actionability:
91
|
needs triage | override-prime stores empty file metadata instead of tracking scriptlet-created content, breaking primed-stage-package manifests and related Snapcraft workflows. | |
| stealth/space-bunny-alpha |
Impact:
58
Quick Win:
19
Complexity:
60
Confidence:
88
Actionability:
84
|
keep open | Bug: craft-parts records an empty files/dirs set in prime state when a part defines override-prime (and override-stage), because _run_step returns StepContents with no contents after running a scriptlet. Breaks primed-stage-packages tracking downstream in snapcraft. | |
| qwen/qwen3.6-35b-a3b |
Impact:
50
Quick Win:
24
Complexity:
40
Confidence:
75
Actionability:
80
|
needs triage | craft-parts fails to track primed files when override-prime is used, causing empty filesets in prime state. | |
| qwen/qwen3.8-27b |
Impact:
45
Quick Win:
25
Staleness:
80
Complexity:
45
Confidence:
85
Support Request:
0
|
needs triage | craft-parts writes an empty fileset to prime state when a part uses override-prime, since the scriptlet path in _run_step returns no tracked contents. Bug confirmed still present in current code; unlabelled, no comments; downstream snapcraft issue still open. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
85
Complexity:
40
Confidence:
85
Support Request:
5
|
needs triage | craft-parts fails to track primed files when using override-prime, returning an empty fileset and causing downstream snapcraft issues. Unassessed after 406 days with no maintainer comments or labels. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
90
Complexity:
40
Confidence:
85
Support Request:
5
|
needs triage | override-prime causes craft-parts to return an empty fileset for tracked primed files, breaking downstream snapcraft functionality. The report is unlabelled, has no maintainer response, and has been inactive for over a year. |
Update history
No update history recorded yet.
Related work
-
Caused By:
snapcraft#5552
(confidence 96%)
The open downstream issue reports empty primed-stage-packages because craft-parts #1122 does not track files produced by override-prime.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2097440 override-prime disables primed-stage-packages | snapcraft (launchpad) | open | Manifest's primed-stage-packages is empty when a part uses override-prime; root cause is upstream craft-parts not tracking scriptlet-primed files. Confirmed by maintainers, still reproduces; duplicate on GitHub. | |
| #5552 `primed-stage-packages` isn't in manifest.yaml when using override-prime | snapcraft | open | override-prime leaves primed-stage-packages empty in build manifests on core22+ because craft-parts #1122 does not track scriptlet-primed files; still reproduced on Launchpad. |