Skip to content

Checkpoints v2: Use checkpoint creation time for migration generation calc + lower default generation retention#1088

Merged
computermode merged 4 commits intomainfrom
update-rotation-generation-logic
Apr 30, 2026
Merged

Checkpoints v2: Use checkpoint creation time for migration generation calc + lower default generation retention#1088
computermode merged 4 commits intomainfrom
update-rotation-generation-logic

Conversation

@computermode
Copy link
Copy Markdown
Contributor

@computermode computermode commented Apr 30, 2026

https://entire.io/gh/entireio/cli/trails/273

  • Preserves original checkpoint created_at during v1 to v2 migration so retention age does not reset to migration/write time.
  • Updates v2 generation rotation to compute archive timestamps from checkpoint metadata, with raw transcript timestamps as fallback.
  • Updates cleanup to recompute v2 generation checkpoint times before trusting generation.json, fixing old migrated data.
  • Lowers the default full transcript generation retention from 60 days to 14 days.
  • Adds tests covering migration preservation, rotation timestamps, transcript fallback, cleanup eligibility, and settings defaults.
  • Updates clean --all to account for remote generation refs as well (based on the retention setting)
➜  entiredb git:(test) entire clean --all

Found 7 items to clean:

Archived v2 generations (7):
  0000000000008
  0000000000009
  0000000000010
  0000000000011
  0000000000012
  0000000000013
  0000000000014

✓ Deleted 7 items:

Archived v2 generations (7):
  0000000000008
  0000000000009
  0000000000010
  0000000000011
  0000000000012
  0000000000013
  0000000000014

Note

Medium Risk
Changes retention eligibility for v2 archived transcript generations by switching timestamp sources and reducing the default retention window, which could cause earlier-than-expected cleanup of stored transcripts if timestamp derivation is wrong or metadata is missing.

Overview
V2 checkpoint retention now uses the checkpoint’s original creation time instead of git commit time. WriteCommittedOptions adds CreatedAt, migration passes v1 created_at through, and both v1/v2 committed writers persist created_at via a shared helper.

Generation rotation and cleanup were updated to compute archived generation timestamp ranges by walking checkpoints: prefer v2 /main metadata.json created_at, fall back to parsing timestamp fields from raw transcript events, and only fall back to existing generation.json/commit history when needed.

The default full_transcript_generation_retention_days was lowered from 60 → 14, with tests added/updated to cover created-at preservation, timestamp computation fallbacks, and cleanup eligibility.

Reviewed by Cursor Bugbot for commit 22a87cd. Configure here.

Preserve the original checkpoint created_at when migrating v1 checkpoints into v2 so migration time does not reset retention age.

Derive archived generation timestamp ranges from v2 main metadata, with raw transcript timestamps as a fallback, and have cleanup recompute checkpoint ages before trusting generation.json.

Add coverage for migration timestamp preservation, archive rotation timestamps, transcript fallback, and cleanup retention eligibility.

Entire-Checkpoint: bc5c01c6ca8a
Change the full transcript generation retention fallback from 60 days to the intended 14-day window.

Update settings tests so unset, nil, and zero retention values resolve to 14 days while explicit custom values are preserved.

Entire-Checkpoint: 9bafba8019e7
Copilot AI review requested due to automatic review settings April 30, 2026 19:12
@computermode computermode requested a review from a team as a code owner April 30, 2026 19:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates checkpoints v2 retention and rotation logic so generation age is derived from checkpoint metadata (created_at) rather than migration/commit time, preventing retention windows from being reset during v1→v2 migration or ref repair. It also lowers the default archived full-transcript generation retention window.

Changes:

  • Preserve original checkpoint created_at during v1→v2 migration and committed metadata writes.
  • Compute archived generation timestamps from checkpoint metadata (with raw transcript timestamp fallback) and use this computation during cleanup eligibility checks.
  • Reduce the default full_transcript_generation_retention_days from 60 to 14 and update/add tests accordingly.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/entire/cli/strategy/cleanup.go Uses computed checkpoint timestamps for v2 generation cleanup eligibility, falling back to generation.json when needed.
cmd/entire/cli/settings/settings.go Lowers the default archived full-transcript generation retention to 14 days.
cmd/entire/cli/settings/settings_test.go Updates default-retention expectations from 60 to 14 days.
cmd/entire/cli/migrate.go Preserves v1 checkpoint CreatedAt when writing v2 checkpoints during migration.
cmd/entire/cli/migrate_test.go Adds a test asserting migration preserves checkpoint CreatedAt.
cmd/entire/cli/clean_test.go Adds test coverage ensuring retention eligibility uses checkpoint timestamps.
cmd/entire/cli/checkpoint/v2_generation.go Adds timestamp computation from checkpoint metadata/raw transcript and uses it during rotation.
cmd/entire/cli/checkpoint/v2_generation_test.go Adds tests for timestamp sourcing from metadata and raw transcript fallback.
cmd/entire/cli/checkpoint/v2_committed.go Writes committed metadata CreatedAt from provided options (preserving migration timestamps).
cmd/entire/cli/checkpoint/committed.go Adds a helper to consistently derive CreatedAt (option value or current time).
cmd/entire/cli/checkpoint/checkpoint.go Introduces WriteCommittedOptions.CreatedAt to carry original checkpoint creation time.

Comment thread cmd/entire/cli/checkpoint/v2_generation.go
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 22a87cd. Configure here.

Comment thread cmd/entire/cli/checkpoint/v2_generation.go
Have clean --all discover archived v2 full generations from the checkpoint remote, fetch remote-only or stale refs into temporary refs for timestamp inspection, and keep dry-run side-effect free.

Delete eligible archived v2 generation refs from both the local repository and the checkpoint remote using force-with-lease against the observed OID.

Add coverage for dry-running and force-deleting remote-only archived generations.

Entire-Checkpoint: 4e837ebcdfb0
Mark unreadable checkpoint trees as incomplete during v2 generation timestamp computation so callers fall back to generation.json instead of using partial derived ranges.

Add regression coverage for a mixed readable/unreadable generation tree.

Entire-Checkpoint: 74c42986449d
@computermode computermode merged commit 4d73c5d into main Apr 30, 2026
9 checks passed
@computermode computermode deleted the update-rotation-generation-logic branch April 30, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants