feat(library): add recoverable trash and explicit permanent purge [L2-04] - #61
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.
Closes #38
User outcome
Users can safely move papers to a recoverable Trash folder without losing notes, chats, annotations, or local files. Papers in Trash are hidden from normal library views, can be restored at any time, or can be permanently deleted with an explicit confirmation dialog that cleans up both SQLite metadata (via foreign key cascades) and on-disk files.
Acceptance criteria
trashed_atset to ISO timestamp).data/papers/<slug>safely with path traversal guards and atomically cascades deletion in SQLite.Automated verification
core/library/repo.test.ts: Added 5 new tests coveringtrashPaper,restorePaper,purgePaper, and filtering inlistPapers. (24 tests pass).core/store/migrate.test.ts: Updated to schema v7 migration assertingtrashed_atcolumn presence.core/store/db.test.ts: Updated expected database migration version to 7.src/app/TrashView.test.tsx: 6 new tests verifying loading, restoring, dialog modal opening, canceling, confirming purge, and error handling.src/app/Library.test.tsx: Added test verifying trash button moves paper to trash and updates UI.src/app/Sidebar.test.tsx: Added test verifying clicking Trash invokes navigation callback.src/app/App.test.tsx: Added test verifying switching to Trash view.npm run typecheckpassed with 0 errors.Live Electron verification
test/trash-live.mjs(npm run test:gate:trash) under xvfb.Visual and console evidence
Limitations and follow-ups
Independent review
fs,path) imported in renderer components; all filesystem and database mutations are handled viawindow.vellumpreload IPC bridge.purgePaperenforces slug validation regex/^[a-z0-9-]+$/iand verifies normalized absolute path prefix against the library papers directory, preventing directory traversal.