mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-09-14 00:55:08 +00:00
Running the Marmot headless harness against the embedded geode relay failed 10 of 29 scenarios, every one on the same reply: the relay answered a resent EVENT with ["OK", <id>, false, "Error code: 2067, message: UNIQUE constraint failed: event_headers.id"] NIP-01 says a relay that already holds the event answers ["OK", <id>, true, "duplicate: already have this event"], and every client here depends on that: amethyst's outbox writes an event as soon as the socket is ready and resends it when the connection finishes syncing, so one of the two copies is always a duplicate; MDK's wn counts a `duplicate:` prefix as idempotent success but files an unclassified OK false as "publish acknowledgement unknown" and keeps retrying. Both amy's group commits and wn's KeyPackage publish were failing on it, while nostr-rs-relay had answered the resend correctly. SQLiteEventStore now recognises the unique-index violation on event_headers.id and reports RejectionReason.DUPLICATE, the constant that already carried NIP-01's exact wording but was never produced; RelaySession sends `OK true` for a `duplicate:` reason and keeps `OK false` for every other rejection. The store outcome stays Rejected, so a duplicate is still not fanned out to live subscriptions or counted as a new write by the mirror worker and importer. The filesystem store already treated a duplicate insert as a no-op. Two tests pinned the old OK false behaviour (NostrServerTest, KtorRelayTest) and now assert the NIP-01 reply. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PguqnDbP2v11dtANs9xdxc