From 165787d134fc6793fee25c34b384e18401d6cdd1 Mon Sep 17 00:00:00 2001 From: Padreug Date: Sat, 26 Sep 2026 23:34:47 +0200 Subject: [PATCH] fix(nostr): log publish skips at WARNING instead of silently MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both paths that decline to publish a NIP-52 calendar event were invisible at the INFO level instances actually run at: the `signer is None` branch returned bare with no log at any level, and the missing-client branch logged at debug. A skipped publish leaves the relay serving whatever inventory it last saw, so the public ticket count stops tracking the DB with nothing to indicate it. That has now been found twice, both times only because a human noticed a wrong number on a public page — #35 on aio-demo, and on cfaun where an event drifted for 14 days and produced no log line at all, success or failure. Both messages name the event id and whether it was a publish or a delete, so a skip can be tied to a specific event without correlating timestamps by hand. Refs #51 --- nostr_hooks.py | 16 +++++++++++++--- nostr_publisher.py | 9 ++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/nostr_hooks.py b/nostr_hooks.py index 32ea11c..1d0d1c4 100644 --- a/nostr_hooks.py +++ b/nostr_hooks.py @@ -32,9 +32,19 @@ async def publish_or_delete_nostr_event(event: Event, *, delete: bool = False) - if signer is None: # Wallet missing, account missing, unclassified row, or # ClientSideOnlySigner account (server can't sign for them). - # Soft-fail: skip the publish silently. The user can still - # publish kind-31922/31923 events client-side once we have - # that path. + # Soft-fail: the HTTP / payment flow that triggered this must + # not break. The user can still publish kind-31922/31923 + # events client-side once we have that path. + # + # Logged at WARNING, not debug: skipping the publish means the + # relay keeps serving whatever inventory it last saw, so the + # public ticket count silently stops tracking the DB. That has + # twice been discovered only by a human noticing a wrong number + # on a public page (aiolabs/events#35, #51). + logger.warning( + f"[EVENTS] No signer for wallet {event.wallet}, skipping " + f"NIP-52 {'delete' if delete else 'publish'} for event {event.id}" + ) return nostr_event = await publish_event_to_nostr( diff --git a/nostr_publisher.py b/nostr_publisher.py index 8374a62..c961b80 100644 --- a/nostr_publisher.py +++ b/nostr_publisher.py @@ -172,7 +172,14 @@ async def publish_event_to_nostr( Returns the published NostrEvent for metadata storage, or None on failure. """ if not nostr_client: - logger.debug("[EVENTS] No NostrClient available, skipping publish") + # WARNING, not debug: with no client the event is never queued, so + # the relay keeps serving stale inventory and nothing downstream + # can tell. At debug this skip is invisible at the INFO level + # instances actually run at (aiolabs/events#35, #51). + logger.warning( + "[EVENTS] No NostrClient, skipping NIP-52 " + f"{'delete' if delete else 'publish'} for event {event.id}" + ) return None try: -- 2.55.0