Checkpoints V2: add retention-based cleanup for v2 transcript generations in entire clean#972
Merged
gtrrz-victor merged 22 commits intomainfrom Apr 18, 2026
Merged
Conversation
Entire-Checkpoint: 1d86b510c97e
Entire-Checkpoint: d2afbeef44a4
Entire-Checkpoint: b508576acd78
Entire-Checkpoint: 23a21b58cc64
Entire-Checkpoint: 4a1d090877e3
Entire-Checkpoint: a44570f1581f
Entire-Checkpoint: 4f1622d20eb0
…wap deletion Entire-Checkpoint: 5cea6688245b
Entire-Checkpoint: 9d8aa5f6bc72
entire clean
Contributor
There was a problem hiding this comment.
Pull request overview
Adds retention-based cleanup for archived checkpoints v2 “/full/*” transcript generations to the existing entire clean --all flow, with safety guards (malformed generation warnings, packed-ref-safe deletion, and compare-and-swap ref deletion) and settings support.
Changes:
- Add
DeleteRefCLI(CAS-capable) for reliable custom-ref deletion viagit update-ref -d, plus new error types. - Add v2 generation eligibility listing + deletion to cleanup strategy, driven by a retention-days setting.
- Update
cleancommand help/output and add tests for v2 cleanup behavior and settings parsing.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/strategy/common.go | Adds DeleteRefCLI and new ref-related errors for CLI-based deletion with optional OID CAS. |
| cmd/entire/cli/strategy/cleanup.go | Introduces listing/deleting eligible archived v2 generations and threads ref OIDs through cleanup items/results. |
| cmd/entire/cli/strategy/clean_test.go | Adds unit tests covering packed-ref deletion and OID mismatch rejection for DeleteRefCLI. |
| cmd/entire/cli/settings/settings.go | Adds GetFullTranscriptGenerationRetentionDays() with a default retention window. |
| cmd/entire/cli/settings/settings_test.go | Adds tests for retention-days settings parsing/defaulting behavior. |
| cmd/entire/cli/clean.go | Gates v2 cleanup help text behind checkpoints_v2, lists eligible v2 generations in --all, and reports results. |
| cmd/entire/cli/clean_test.go | Adds command-level tests for v2 generation cleanup behaviors (retention, malformed metadata warnings, deletion). |
Extract printSection/printResultSection helpers to reduce runCleanAllWithItems complexity. Add nolint directives for intentional nilerr and unparam patterns. Vary generation names across tests to satisfy unparam linter. Entire-Checkpoint: bec5f308ed0a
Map ref deletion failures via ref-state checks to return stable ErrRefNotFound/ErrRefChanged semantics, and add focused ref-state test coverage. Keep intentional interface-return lint annotation explicit for summary generator factory. Entire-Checkpoint: de6e6f0b0a54
Preserve warning prefixes while appending underlying ref/generation read errors so skipped archived generations are diagnosable. Add regression coverage for unreadable archived generation refs in clean command output. Entire-Checkpoint: 70d51cce0069
Contributor
Author
|
Bugbot run |
computermode
previously approved these changes
Apr 17, 2026
Soph
reviewed
Apr 17, 2026
Entire-Checkpoint: 8fb802a1b169
Entire-Checkpoint: c0ac7e34534f
Entire-Checkpoint: 8fc9c8325e12
Entire-Checkpoint: 84e71a622034
Contributor
Author
|
Bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 70ab784. Configure here.
Entire-Checkpoint: 524fe7277c6b
Entire-Checkpoint: c69a307d5c50
Entire-Checkpoint: 8d5c46f279d2
Contributor
|
Tested and it's working!! 🦾 |
Soph
approved these changes
Apr 18, 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
entire clean --allsupport for deleting archived v2 transcript generations past the configured retention window (default 60 days)git update-ref -dvia CLI instead of go-git'sRemoveReferenceto handle packed refs correctlyGetFullTranscriptGenerationRetentionDays()settings helperentire clean --helpbehind thecheckpoints_v2feature flagDetail
Archived
/full/*generation refs accumulate over time as transcript data is rotated. This PR adds a cleanup path gated behind thecheckpoints_v2feature flag and thefull_transcript_generation_retention_dayssetting.Safety invariants:
generation.json, incomplete timestamps, inverted timestamps) are skipped with warnings to stderrCleanupItem→V2GenerationRef→DeleteRefCLI, sogit update-ref -d <ref> <old-oid>refuses deletion if the ref was repointed between enumeration and deletionRemoveReferenceis replaced withgit update-ref -dvia CLI to handle packed refs correctly (same class of go-git v5 bug as checkout/reset)Test plan
mise run checkpasses (fmt + lint + unit + integration tests)TestCleanCmd_All_ForceDeletesEligibleV2Generations— happy path deletionTestCleanCmd_All_DryRunSkipsV2GenerationsWithinRetention— retention preservedTestCleanCmd_All_ForceSkipsV2GenerationMissingMetadata— malformed skipped with warningTestCleanCmd_All_ForceSkipsV2GenerationWithInvalidTimestamps— invalid timestamps skippedTestDeleteRefCLI_DeletesPackedCustomRef— packed ref deletion worksTestDeleteRefCLI_RejectsOIDMismatch— CAS rejects stale OIDTestGetFullTranscriptGenerationRetentionDays— settings helperTestCleanLongDescription_DefaultIsGeneric— help text without v2TestCleanLongDescription_IncludesV2CleanupWhenEnabled— help text with v2Note
Medium Risk
Touches repo-cleanup and git ref-deletion paths; while guarded by feature flag, retention checks, and OID compare-and-swap, bugs could still lead to unintended ref cleanup or missed deletions.
Overview
entire clean --allnow (whencheckpoints_v2is enabled) enumerates archived checkpoints v2/full/*generations and deletes only those older than a configurable retention window, emitting warnings (to stderr) for malformed/unreadable generations instead of deleting them.Cleanup plumbing is extended with a new
v2-generationcleanup type that carries an observed ref OID through listing to deletion, and introducesDeleteRefCLI(viagit update-ref -d) with optional compare-and-swap semantics to reliably and safely delete packed refs. Thecleanhelp text is updated to mention v2 cleanup only when the feature flag is enabled, and output formatting is refactored for clearer sectioned previews/results.Adds
settings.GetFullTranscriptGenerationRetentionDays()(default60) plus comprehensive CLI/strategy/settings tests covering retention behavior, warnings, packed-ref deletion, and OID mismatch protection.Reviewed by Cursor Bugbot for commit 70ab784. Configure here.