mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
Reorder amy sync so both sides fully reflect each other, including deletions: 1. Deletion side-channel now runs FIRST, before content, in both directions. The content snapshot is taken AFTER it, closing a resurrection bug: a deletion pulled down mid-sync removes a local event, but the old top-of-run snapshot still listed it and would re-offer it up — resurrecting it on a relay that also lacked the deletion. 2. Content reconcile, over the post-deletion snapshot. 3. Reject-reaction backstop: when the relay blocks a content push (usually it holds a deletion we lack), pull that author's kind-5/62 and ingest locally so we stop re-offering the dead event. Verify-by-fetch — only a real deletion the store accepts has any effect; fires only on an actual reject. The up-push of deletions is already verified per-event: ctx.publish awaits the relay's OK, and ingesting the kind-5 runs the delete synchronously, so OK=true confirms the remote applied it. Mirror catch-up gets the same deletions-first ordering (down and up), so a deletion lands, or the reject-trigger is armed, before its target — no add-then-delete churn. Tests: MirrorDeletionSyncTest gains scopedUpMirrorPushesDeletion (authoritative push — local holds the deletion, remote drops the note). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JgL1WTV4Hkp2uuXcUHCHGt