You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure "but undo" only reverts the most recent non-restore command instead of stepping back multiple times. Previously the code always inspected the second snapshot which could point to a restore operation and cause undo to jump back further; now we fetch more snapshots, skip the current one, and select the first snapshot whose operation is not a RestoreFromSnapshot. If no such snapshot exists, we print a message and exit. This prevents undo from reverting more than the last actual user operation.
Undo: restore oplog head as undo target
Simplify the undo command to use the oplog head (the last operation before the current state) as the target to restore. The previous logic fetched many snapshots and attempted to skip restore operations to find a prior non-restore operation; this was more complex than necessary. Fetch only the last snapshot and treat it as the target, remove unused OperationKind import and the verbose current-operation printout. This makes undo behavior clearer and reduces snapshot traversal complexity.
Restore second-most recent snapshot instead of latest
The undo command was intended to restore the second-most recent
operation (i.e., step back one more change), but it only listed one
snapshot and selected the most recent.
Change to request two snapshots and validate that at least two exist,
then select snapshots[1] as the target. This ensures the command
restores the previous oplog entry instead of the current head.
0 commit comments