Repository navigation
refactor(cleanup): extract version expiry into a pure module - #10908
Merged
Xuanwo merged 4 commits intoNov 15, 2026
Merged
Conversation
Move the "is version N expired?" decision out of CleanupTask into VersionExpiry, which takes legacy filters, retention rules, the current time, the thinning anchor, and protected versions, and classifies (version, timestamp) pairs without I/O. Thinning survivors are tracked by ThinningSurvivors instead of CleanupInspection. Rule semantics are now covered by synchronous unit tests, so the retention integration matrices are reduced to cases covering I/O wiring. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Document thinning, buckets and survivors at the module level, name the bucket key instead of using a bare tuple, and rename the survivor handle type parameter. Share the version-filter check with CleanupPolicy. Tests now check that survivors do not depend on listing order, and cover timestamp ties, tagged versions that a branch holds or the filters exclude, and keep_one underflow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
wjones127
marked this pull request as ready for review
November 10, 2026 23:14
Xuanwo
approved these changes
Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cleanup decided whether a version expires in several places in
CleanupTask(runmutatingpolicy.before_timestamp,cleanup_candidates,process_manifest_file,bucket_survivorsinCleanupInspection,CleanupPolicy::proven_expired). The only way to test retention semantics was to write real versions to a real dataset. This PR moves that decision intocleanup/expiry.rs, which does no I/O:CleanupTaskstill does the I/O: it resolves the anchor from the version hint (nowresolve_thinning_anchor), lists manifests, and re-reads one survivor per bucket. Behavior is unchanged.Answers to the issue's open questions:
before_timestampandRemoveAllcombine into one cutoff, sorunno longer mutates the policy.CleanupPolicy; that's a public API change and can be a separate PR.Evidence
Rule semantics (ladder, independent bands, per-period buckets, hint anchoring,
RemoveAllvs. samples, filters, tags, branch-held and detached versions, the version-only fast path, out-of-range ages) are now covered by 29 synchronous tests inexpiry::tests, which also check that survivors do not depend on manifest listing order. The retention integration matrices drop from 32 cases to 8, keeping one case for each I/O path they exercise (config parsing, hint reads, pinned snapshots, tag/filter wiring,delete_unverified).cleanup_retention_bands_have_independent_bucketsis now only a unit test.Cleanup test runtime (
dataset::cleanup::,--test-threads=1, debug build, 3 runs each on the same machine, both on1b89c0041):Most of what's left in the cleanup suite is branch-lineage and managed-blob I/O, which this PR doesn't touch.
Those timings are a historical measurement on
1b89c0041; they were not re-run on the integrated tree.Merged with
mainat1e6aa0b, which includes thefile_verdictextraction from #10906, so both modules coexist with theirVerdicttypes aliased at the integration boundary. The expiry, retention andfile_verdictsuites plus the workspace check, format and clippy gates pass on the integrated tree.Merge Risk
Door: One-way in effect. This is an internal refactor with no API or format change, but it sits on the path that deletes data, so a semantic slip would delete versions.
Blast Radius: cleanup (auto-cleanup,
cleanup_old_versions, retention policies, branch cascade).Fixes #10904
🤖 Generated with Claude Code