Skip to content

Remove checkpoint_version from checkpoint metadata#1620

Merged
Soph merged 5 commits into
mainfrom
remove-checkpoint-version-from-metadata
Jul 3, 2026
Merged

Remove checkpoint_version from checkpoint metadata#1620
Soph merged 5 commits into
mainfrom
remove-checkpoint-version-from-metadata

Conversation

@pfleidi

@pfleidi pfleidi commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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

Why

The checkpoint_version stamp in each checkpoint's root metadata.json was a pure label: which storage backend serves a checkpoint is decided by the settings topology, and nothing ever dispatched on the stored value. The EnsureCanReadVersion read gates at resume/explain/rewind/export were forward-compat tripwires that could only fire for checkpoint formats that never shipped. Both are dead complexity — every reader had to thread a version through code that had exactly one possible answer.

Existing checkpoints' stored checkpoint_version values are handled by an external migration, so no backward-compat handling for the stored attribute is needed here.

What changed

Removed the read gates first (they read the field), then the field itself: WriteOptions.CheckpointVersion, CheckpointSummary.CheckpointVersion, the stamping plumbing through the write chain, the read-side backfill (normalizeCheckpointSummary), and the now-unused CheckpointVersionRefsV1 constant. Two follow-up cleanups: the hidden entire checkpoint policy help text now describes checkpoint_version as a write guard rather than a format selector, and the branch↔refs seam test regained a primary-read discriminator.

Decisions made during development

  • The checkpoint policy subsystem is intentionally untouched. Its checkpoint_version field remains a checkpoint-data write guard (CanSatisfyPolicy): a repo can still block writes from CLIs that don't support the configured version. It just no longer feeds a stamp into new summaries. attach switched from the deleted checkpointVersionForNewCheckpoint to the shared ensureCheckpointPolicyAllowsCheckpointData gate that explain and import already use.
  • CheckpointVersionBranchV1 stays — it anchors the policy defaults (DefaultPolicy, Normalize); only the refs-v1 constant became unused.
  • The seam test needed a new probe. Dropping the version assert removed the only signal distinguishing a read served by the git-refs primary from one served by the git-branch mirror. The test now deletes the mirror's v1 branch and asserts the composed store still serves full reads — something only the primary can do.

Reviewer notes

  • Existing checkpoints and existing policy refs are left as-is; the stored-field cleanup ships as an external migration.
  • Commits are ordered to be reviewable independently (gates → field → help text → seam test) and can be split into a stack if preferred.

Note

Medium Risk
Touches resume/rewind/explain/export and checkpoint persistence; behavior change is intentional but broad across user-facing flows. Stored-field cleanup for old checkpoints is assumed to happen outside this PR.

Overview
Removes checkpoint_version from checkpoint root metadata.json and from the write path: WriteOptions, CheckpointSummary, stamping in branch/refs stores, and normalizeCheckpointSummary backfill on read. Drops CheckpointVersionRefsV1 and checkpointpolicy.EnsureCanReadVersion / IsUnsupportedVersion, so resume, rewind, explain, and export no longer fail on per-checkpoint format labels.

entire session attach now uses ensureCheckpointPolicyAllowsCheckpointData instead of checkpointVersionForNewCheckpoint (policy still gates writes via CanSatisfyPolicy, but no longer chooses a version to stamp). Manual-commit condensation stops passing CheckpointVersion into writes.

Docs and entire checkpoint policy help describe checkpoint_version as a write guard, not a metadata format selector. The branch↔refs seam test deletes the v1 mirror branch and asserts reads still work via the git-refs primary.

Reviewed by Cursor Bugbot for commit dca2300. Configure here.

pfleidi added 4 commits July 2, 2026 16:48
Drop the EnsureCanReadVersion gates at resume/explain/rewind/export and
the unreachable IsUnsupportedVersion error branches behind them. The
gates were forward-compat tripwires for checkpoint formats that never
shipped; checkpoint_version is a pure label nothing dispatches on.

Also drop two ReadCheckpoint calls that existed only to feed the gate —
ReadRawSessionLogForCheckpoint already reads the checkpoint itself.

Entire-Checkpoint: be8f0bd2169e
Remove the checkpoint_version stamp from checkpoint metadata.json. It
was a pure label: backend selection comes from settings topology, and
nothing dispatched on the stored value. Existing checkpoints are
handled by an external migration.

The checkpoint policy subsystem is untouched — its checkpoint_version
field remains a checkpoint-data write guard (attach now calls the
shared ensureCheckpointPolicyAllowsCheckpointData gate like explain
and import), it just no longer feeds a stamp into new summaries.

Entire-Checkpoint: e2a3a0318080
Nothing selects a checkpoint metadata format from the policy's
checkpoint_version anymore; it only gates checkpoint-data writes.
Align the hidden policy command's help text with the architecture
doc's write-guard wording.

Entire-Checkpoint: 582cbad18ece
Removing the checkpoint_version assert left the seam test unable to
tell whether reads came from the git-refs primary or the git-branch
mirror — both stores now return identical content. Probe it directly
instead: delete the mirror's v1 branch and assert the composed store
still serves full reads, which only the primary can.

