feat: prune primed files if they exist on the base
Metadata
Current evaluation
Merged implementation of a lifecycle callback that prunes primed files already present in the base layer, reducing ROCK image size. Approved by two reviewers, passed CI, and resolves issue #363.
Suggested action: —
No scores available.
Issue body
**Note** The first commit is from PR #416 and doesn't need to be reviewed here
------------
This commit adds a lifecycle callback that "prunes" (removes) those
primed files that already exist (with same contents and permissions) in
the base layer. This is necessary because the dependency resolver
doesn't look into the base layer when deciding dependency cutoffs (and
also to support chisel slices, which only look at the target install
dir). Some notes:
1) This first implementation only looks are regular files (no symlinks
and directories), as those are the simplest to handle and provide the
biggest size "wins". If necessary, we can address symlinks and/or
directories in follow-up work.
2) This could have been implemented during the archiving of the new
layer, where we already loop on the files and look at the base layer (to
handle things like the usrmerge). We decided to implement this as part
of the lifecycle to improve the "clarity" and "debuggability" of
Rockcraft runs: after running the lifecycle, the prime directory
contains exactly what's going to be packed in the new layer.
The resulting ROCK should be "semantically" equivalent, but smaller. For
instance, the Pyfiglet ROCK in docs/tutorials/code/pyfiglet goes from
69MB to 53MB, with no functional changes.
Fixes #363
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged implementation of a lifecycle callback that prunes primed files already present in the base layer, reducing ROCK image size. Approved by two reviewers, passed CI, and resolves issue #363. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Implements a lifecycle callback to prune primed files already in the base layer, reducing ROCK size without functional changes. Fixes #363. Initial implementation handles regular files only. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a lifecycle callback that prunes primed files already present in the base layer. Resolves #363 by eliminating redundant data, reducing ROCK sizes without functional changes. |
Update history
No update history recorded yet.
Related issues
No related issues found above the similarity threshold.