Skip to content

pkg/ostree: remove stale .part sidecars from a different interrupted pull - #25

Draft
detsch wants to merge 1 commit into
foundriesio:masterfrom
detsch:cleanup-stale-parts
Draft

pkg/ostree: remove stale .part sidecars from a different interrupted pull#25
detsch wants to merge 1 commit into
foundriesio:masterfrom
detsch:cleanup-stale-parts

Conversation

@detsch

@detsch detsch commented Aug 14, 2026

Copy link
Copy Markdown
Member

An interrupted pull leaves content-object .part sidecars in the repo's tmp/ directory as byte-level resume state. The resume logic only ever revisits objects the current commit references, so sidecars left by a different, abandoned target were never cleaned up and lingered forever.

After a full pull computes its content set, remove any .filez.part sidecar whose checksum is not in that set, and keep the ones that are (so their partial bytes still resume). This naturally scopes cleanup to "a different version is being pulled": re-running the same interrupted commit keeps every leftover, since all of them are still referenced.

Cleanup is best-effort (a failed unlink is skipped, not fatal) and only touches tmp/*.filez.part files with a valid 64-hex stem; delta .part files live under deltas/ and are untouched. The count is surfaced as PullResult.PartsRemoved.

…pull

An interrupted pull leaves content-object .part sidecars in the repo's
tmp/ directory as byte-level resume state. The resume logic only ever
revisits objects the current commit references, so sidecars left by a
different, abandoned target were never cleaned up and lingered forever.

After a full pull computes its content set, remove any .filez.part sidecar
whose checksum is not in that set, and keep the ones that are (so their
partial bytes still resume). This naturally scopes cleanup to "a different
version is being pulled": re-running the same interrupted commit keeps
every leftover, since all of them are still referenced.

Cleanup is best-effort (a failed unlink is skipped, not fatal) and only
touches tmp/*.filez.part files with a valid 64-hex stem; delta .part files
live under deltas/ and are untouched. The count is surfaced as
PullResult.PartsRemoved.

Signed-off-by: Andre Detsch <andre.detsch@foundries.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant