Expand description
Selective rewind for a session’s checkpoint chain.
Reads checkpoints.jsonl, identifies which files this session
touched in turns >= the rewind cutoff, detects conflicts where the
current workspace state diverges from this session’s last known
post-snapshot for those files, and asks ShadowRepo::restore_paths
to revert only that file subset.
Multi-session safety: because restore_paths operates on a path
whitelist, files modified by a sibling session are never touched
unless they happen to also fall within this session’s touched set
(in which case the conflict is surfaced and the user must
--force).
Structs§
- Conflict
Report - Outcome of a [
rewind] call when conflicts were detected. - Rewind
Plan - Plan describing what a rewind would do, for a dry-run preview.
- Rewind
Result - Result of a successful rewind.
Functions§
- apply_
rewind - Apply a rewind plan: restore files, then truncate the checkpoint
log. Transcript truncation is left to the caller because it owns
transcript.jsonl. - checkpoint_
log_ path - Convenience: locate
checkpoints.jsonlfor a session given the workspace root and a session id. Mirrors the path layout chosen bySessionWriter. - detect_
conflicts - Check whether the workspace’s current state for the touched files matches the session’s last-known post-snapshot. Returns the list of conflicting paths (empty list = safe to proceed).
- plan_
rewind - Compute a
RewindPlanfor rewindingto_turn.