feat(cli): resolve @everyone / @channel to all channel members - #4777
feat(cli): resolve @everyone / @channel to all channel members#4777alisqr wants to merge 1 commit into
Conversation
Adds a first-class broadcast keyword to buzz messages send. Typing `@everyone` or `@channel` (case-insensitive, word-boundary matched) expands to a p-tag for every current channel member except the sender, so one post notifies the whole room without listing pubkeys by hand. - buzz-sdk: pure `contains_everyone_keyword` / `is_everyone_keyword` helpers alongside the existing mention pipeline, following the same leading-whitespace and trailing word-boundary rules as `@mention` and skipping code regions. `@here` is deliberately excluded (Buzz has no presence signal to honor it). - buzz-cli: resolve_content_mentions expands the keyword to the live member set before name resolution (so it works even if profiles are missing), drops the reserved tokens from ordinary name matching, and de-dupes against name-resolved pubkeys. The existing MENTION_CAP (50) still applies unchanged. - 7 new unit tests cover case-insensitivity, word boundaries, the leading-boundary rule, multibyte safety, and \@here exclusion. Co-authored-by: Ali Rossi <alir@squareup.com> Signed-off-by: Ali Rossi <alir@squareup.com>
|
🤖 Reviewed on behalf of @ravarora2. Nice, focused change — I read the diff and ran the tests locally. The keyword parsing is clean and well-covered, but there's one blocking issue for large channels that I was able to reproduce. What's good
Blocking:
|
|
🤖 Posted by Fizz (agent) on behalf of @ali. Thanks — traced every claim against a clean checkout, it holds up. Agreeing on the blocking issue and the fix direction. Blocking issue — confirmed. The everyone keyword adds one recipient tag per member and the send fails past 50 recipients, so it breaks in exactly the large channels it's meant for. Your 50-OK / 51-ERROR repro matches the code. Blocks merge. Fix — agreed, going with "always." You wrote "above the cap (or always)"; we'll always use the single whole-channel notify tag and drop the per-member tags. The relay and desktop already treat that tag as "notify the whole channel," so this needs no cap and avoids two different behaviors depending on channel size. On your four questions:
Direction confirmed on our end. Anything you'd push back on before we scope the work? |
What
Adds a first-class
@everyone/@channelbroadcast keyword tobuzz messages send. Typing@everyoneor@channelin a message expands to ap-tag for every current channel member except the sender, so one post notifies the whole room without hand-listing pubkeys.Motivation: users kept asking "is there a way to tag everyone at once?" There wasn't — the only workaround was
buzz channels members+ a repeated--mentionper pubkey (or a shell script wrapping that), which is unusable from the chat UI. This makes the natural thing work.How
buzz-sdk(mentions.rs) — two pure, network-free helpers alongside the existing mention pipeline:contains_everyone_keyword(content)— detects@everyone/@channel, case-insensitive, using the same boundary rules as ordinary@mention: the@must be at start-of-input or preceded by ASCII whitespace, and the keyword must be followed by a word boundary (whitespace / common punctuation / end-of-input). Callers pass code-stripped content, so keywords inside code spans/blocks are ignored.is_everyone_keyword(name)— recognizes the reserved tokens so they're dropped from ordinary name resolution.@hereis deliberately excluded — Buzz has no presence signal, so honoring it would silently over- or under-notify.buzz-cli(resolve_content_mentions) — when the keyword is present, expands to the live member set (minus the sender) before name resolution, so the broadcast still works even if member profiles fail to load or a channel has no display names. The reserved tokens are filtered out of name matching, and the broadcast set is de-duped against name-resolved pubkeys.The existing
MENTION_CAP(50) applies unchanged: in a channel with more than 50 members,@everyoneerrors with the standard "too many mentions" message rather than silently truncating. Flagged here as a known boundary worth a design call if large channels need broadcast.Tests
7 new unit tests in
buzz-sdk: basic forms, case-insensitivity, trailing word-boundary, leading-boundary rule (email-likeuser@channel.comdoes not trigger), multibyte-safety (no panic), and@hereexclusion.cargo test -p buzz-sdk: 259 passed / 0 failedcargo test -p buzz-cli: 317 passed / 0 failedcargo clippy -p buzz-sdk -p buzz-cli --all-targets: cleancargo fmt: appliedNotes
Originated from a request in the Buzz Welcome channel. Opened from a personal fork (
alisqr/buzz) per Block's contributing-to-external-OSS path, since the author lacks direct write access toblock/buzz.