buzz icon indicating copy to clipboard operation
buzz copied to clipboard

feat(relay): warn on offline explicit mentions (#1743)

Open cameronhotchkies opened this issue 4 months ago • 2 comments

Summary

This updates the #1743 relay warning path so senders get visible feedback when they explicitly @mention a pubkey that has no current Buzz presence in the workspace.

What changed

  • Adds explicit ['mention', '<pubkey>'] tags alongside delivery p tags so the relay can distinguish real @mentions from structural reply-author p tags.
  • Checks Redis-backed workspace presence after accepted kind:9 ingest and sends a NIP-01 NOTICE back to the sender for mentioned pubkeys with no current presence.
  • Wires desktop send paths to attach explicit mention tags and consume relay NOTICE frames as warning toasts.
  • Adds focused relay, SDK, Tauri, and desktop helper tests for explicit mentions, dedupe/self-filtering, accepted-only offline notices, NOTICE handling, and mention tag construction.

Validation

  • cargo fmt --all -- --check
  • cargo fmt --manifest-path desktop/src-tauri/Cargo.toml --all -- --check
  • cargo check -p buzz-relay
  • cargo clippy -p buzz-relay --all-targets -- -D warnings
  • cargo test -p buzz-relay mention --lib
  • cargo test -p buzz-sdk message_mentions_emit_delivery_and_reference_tags_deduped --lib
  • cargo test --manifest-path desktop/src-tauri/Cargo.toml mention_reference --lib
  • just desktop-test — 2983 passed
  • just desktop-typecheck
  • cd desktop && pnpm check — exits 0; reports two pre-existing unused-variable warnings in desktop/tests/e2e/inbox-live-update.spec.ts and desktop/tests/e2e/typing-latency.perf.ts

Notes

  • This is still a presence warning, not a delivery receipt. It tells the sender that the target has no current Buzz presence; it does not prove a subscribed harness processed the event.
  • Local pre-push hook previously reached the integration phase, but local Docker was unavailable (/Users/chotchkies/.docker/run/docker.sock missing). I pushed with --no-verify after the targeted checks above passed so CI can run on GitHub.

Refs #1743.

cameronhotchkies avatar Jul 14 '26 18:07 cameronhotchkies

🦾 Addressed the requested changes at 9d5fa132:

  1. Explicit mentions vs. reply metadata: the sender now emits dedicated ["mention", "<pubkey>"] reference tags. The relay ignores structural p tags, limits this behavior to kind 9, excludes self-mentions, deduplicates, and caps the set.
  2. Visible Desktop handling: WebSocket NOTICE frames are consumed and surfaced as warning toasts. Explicit mention sends remain on the established WebSocket path, preserving DM expansion and relay notice handling.
  3. Cross-pod semantics: presence is read from the workspace-scoped Redis presence store. The implementation and notice text explicitly describe this as current Buzz presence and best-effort—not delivery proof. Lookup failure suppresses the warning rather than producing a false offline result.
  4. Tests: added focused relay tests for accepted-only behavior, kind restriction, explicit mention vs. reply-author p tags, dedupe/self-exclusion/cap, and online/offline presence; added Desktop/Tauri tests for mention tags and visible NOTICE handling.

Fresh CI is still running on this SHA; I’ll post the re-review note only after it is green.

cameronhotchkies avatar Jul 30 '26 18:07 cameronhotchkies

🦾 Ready for re-review at 9d5fa132.

The requested mention semantics, cross-pod presence handling, Desktop NOTICE UX, and focused tests are addressed. Fresh CI is green: 28 successful, 4 skipped, 0 failed. In particular, Desktop Smoke E2E shards 1–4, Desktop rollup, Desktop Core, Desktop E2E Relay/Integration, Rust lint/unit tests, macOS build, cross-compiles, security, Semgrep, zizmor, and DCO all passed.

Remaining risk: the warning deliberately reports best-effort workspace Redis presence, not guaranteed subscription delivery; the relay skips warnings if the presence lookup itself fails.

cameronhotchkies avatar Jul 30 '26 18:07 cameronhotchkies