Add soft delete, gc, and doctor for bookmark catalogs - #20
Merged
Conversation
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Summary
Adds soft delete, garbage collection, and merge-doctor tooling to bookmarks, so a removal is reversible and post-merge duplicates are detected and auto-resolved. Completes the catalog-maintenance phase of the v2 hardening.
What's new
mark removestampsdeleted_atinstead of slicing the mark out, so a removal stays recoverable until garbage collection.mark ls --trashlists soft-deleted marks by their stablecatalog_id;mark restore --id(or--shelf/--collection/--url) clearsdeleted_at.book gcpurges marks soft-deleted past the retention window (30 days by default) behind a required--confirm.book doctor(aliasbook sync) reports duplicate marks, same-ID different-content conflicts, schema-v1 files, stale index entries, and stray.tmp/.bakdebris.book doctor --fixdedups identical merge artifacts and surfaces true conflicts for manual resolution.Usage
mark ls --trashmark restore --id <catalog_id>book gc [--retention-days 30]book doctor/book syncbook doctor --fix --confirmBehavior changes / guardrails
mark removenow soft-deletes instead of removing: the mark keepsdeleted_atand is hidden from list/get/search untilbook gcpurges it.book gcandbook doctor --fixboth require--confirmbecause they rewrite shelf files.book doctor --fixkeeps the first occurrence of an identical duplicate and skips index reconciliation when true conflicts remain, since the indexcatalog_idprimary key cannot represent duplicate IDs.book doctorflags schema-v1 files (pointing atbook migrate) and stale index entries (pointing atbook index sync).Testing
make checkruns fmt, vet, lint, and tests; all green.