Share rollback artifact retention across remove and rollback - #600
Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
Conversation
|
[burn-down agent] Labeled Ready for review at
Generated by Claude Code |
|
Reviewed The shared retention sets keep active patches’ original and patched blobs, preserve rollback data for crawler misses, and avoid synthetic filename collisions. I checked both command callers, partial failures, dry-run/preserve-state handling, and the unchanged repair/scan cleanup policy. Validation: all 25 focused core cleanup tests passed locally; the head merges cleanly with current main. Exact-head CI shows 479 successful checks and 8 skips, with no failures or pending checks; Bugbot is clean and no review threads are unresolved. Broader CLI/platform coverage comes from CI. |
Fixes #559.
Removing one patch could delete the only local rollback data for other patches left active.
removeandrollbackbuilt different garbage-collection keep sets: onlyrollbackretained every remaining patch's original blobs. A later offline rollback then failed withmissing_blob, even though the earlier removal had reported success.Both commands now use
ArtifactReferences::after_removalin core. It retains patched bytes for remaining patches, original bytes for remaining and removed-but-not-installed patches, and the corresponding diff archives. Artifacts referenced only by successfully removed patches remain collectible. Repair and scan pruning use the same sweep with their existing apply-only retention policy.This removes 29 production lines net, the synthetic
#beforeHash-pinfile records, and duplicate retention rules. Cleanup operates on explicit sets of blob hashes and patch UUIDs rather than cloned patch records with rewritten hash fields. A real filename ending in#beforeHash-pincan no longer collide with a synthetic keep record. The artifact sweep also moves from the rollback command into core; commands retain their existing error reporting and partial-cleanup behavior.Validation on
2e403800:remove swept the remaining patch's rollback data) and passes after the change. It covers normalremove,remove --skip-rollback, and scopedrollback: remove one of two installed patches, verify the other's manifest and blobs survive, then restore it offline.remove,rollback,repair, rollback coverage, and in-process remove/repair; one existing test is ignored.-D warnings -A unused-variables; the allowance covers the existing macOS warning atpython_crawler.rs:1950. Strict CI Clippy also passed. Changed code is formatted andgit diff --checkpasses.Full CI, all compatibility workflows, and the benchmark comparison passed: all 486 checks and all 13 workflows completed without failure on the final commit. All 39 benchmark scenarios were classified unchanged. The PR has been converted from draft to a regular PR; the automatic Bugbot review passed with no findings.
Selected after refreshing all 146 open issues, six open PRs, and the 20-comment architecture discussion #560. No open PR covered #559. The discussion identifies duplicated removal/rollback orchestration; sharing its retention policy fixes data loss across package managers in one focused change. Development uses a separate worktree.
Note
Medium Risk
Changes post-command blob GC for remove, rollback, repair, and scan prune; incorrect retention could delete rollback data or leave orphans, though behavior is heavily tested and narrows a known data-loss bug.
Overview
Fixes #559 by unifying garbage-collection “keep” rules for
removeandrollbackso scoped removal no longer sweeps another active patch’s original (beforeHash) blobs, which broke later offline rollback (missing_blob).ArtifactReferencesin core replaces duplicated CLI logic (pin_before_hash_blobs, synthetic#beforeHash-pinmanifest rows, andsweep_unused_artifacts).after_removalkeeps patched bytes for remaining manifest entries, originals for those entries plus removed-but-not-installed (crawler-miss guard), and matching diff archives; only artifacts solely tied to successfully removed patches stay collectible.for_applydrivesrepairandscan --prunewith the existing apply-only policy. Sweeps use explicit hash/UUID sets viaArtifactReferences::sweep.Docs (CHANGELOG, CLI_CONTRACT) and integration/unit tests (including a remove/rollback lifecycle regression) document and lock in the shared retention behavior.
Reviewed by Cursor Bugbot for commit 2e40380. Configure here.
Generated by Claude Code