mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 16:33:27 +00:00
Refine the sync deletion rule to what was asked: for the events the relay HAS that we LACK (the reconcile need set), publish only the local deletions that would actually make the relay remove them — and nothing else, not other deletions by the same author. Determining coverage needs the need event's author/address/created_at, which we don't have for an id we lack, so we fetch the need events (raw — no verify, no store) purely for metadata. quartz gains IEventStore.deletionsCovering(events, relay), which maps server-held events to the covering local deletions across all three forms: - NIP-09 id-based: a kind-5 with an `e` tag naming the event id; - NIP-09 address-based: a kind-5 with an `a` tag naming the event's addressable/replaceable coordinate, at/after it (created_at <= deletion); - NIP-62 vanish: a kind-62 by the event's author, targeting this relay, issued after it (created_at < vanish). SyncCommand's need workers now fetch each need batch once (Context.fetchRaw), publish its covering deletions (deduped across workers), and — when --down — store the rest; anything we deleted is rejected by the store's own tombstone. Nothing is pulled down or applied locally, so it cannot over-delete the store. DeletionSyncTest covers each form (with cutoff and wrong-relay negatives) plus an end-to-end reconcile → cover → publish that removes the note on the relay. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JgL1WTV4Hkp2uuXcUHCHGt