Inbox misses reaction notifications until the reacted post is visited (relay mismatch) #43
Labels
No labels
bug
discussion
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
edufeed/edufeed-app#43
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
A reaction to one of my comments did not appear in the dashboard inbox (Posteingang). After visiting the post where the comment lives (nevent1qvzqqqqqqypzpjpc8kqa6fzqvazmdpqfheqdvusuxqgzj3jqvl7v2z39mhu3892fqythwumn8ghj7un9d3shjtnswf5k6ctv9ehx2ap0qy2hwumn8ghj7un9d3shjtnyv9kh2uewd9hj7qpq3x5puhcd7gj8f748vz5xcf9pxmnf2qd7nyc8nm8m4sa3ka9wsfgs9yucek), the reaction notification ("Sync hat auf ... reagiert", 42m old) suddenly showed up in the inbox.
Root cause
Relay mismatch between where reactions are published and where the inbox loader queries:
publishReactioninsrc/lib/helpers/reactions.js→publishEventOptimisticinsrc/lib/services/publish-service.js).kindToAppRelayCategory(7)returnsnull, so no app relay is added.src/lib/services/inbox-service.svelte.js,getNotificationRelays()) only queriesgetCommunikeyRelays() + getCalendarRelays() + getEducationalRelays()— it never queries the logged-in user's own NIP-65 read relays.{ kinds: [7], '#p': [pubkey] }) is correct — applesauce's ReactionBlueprint always p-tags the target author, also for kind-1111 comments. The event simply lives on relays the inbox never asks.Why visiting the post "fixes" it: the post page's
ReactionBarmountsreactionsLoader(src/lib/loaders/reactions.js), which additionally queriesgetReadRelays(commentAuthor)— i.e. exactly the user's read relays where the reaction was published. The event lands in the shared EventStore and the inbox's reactiveeventStore.model(...)subscription surfaces it immediately.Fix direction
Include the logged-in user's NIP-65 read (inbox) relays in
getNotificationRelays()ininbox-service.svelte.js, mirroring whatreactionsLoaderalready does.Related cosmetic bug (same surface)
Reaction notifications render as "hat auf reagiert" with an empty gap:
inbox/+page.sveltenever computes/passescontentTitletoInboxItem, som.inbox_action_reaction({ contentTitle })interpolates an empty string.Fixed in
d6139781, merged to dev.What was verified against live relays before shipping:
+byc8383d81…) exists only onwss://nos.lolandwss://relay.primal.net— the reactor's client published to its own write relays, not to the user's NIP-65 read relays (haven.laoc.xyz,theforest.nostr1.com,relay.mostr.pub).GATED_MODE_DEFAULT=true, the inbox queried only edufeed relays, sonos.lolwas never asked.Fix (two layers):
getNotificationRelays()now always unions the fallback relays via newgetNotificationFallbackRelays()— intentionally ungated (decision by @steffen: notifications are p-tagged personal signals, mirroring the WoT social-content exemption).initializeInbox()additionally spawns a supplemental loader on the user's own NIP-65 read relays once they resolve, for outbox-compliant clients.Simulating the fixed REQ found the Sync reaction plus two older
+reactions (74h, 124h) that were also invisible.Still open (cosmetic): reaction items render as "hat auf reagiert" with an empty gap because the inbox page never passes
contentTitletoInboxItem— left for a follow-up.