Skip to content

feat(deletion): Add soft-deletion with recovery and audit trail - #212

Open
DAcodedBEAT wants to merge 1 commit into
tailscale:mainfrom
DAcodedBEAT:delayed-deletion
Open

feat(deletion): Add soft-deletion with recovery and audit trail#212
DAcodedBEAT wants to merge 1 commit into
tailscale:mainfrom
DAcodedBEAT:delayed-deletion

Conversation

@DAcodedBEAT

Copy link
Copy Markdown

Users can safely delete links with a configurable recovery window, and a DeletedBy audit trail tracks who deleted each link. Soft-deletion can also provides a foundation for scaling golink across multiple instances (read: running golink as a tailscale service).

Changes

  • Soft-delete links with configurable retention before permanent removal
  • Undelete recovery at /.deleted endpoint
  • DeletedBy field tracks who deleted each link (visible in history)
  • Automatic schema migrations on startup - no manual migration steps needed
  • New CLI flags: -deleted-retention, -cleanup-interval

@mikeodr mikeodr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and the idea.

There's a lot to unpack here:

  • Unused code
  • Unrelated changes
  • Repetitive test code

This PR isn't ready in its current state, please clean it up and simplify.

Comment thread static/favicon.svg
Comment thread tmpl/all.html Outdated
Comment thread tmpl/base.html
Comment thread db_test.go Outdated
Comment thread db_test.go
- Configurable soft-delete with retention periods
- Undelete recovery for accidentally deleted links
- DeletedBy audit trail tracking who deleted links
- Automatic schema migrations for old databases
- /.deleted endpoint for link recovery
- Version history: edits preserve prior versions instead of overwriting

The soft-deletion pattern provides a foundation for scaling golink across
multiple instances with active/passive or active/active deployments.

Also fixes several correctness issues found in review (migration gaps,
same-second edit collisions, duplicate active links after undelete,
deleted names being claimable during their recovery window, and
incorrect/slow version history lookups), and cleans up and speeds up
the test suite.

Signed-off-by: Arun Philip <dacodedbeat@gmail.com>
Sign up for free to 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.

2 participants