Skip to content

Add soft delete, gc, and doctor for bookmark catalogs - #20

Merged
polymorcodeus merged 4 commits into
mainfrom
qol-tooling
Aug 25, 2026
Merged

Add soft delete, gc, and doctor for bookmark catalogs#20
polymorcodeus merged 4 commits into
mainfrom
qol-tooling

Conversation

@polymorcodeus

Copy link
Copy Markdown
Owner

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

  • Soft delete - mark remove stamps deleted_at instead of slicing the mark out, so a removal stays recoverable until garbage collection.
  • Trash + restore - mark ls --trash lists soft-deleted marks by their stable catalog_id; mark restore --id (or --shelf/--collection/--url) clears deleted_at.
  • Garbage collection - book gc purges marks soft-deleted past the retention window (30 days by default) behind a required --confirm.
  • Merge doctor - book doctor (alias book sync) reports duplicate marks, same-ID different-content conflicts, schema-v1 files, stale index entries, and stray .tmp/.bak debris.
  • Auto-merge - book doctor --fix dedups identical merge artifacts and surfaces true conflicts for manual resolution.

Usage

CommandPurpose
mark ls --trashlist soft-deleted marks
mark restore --id <catalog_id>restore a trashed mark
book gc [--retention-days 30]purge expired soft-deleted marks
book doctor / book syncreport catalog health
book doctor --fix --confirmauto-merge duplicate marks

Behavior changes / guardrails

  • mark remove now soft-deletes instead of removing: the mark keeps deleted_at and is hidden from list/get/search until book gc purges it.
  • book gc and book doctor --fix both require --confirm because they rewrite shelf files.
  • Duplicate classification is content-addressed: identical title, tags, and deleted state auto-merge; any difference becomes a manual conflict.
  • book doctor --fix keeps the first occurrence of an identical duplicate and skips index reconciliation when true conflicts remain, since the index catalog_id primary key cannot represent duplicate IDs.
  • book doctor flags schema-v1 files (pointing at book migrate) and stale index entries (pointing at book index sync).

Testing

  • Unit tests cover duplicate detection and conflict classification, auto-merge resolution, schema-v1 detection, stray debris, and index staleness.
  • make check runs fmt, vet, lint, and tests; all green.

@polymorcodeus
polymorcodeus merged commit 84c24a4 into mainAug 25, 2026
4 checks passed
@polymorcodeus
polymorcodeus deleted the qol-tooling branch August 25, 2026 17:05
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@polymorcodeus