Phase 1: journaled rollback with staged trash - #15
Open
zackkitzmiller wants to merge 2 commits into
Open
Conversation
- deletions now move to <data_dir>/spindle/trash/<run-id>/ instead of being permanently removed; 'spindle --purge [--older-than N]' reclaims the space for real - every run writes an append-only journal (<data_dir>/spindle/journal/) recording moves and staged deletions; --undo reverses the latest run, --undo-run <id> targets one, --list-undo shows history - moves never overwrite: destination collisions auto-rename to 'name (1).ext' and the journal/ledger record the actual destination - cross-device moves fall back to copy + blake3 verify + remove - legacy .spindle_undo.json logs still restorable via --undo-log - reclaimable bytes now measured before staging (was always 0)
3 tasks
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.
Why
Rollback was not trustworthy: duplicate deletions were permanent (
remove_file) and never recorded in the undo log, the undo log was overwritten every run (only the last operation was reversible),fs::renamesilently overwrote existing destination files, cross-filesystem moves failed outright, and 'reclaimed bytes' was computed by stat-ing files after deleting them (always 0).Stacked on #14.
Changes
<data_dir>/spindle/trash/<run-id>/(mirroring original paths).spindle --purge [--older-than DAYS]permanently reclaims space and reports real bytes freed.<data_dir>/spindle/journal/<run-id>.jsonwith all moves + staged deletions.--undoreverses the latest run,--undo-run <id>targets a specific one,--list-undolists history with move/deletion counts and trash sizes. Undone journals are kept, renamed.undone.json.name (1).ext) — the journal and organized ledger record the actual destination; EXDEV falls back to copy + blake3 verification + source removal.--undo-log <path>still restores old-format.spindle_undo.jsonlogs.Test plan
cargo test— 349 passed (new: collision auto-rename, journal roundtrip incl. actual destinations, staged-deletion undo, purge byte accounting, purge age cutoff, undo-after-purge tolerance, legacy log restore)cargo clippy --all-targets— clean