Skip to content

refactor(core): remove unused snapshot operations - #40687

Merged
kitlangton merged 1 commit into
v2from
trim-snapshot-ops
Aug 5, 2026
Merged

refactor(core): remove unused snapshot operations#40687
kitlangton merged 1 commit into
v2from
trim-snapshot-ops

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Remove the confirmed-dead Snapshot.preview -> Git.tree.preview and Snapshot.checkout -> Git.tree.checkout chains while preserving snapshot capture, file listing, diffing, selective restore, path containment, and session revert behavior.

Preview history

Snapshot.preview and its synthetic-index Git.tree.preview implementation were introduced with the V2 snapshot system in #33226. They never gained a production caller; only the direct Git and Snapshot tests exercised them. This removes that test-only API, its PreviewInput, temporary-index implementation, randomUUID import, "preview" snapshot error variant, and noop entry.

Checkout history

Snapshot.checkout and Git.tree.checkout arrived in the same snapshot-system change as a legacy whole-index checkout primitive. The V2 session revert flow never called it; its only caller was the dedicated legacy checkout test. This removes the unused whole-tree chain and noop entry independently from selective restore.

Staged selective restore

Staging and clearing session reverts already build Map<RelativePath, Snapshot.ID> restore plans and call Snapshot.restore. That path remains unchanged, including per-file tree selection, deletion when a selected tree lacks a path, and containment rejection for paths escaping the project.

Persisted data

This does not change snapshot ID encoding, session/message schemas, stored revert payloads, snapshot repository layout, or captured Git trees. Existing persisted snapshot IDs remain valid inputs to files, diff, and restore; no migration or generated API update is required.

How

  • Remove preview and checkout from the private Snapshot and Git tree interfaces and implementations.
  • Simplify the restore planner now that it serves only restore, retaining the same containment check and Snapshot.Error mapping.
  • Remove only assertions and the standalone test dedicated to the deleted APIs.

Scope

  • Core is private, so no changeset is included.
  • Does not modify Git.change.
  • Does not modify stale move documentation.
  • Does not alter session revert planning, staging, clearing, committing, projection, or persisted snapshot IDs.
  • Does not change public Protocol or Server HttpApi surfaces.

Testing

  • cd packages/core && bun run test test/git.test.ts test/snapshot.test.ts test/session-prompt.test.ts test/session-projector.test.ts (61 passed)
  • cd packages/core && bun typecheck
  • git diff --check
  • Push hook: bun turbo typecheck --concurrency=3 (33 packages passed)

@kitlangton
kitlangton merged commit faadc05 into v2Aug 5, 2026
10 checks passed
@kitlangton
kitlangton deleted the trim-snapshot-ops branch August 5, 2026 17:01
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@kitlangton