refactor(core): remove unused snapshot operations - #40687
Merged
Conversation
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.
What
Remove the confirmed-dead
Snapshot.preview -> Git.tree.previewandSnapshot.checkout -> Git.tree.checkoutchains while preserving snapshot capture, file listing, diffing, selective restore, path containment, and session revert behavior.Preview history
Snapshot.previewand its synthetic-indexGit.tree.previewimplementation 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, itsPreviewInput, temporary-index implementation,randomUUIDimport,"preview"snapshot error variant, and noop entry.Checkout history
Snapshot.checkoutandGit.tree.checkoutarrived 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 callSnapshot.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, andrestore; no migration or generated API update is required.How
previewandcheckoutfrom the private Snapshot and Git tree interfaces and implementations.restore, retaining the same containment check andSnapshot.Errormapping.Scope
Git.change.HttpApisurfaces.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 typecheckgit diff --checkbun turbo typecheck --concurrency=3(33 packages passed)