Skip to content

fix: a delete that only a backup still holds succeeds and names the backup - #345

Merged
varun369 merged 1 commit into
mainfrom
fix/delete-backup-residue
Nov 20, 2026
Merged

varun369 merged 1 commit into
mainfrom
fix/delete-backup-residue

Conversation

@varun369

Copy link
Copy Markdown
Member

What was wrong

When a backup snapshot was taken after a memory was stored, DELETE /api/memories/{id} removed and tombstoned the memory, journalled the erasure outside the backups, and then answered 503 retry because the snapshot still held a copy. Retrying could never succeed while the snapshot existed (#342).

What changes

  • core/mutations._finalize_erasure: when backup_copies is the only unproven owner, the receipt is persisted and the fact is tombstoned, the erasure counts as done outside the backups. The delete returns ok with backup_obligations_pending (number of snapshots).
  • erasure_verified stays false until the backups are gone, and the receipt still records the obligation. No change to what is erased.
  • A restore journal that could not be written still answers retryable: without it a restore would bring the memory back.
  • The dashboard delete route returns backup_obligations_pending.

Safety precondition checked: restore replays the erasure journal (infra/backup.py → erased_subjects.replay_all, covered by tests/test_infra/test_restore_replays_targeted_erasures.py).

Test plan

  • New: backup-held delete succeeds and names the backup; unwritten journal stays retryable; no backup → no obligation (red before, green after)
  • 29 delete/erasure test files: 211 passed, 1 skipped
  • Full suite on GitHub before release

Refs #342

🤖 Generated with Claude Code

…ackup

DELETE /api/memories/{id} removed and tombstoned the memory and journalled
the erasure outside the backups, then answered 503 "retry" because a backup
snapshot still held a copy. Every retry got the same answer for as long as the
snapshot existed, so a client following Retry-After never saw success.

When backups are the only owner still holding the memory and the restore
journal was written, the delete now succeeds and reports
backup_obligations_pending; a restore replays the journal and removes the
memory again. erasure_verified stays false until the backups are gone, and the
receipt still records them. A journal that could not be written stays a
retryable failure, because a restore would then bring the memory back.

Refs #342

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@varun369
varun369 merged commit d184257 into main Nov 20, 2026
7 checks passed
@varun369
varun369 deleted the fix/delete-backup-residue branch November 20, 2026 20:49
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.

1 participant