Repository navigation
feat: user groups (@handle) with relay-checked mentions and buzz groups CRUD - #8819
Draft
blakemcanally wants to merge 5 commits into
Draft
blakemcanally wants to merge 5 commits into
blakemcanally wants to merge 5 commits into
Conversation
Add KIND_USER_GROUP, NIP-UG, and buzz_core::user_group: parsing, validation, edit authorization, and group-mention helpers shared by relay, SDK and CLI. The push hellthread gate in NIP-PL counts a group once. Kind 30181 belongs to the open NIP-AW PR (#6582), so user groups use 30182. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Blake McAnally <bmcanally@squareup.com>
Add build_user_group, build_user_group_deletion, and group_mention_tags. build_user_group opts in to self-tagging: nostr drops p tags equal to the signer, so a member who edited a group would be removed from it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Blake McAnally <bmcanally@squareup.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Blake McAnally <bmcanally@squareup.com>
Admit kind 30182 under UsersWrite as a global kind. Check each write against the community-wide head of its handle (creator, group admins, community admins, open policy), require a newer created_at for a cross-author edit, and remove the superseded head after the new one is stored. Reject group-marked p tags that do not match the current members of an active group, and count a group once in the push hellthread gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Blake McAnally <bmcanally@squareup.com>
buzz groups list|get|members|create|update|add-member|remove-member|delete manage kind 30182 user groups with JSON output. Each write reads the current head with strong consistency and publishes one newer head. messages send --mention-group expands a group into p tags marked group:<handle>. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Blake McAnally <bmcanally@squareup.com>
blakemcanally
force-pushed
the
bmcanally/user-groups
branch
from
November 5, 2026 19:18
4b841ec to
ec7640d
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds user groups: a named handle (
@ios-team) with a display name, description, and member list. A mention of the handle notifies every member. People and agents can create, read, update, and delete groups, and add and remove members. This is the Buzz equivalent of Slack user groups, which teams use daily to reach a team, and its absence blocks the move from Slack.Design:
docs/user-groups.md. Wire format:docs/nips/NIP-UG.md.Event model. One addressable event per group:
kind:30182,d= handle,name,creator,admin,p(members),policy(admins|open), andstatus(active|disabled) tags. The description goes incontent. No new table or migration; storage, queries,#plookup ("which groups am I in"), and live fan-out use the generic addressable path. The empty reserved range "User groups (47000–47999)" inkind.rsis removed, because group state must be addressable.Who may edit. The relay treats
(kind, d)as one community-wide coordinate, so the second person to sync a team can update a group the first person created.buzz_core::user_group::authorize_writeallows the creator, listed group admins, community admins, or anyone whenpolicyisopen. After it stores a newer head from another author, the relay removes the previous head (a documented deviation from NIP-33's per-author replacement). A non-author disables a group withstatus: disabled; deleting is author-only for now.Mentions. The sender expands the group into marked
ptags:["p", <member>, "", "group:<handle>"]. Every receive path already works onptags (desktop and mobile filters, push leases, theevent_mentionsindex, the mentions feed, agent wake-ups), so no client needs a new subscription. The relay rejects marked tags whose pubkey is not a member of an active group with that handle (validate_group_mentions), and the push hellthread gate counts one mention per group (weighted_p_count), so a group larger thanp_tags_maxstill pushes.CLI.
buzz groups list|get|members|create|update|add-member|remove-member|delete, andbuzz messages send --mention-group <handle>.updatetakes--disable,--enable,--set-member, and--policy. SDK:build_user_group.Not in this PR (listed in the design doc):
@picker entries for groups, expansion on send (exempt marked tags from the 32-recipient cap), one@handlechip when rendering, group management UI, and counting a group once in the mobile hellthread check (push_subscription.dart,BuzzPushKit/PushLease.swift:125).Open questions
adminshere; Slack behaves closer toopen.Related issue
None found. Kind 30181 is claimed by #6582, so this uses 30182.
Testing
cargo test -p buzz-core -p buzz-sdk -p buzz-cli: 299, 326, 512 passed.cargo test -p buzz-relay --lib -- --skip audio::: 1460 passed, 494 ignored. (Theaudio::tests stop locally for an unrelated reason; CI covers them.)user_group_ingest_authorizes_edits_and_validates_mentionspasses against a scratch database (creator, group admin, community admin, and open-policy writes; the one-live-head rule; mention validation). It found a real bug, now fixed with a regression test: nostr'sEventBuilderdropped aptag matching the signer, so a member who edited a group removed themself.cargo clippy -p buzz-core -p buzz-sdk -p buzz-cli -p buzz-relay --all-targets: clean.groups plan|syncmaps Slackusergroups.listmembers to Buzz pubkeys and creates and updates these groups through the CLI.🤖 Generated with Claude Code