From 5001d4a27aef9c82428ee7623192e716312ce1a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Jul 2026 21:25:29 +0000 Subject: [PATCH] test(notifications): cover Buzz reactions in the e2e harness + document Buzz DM - run.sh: add a Buzz-style bare reaction check (kind-7 with an `e` tag but no `p` tag) asserting it still lands on the Reactions channel, and a note that Buzz DM isn't auto-triggered. - README: coverage row for the bare reaction, plus a "Buzz DM (manual)" section with the channel-setup steps (kind-39000 `t=dm` + participant, then post kind-9/40002) since participant-routing needs cached channel metadata. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_0122uQ8BLHLeHDni81RBP26r --- tools/notification-e2e/README.md | 20 ++++++++++++++++++++ tools/notification-e2e/run.sh | 12 ++++++++++++ 2 files changed, 32 insertions(+) diff --git a/tools/notification-e2e/README.md b/tools/notification-e2e/README.md index 825be4dac9..f6b687938a 100644 --- a/tools/notification-e2e/README.md +++ b/tools/notification-e2e/README.md @@ -18,6 +18,7 @@ fails. | Mention (+ liveness) | `amy event --kind 1` p-tagging A | `MentionsID` + "mentioned you" | | Reply | kind 1 with `e`+`p` tags to A's note | `RepliesID` + "replied" | | Reaction | kind 7 to A's note | `ReactionsID` + "reacted" | +| Buzz bare reaction | kind 7 with `e` tag, **no `p` tag** | `ReactionsID` (routed via `tagsAnEventByUser`) | | Repost *(new kind)* | kind 6 to A's note | `RepostsID` + "reposted" | | Picture *(new kind)* | kind 20 with `imeta` + `p` | `MediaID` + "shared a photo" | | DM | `amy dm send` | `PrivateMessagesID` + the body | @@ -28,6 +29,25 @@ Zaps (need a Lightning wallet), git/badge/nutzap/onchain (need repo / badge definition / cashu proofs) aren't automated here — they follow the same `amy event --kind …` pattern with the appropriate tags if you want to extend it. +### Buzz DM (manual) + +Buzz DM notifications (`StreamMessageV2Event` k40002 / `ChatEvent` k9 in a `t=dm` +relay-group channel) are participant-routed off the channel's kind-39000 +metadata, so they can't be triggered in one `amy event` call. To verify by hand: + +1. Create a Buzz DM channel whose kind-39000 metadata has `["t","dm"]` and a + `["p", ]` participant tag (use the Buzz UI, or `amy relaygroup` / + `amy event --kind 39000` as the relay/group admin), on a relay A is connected + to. Let A load the channel (open it once) so its 39000 metadata is cached — + push only fires when the participant list is known. +2. As B, post a message into it: `amy event --kind 9 --content "buzz dm hi" + --tags '[["h",""]]' --relay ` (or kind 40002). +3. Background the app; expect a `PrivateMessagesID` notification titled with the + channel name and body `B: buzz dm hi`, tapping it opens the chatroom. + +The gate is intentionally strict (participant metadata must be loaded), matching +the in-app feed — a cold push with no cached channel won't notify. + ## Prerequisites - A device/emulator on `adb` with the **debug** app installed and an account diff --git a/tools/notification-e2e/run.sh b/tools/notification-e2e/run.sh index baacd030d4..527bed554a 100755 --- a/tools/notification-e2e/run.sh +++ b/tools/notification-e2e/run.sh @@ -145,6 +145,12 @@ if [ -n "$TARGET_ID" ]; then pubB 7 "🤙" "[[\"e\",\"$TARGET_ID\"],[\"p\",\"$A_HEX\"]]" >/dev/null wait_for "ReactionsID" "reacted" && ok "reaction → Reactions channel" || bad "reaction notification missing" + # Buzz-style bare like: a NIP-25 kind-7 with an `e` tag but NO `p` tag (Buzz + # relays emit these). Must still notify — routed via tagsAnEventByUser, not the + # p-tag gate. A distinct emoji separates it from the 🤙 reaction above. + pubB 7 "❤️" "[[\"e\",\"$TARGET_ID\"]]" >/dev/null + wait_for "ReactionsID" "❤️" && ok "Buzz bare reaction (no p-tag) → Reactions channel" || bad "Buzz bare reaction missing" + pubB 6 "" "[[\"e\",\"$TARGET_ID\"],[\"p\",\"$A_HEX\"]]" >/dev/null wait_for "RepostsID" "reposted" && ok "repost → Reposts channel (new kind)" || bad "repost notification missing" else @@ -158,6 +164,12 @@ amyB dm send "$A_NPUB" "e2e direct message" --relay "$RELAY" >/dev/null 2>&1 \ && { wait_for "PrivateMessagesID" "e2e direct message" && ok "DM → Private Messages (MessagingStyle)" || meh "DM notification missing (check A's kind:10050 DM relays include $RELAY)"; } \ || meh "amy dm send failed (DM relays / wallet not configured) — skipped" +# Buzz DM (kind 40002 / kind 9 in a `t=dm` relay-group channel) is participant- +# routed off the channel's 39000 metadata, which this script can't set up in one +# shot. Not auto-triggered — see README "Buzz DM (manual)". Expect it to land on +# PrivateMessagesID with the channel name as title and ": " body. +meh "Buzz DM not auto-triggered (needs a t=dm relay-group channel) — see README" + # --------------------------------------------------------------------------- hdr "Observability — cold-push metadata enrichment" # Fresh sender C with NO profile: the notification must first show a raw pubkey,