Entire-Checkpoint: afcc38e41a31
Copilot AI review requested due to automatic review settings July 3, 2026 00:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 removes the checkpoint_version field from checkpoint root metadata.json summaries and deletes the associated “read gate” logic that previously rejected checkpoints based on a stored per-checkpoint version. The repository-level checkpoint policy remains in place as a write guard (enforcing whether this CLI can write checkpoint data under the configured policy), but no longer drives any per-checkpoint stamping or read-time dispatch.

Changes:

  • Removed read-side version gating from resume/explain/rewind/export paths (and deleted the gating implementation).
  • Removed checkpoint_version from checkpoint summary/write plumbing (WriteOptions, summary stamping, legacy backfill/normalization) and dropped the now-unused refs-v1 constant.
  • Updated documentation/help text to clarify checkpoint_version is a checkpoint-data write guard, and updated the refs↔branch seam test to validate primary-read behavior via mirror deletion.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
docs/architecture/sessions-and-checkpoints.md Removes checkpoint_version from root metadata example; clarifies policy semantics and removes read-gate language.
cmd/entire/cli/strategy/manual_commit_rewind.go Removes checkpoint-version read gate during logs-only restore.
cmd/entire/cli/strategy/manual_commit_condensation.go Stops stamping checkpoint version into written summaries.
cmd/entire/cli/rewind.go Removes per-checkpoint version gating in rewind restore path.
cmd/entire/cli/resume.go Removes unsupported-version branching and read gates; restores directly from stored transcript bytes.
cmd/entire/cli/resume_test.go Deletes tests asserting unsupported per-checkpoint version handling.
cmd/entire/cli/explain.go Removes read gate before reading checkpoint content for explain.
cmd/entire/cli/explain_test.go Deletes unsupported checkpoint-version rejection test.
cmd/entire/cli/explain_export.go Removes read gates for transcript/JSON export.
cmd/entire/cli/explain_export_test.go Removes helper and tests that rewrote/stubbed unsupported checkpoint versions.
cmd/entire/cli/checkpointpolicy/version.go Deletes the unsupported-version sentinel + EnsureCanReadVersion implementation.
cmd/entire/cli/checkpoint/refs_store.go Removes version stamping parameter from write path into refs store.
cmd/entire/cli/checkpoint/refs_store_test.go Removes assertion on summary checkpoint version in refs store tests.
cmd/entire/cli/checkpoint/refs_store_seam_test.go Updates seam assertions and adds a “reads resolve from primary” probe by deleting the mirror branch.
cmd/entire/cli/checkpoint/persistent.go Removes checkpoint-version stamping and legacy normalization/backfill in summary reads/writes.
cmd/entire/cli/checkpoint/persistent_write_test.go Removes tests asserting written checkpoint_version behavior.
cmd/entire/cli/checkpoint/persistent_update_test.go Removes helpers/tests that rewrote or backfilled legacy checkpoint_version.
cmd/entire/cli/checkpoint/persistent_tripwire_test.go Updates call signature after removing checkpointVersion parameter.
cmd/entire/cli/checkpoint/persistent_reader.go Removes normalizeCheckpointSummary (legacy checkpoint_version backfill).
cmd/entire/cli/checkpoint/aliases.go Drops CheckpointVersionRefsV1 alias.
cmd/entire/cli/checkpoint_policy.go Updates help text to describe checkpoint_version as a write guard.
cmd/entire/cli/checkpoint_policy_write.go Removes helper that derived a “new checkpoint version”; relies on existing policy gate instead.
cmd/entire/cli/checkpoint_policy_test.go Updates help-text assertion accordingly.
cmd/entire/cli/checkpoint_policy_read_test.go Removes test that asserted read-side rejection of unsupported checkpoint versions.
cmd/entire/cli/attach.go Switches attach flow to policy gate without selecting/stamping a checkpoint version.
api/checkpoint/metadata.go Removes CheckpointVersion from WriteOptions and CheckpointSummary JSON schema.
api/checkpoint/errors.go Removes CheckpointVersionRefsV1 constant.

@pfleidi pfleidi requested a review from Copilot July 3, 2026 00:38
After the checkpoint_version metadata field was removed, the exported
CheckpointVersionBranchV1 constant no longer described anything in
api/checkpoint; its only consumer was checkpointpolicy's defaults,
reached through a re-export in the cli checkpoint alias file. Define
the constant in checkpointpolicy next to the format vocabulary that
already owns it and drop the api const and alias, matching what the
CheckpointVersionRefsV1 removal already did.

Also fold the AuthorReader interface into persistent.go (the file
holding it had shrunk to that single declaration) and reuse the
v1BranchRef test helper in the seam test instead of rebuilding the
ref name inline.

Entire-Checkpoint: b417d0acc17a
@pfleidi

pfleidi commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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 dca2300. Configure here.

@pfleidi pfleidi marked this pull request as ready for review July 3, 2026 00:40
@pfleidi pfleidi requested a review from a team as a code owner July 3, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated no new comments.

@Soph Soph merged commit 286f498 into main Jul 3, 2026
10 checks passed
@Soph Soph deleted the remove-checkpoint-version-from-metadata branch July 3, 2026 13:21
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.

4 participants