Repository navigation
feat(communities): community mention groups in @ and Add people - #3655
LordMelkor wants to merge 21 commits into
Conversation
joahg
left a comment
There was a problem hiding this comment.
🤖 Commenting rather than approving. This changes the @ chooser and Add people, so it needs a design or core-team reviewer. It also edits two FOUNDATION files, src/features/conversation/contracts.ts (plugin contract: the group completion edit and insertMentions(people, group?)) and src/features/relay/session.ts, which need a maintainer's sign-off. The PR conflicts with main and is stacked on #2878, so this diff includes #2878's commits.
I found no P0 or P1 on the client side. Authorization rests with the relay, which I didn't read.
Checked:
- Without
nip-mgsupport it degrades cleanly: no reads, no listeners. - A message is capped at 32 distinct
ptags, deduped across chips. - Groups never outrank a person, and Space or a typed name never selects one.
- A group that changed since it was listed is disabled.
- Members outside the channel go through the existing invite prompt.
P2:
- Plugin-published groups can mislabel who gets notified. A plugin completion provider can publish
{group: {name, mentions}}with any label and up to 32 keys. A chip labelled@Alicecould notify other people, and the sender can't see who; the only check isadmits()at insert time. Tying the group name to a host-owned directory entry, or showing the expanded members, would close this. - Stale drafts notify removed members. Members are copied into the chip when it's inserted, and
mentionDraftonly checks their shape when a draft is restored. Someone removed from the group after the draft was saved is still notified. Re-resolving the group at send time, or disabling the stale chip, would fix it. - A missing roster lets removed people stay in groups. On a
rosterrelay,projectDirectorytreats a missing or null roster snapshot as everyone being a member, so removed people stay in expansions. Failing closed seems safer. - One profile read for every unknown member.
admit()makes a single kind-0 read withauthorsset to every unknown member across all groups. A large directory could exceed a relay's authors cap and hide every group until Retry. Chunking the read would avoid that. - Add group has no count cap or confirmation. One click adds every missing member, up to the 1000 that
putallows. A count in the button or a confirmation above a threshold would help. - Default manage permission is
everyone.defaultManagefalls back to"everyone", so any member can create or delete groups, add anyone to one, or set default-channel joins. Please confirm the relay authorizes those joins for private channels, and consider whetheradminsis the safer default.
P3:
- A member can name a group like a person, which spoofs
@Namefor readers and blocks Space from completing the real person. - The
@rows show member counts but not who's in the group. - The
PAGEsize is 500, but the description says 1000. - The
ownerscache is never refreshed. command()retries resend the same signed event, which can fail permanently once it's past the relay's age window.- Rust
trim()and JStrim()differ on U+FEFF, so a name the client accepts could be rejected natively.
Missing tests: a restored draft with a stale group chip, a plugin-published group edit, a roster relay with no roster, and a large Add group.
Not run: I read the diff and the surrounding code, but didn't run the tests or read the relay implementation.
|
🤖 Review of
Validation: 32 existing test files / 707 tests and TypeScript passed. Three additional probes against the production owners reproduced these failures. No app source edits or repeated browser/native visual run. Minimalism 9/10; elegance 9/10; correctness 8/10 pending these fixes. |
joahg
left a comment
There was a problem hiding this comment.
🤖 Followup on cadd597. With no steward and the setting at admins, canEdit now matches the relay, which refuses those puts. That closes the canEdit P3 from my last review, and the test pins it. The P2s from that review still apply, as do the three in your own follow-up review: UUID guards stricter than the relay's, aliased retry arrays, and cached negative admission results.
This still needs a design or core-team reviewer and a maintainer's sign-off on the two FOUNDATION files, so I'm leaving a comment rather than approving.
A saved team's member list can hold people as well as agents (the Mention Groups plugin writes such teams). The team path passed only agents as its directory, so a person outside the channel had no candidate row and disabled the whole team. Now each team person is named from their profile and offered exactly as the individual chooser offers them; agents keep their own path. A key counts as a person only once agent choices are complete and it is no known agent here or elsewhere. Team rows say members instead of agents. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…ed teams Team rows ask for member names the way the chooser asks for owner names: background priority, and only for teams that can mention (at most 32). The unnamed-person test now delivers the profile and checks that the open team becomes selectable. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-authored-by: Sigil <06114f072cf21e50fcd4133ab21346cdb1f74ee16d853a9729995fa6c03a251c@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Selecting a team inserted every member as its own chip, so a large team made
an unreadable message. A team row now inserts one `@team` chip that notifies
each member:
- CompletionEdit gains `{ group: { name, mentions } }`; `insertMentions`
takes an optional group name, so the toolbar picker does the same.
- The token's `group: { label, members }` attr holds the members, with
`recipient` null, so code, clipboard, open-as-text and Markdown see plain
`@team`. Projection emits one labelled DraftRecipient per member.
- Lifecycle: removing or replacing a member keeps the chip for the rest; the
last member, a boundary edit, code, paste or a pick during a message edit
leave plain text. Draft restore keeps only members on a span reading
`@label`.
- The 32-recipient cap counts distinct people; mentionTags dedupes first.
- The row reads "Saved team · 1 person, 2 agents".
Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
- A new chat's title strips a leading group chip: its members share one `@label` span. - A group inserted inside inline code is only its name, as in a code block. - `referenceTags` dedupes before its 32 check, like `mentionTags`. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
A team picked inside backticks inserts only `@name` with no recipients, and typing after a group name in inline code stays in code. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…e, send group labels literally A message's mention keys and its prompts now list each person once, so a group plus a member named alone cannot exceed the Huddle window's key check or ask twice. A group picked from the toolbar inside Markdown backticks inserts only its name, as one picked by completion does. A group's label after the @ is escaped like literal text, so a team named *core* reads as typed. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
The sent message carries a group only as text, and renaming derives the starting title from that message, so stripping the group left the title unrecognized and the agent's name never landed. A group now ends the leading-mention strip, which also stops a member whose name starts the label from cutting it short. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…ral text still notifies The Solo leading-tag scan counts each chip span once, so a group's shared span no longer ends it early and a later pick lands after earlier tags. A group picked from the toolbar falls back to its plain name only in Markdown backticks; the editor already keeps code marks and code blocks plain, and literal text such as a removed link's label is ordinary prose. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Two portable write fixtures send 33 occurrences of 32 distinct keys, one for recipients and one for references, and expect 32 tags. They fail if the writer checks the limit before removing duplicates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
|
🤖 This change looks like it should ship as an external plugin rather than in buzz-app: it adds a new Slack-style user-groups feature, with group rows and states in the |
joahg
left a comment
There was a problem hiding this comment.
🤖 Followup on bb61e8d. This commit fixes all three items from your own follow-up review:
- Group ids now follow the relay's rule (any canonical non-nil UUID) on both the Rust and TS sides, with tests for the plain and nil ids.
putcopiesmembersandchannels, so editing the input later can't change what a retry sends.- Negative owner answers are rechecked on every reconcile, and the generation counter drops lookups left over from an earlier reconcile.
That also covers the "owners cache is never refreshed" P3 from my first review. The six P2s from that review still apply: plugin-published group labels, stale draft chips, a missing roster failing open, the unchunked profile read, the uncapped Add group, and the everyone default.
The branch now conflicts with main. It still needs a design or core-team reviewer and a maintainer's sign-off on the two FOUNDATION files, so I'm commenting rather than approving.
|
🤖 Follow-up on Validation at that snapshot: 800 selected tests, TypeScript, and four independent production-boundary probes pass. The extra probe releases an old profile miss after a reconnect has admitted the agent and verifies admission survives. The native app crate compiled, and the affected native relay/pairing tests passed (106 passed, one ignored). The full native library run exited with SIGSEGV, as did a serial rerun. The exact |
A Solo chat adds only the viewer's agents, so a team with someone outside the chat stays unavailable there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Mention groups become community state the relay owns. The app signs three commands (47000 put, 47001 delete, 47002 set "who can manage groups") through one route, `mention-group`, on both the packaged signer and the browser broker. The relay checks authority and answers with typed reasons (conflict, duplicate, restricted, invalid), which come back verbatim so the caller can tell a version conflict from a taken name. The request carries `created_at`, so a retry after a lost receipt signs the same event and the relay's receipt answers it instead of applying it twice. The native signer accepts only the exact tag order the relay expects. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Each relay session gets one mention group owner, `session.mentionGroups`, when the relay advertises NIP-MG v1. It reads every relay-signed 39010 head in pages, keeps them current from the global live route, and reads them all again after a reconnect. Newer versions win, a missing head never deletes a group, and a failed read never empties a directory that was shown. It is a recovery source, so failed reads retry with the session's other background reads. On a relay that enforces membership, a group lists only current roster members and owner-admitted agents, and waits while one is unknown. `canEdit` and `canManage` follow the viewer's role and the "Who can manage groups" setting. Commands keep their event id across retries, so a retry after a lost receipt is answered from the relay's receipt at any age. Accepted saves report the default-channel joins the relay made or skipped. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Groups from the session's mention group directory join the @ team rows and the toolbar picker as "Group · N people, M agents" and insert one group chip. A group waits while its membership loads, shows disabled when empty, blocks Space auto-select like a team, and revalidates at acceptance. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Add people lists community mention groups that match the search. One button adds the group's current members who aren't in the channel yet through the existing add-member command; refusals keep the shared alert and Retry. A group still loading its members, or with everyone already here, isn't offered. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Add group skips archived or deleting agents, as the individual rows do. A group saved while a Space directory read is pending blocks its namesake. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
The relay may advertise mention_groups.max_members in NIP-11. Both transports carry it and the group directory exposes it as maxMembers, so the group editor can show the limit without a number in the app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
With no steward and the setting at admins, the relay refuses every put and delete (NIP-MG), so the directory no longer reports canEdit there. Any member can still change the setting back to Everyone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
- Group ids follow the relay's rule (any canonical lowercase non-nil UUID) in the directory, the shared command builder and the native signer. - put copies the member and channel arrays, so a caller's later edit can't change the event a retry sends. - Each reconcile rechecks agents with no owner proof, so one that publishes its proof later is admitted after a reconnect; the old answer stands until then, and an older lookup's answer is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
bb61e8d to
5d2d2c8
Compare
|
🤖 Restack-only review at Validation at this head: 117 full test files / 2,612 tests passed, all four independent regression probes passed, and TypeScript passed. This includes communities, Mentions, channels, Buzz MCP, native relay transport and broker integration. Independent source review found no integration blocker. The native Rust owner/tests are unchanged, so this review carries the prior 106-pass native relay evidence without claiming a new native run or a green full native suite. Existing design-placement, FOUNDATION and other original review findings require their own disposition; this comment covers the restack and preservation of the three repaired findings. No source edits or repeated visual acceptance. |
On a roster community whose relay publishes no roster, no member can be confirmed, so groups now notify nobody instead of everyone. Owner-proof profile lookups are split into reads of the profile directory's page size, so a large directory stays within a relay's authors limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
joahg
left a comment
There was a problem hiding this comment.
🤖 Followup on 5e81602. Two P2s from my first review are fixed:
- Missing roster: on a roster relay that publishes no roster (
null), groups now notify nobody instead of everyone in them, while a roster that hasn't loaded yet still holds groups as pending. The new test pins the null case. - Profile reads: owner-proof lookups are batched at the profile directory's 500-author page, so a large directory no longer exceeds the relay's authors cap. The test checks that 501 unknowns become reads of 500 and 1.
Four P2s from that review still apply: plugin-published group labels, stale draft chips, the uncapped Add group, and the everyone default. This still needs a design or core-team reviewer, and a maintainer's sign-off on the two FOUNDATION files, so I'm commenting rather than approving.
Closed, replaced. Following the rule that anything a plugin can build stays in a plugin (as the review comment below asked), the feature moves to the Mention Groups plugin (squareup/agents), and core gets three general hooks instead: #3725 (plugins sign the event kinds their manifest declares, and read the relay info document), #3726 (plugin
@rows beside the people rows) and #2878 (one chip for several recipients, sent as a link).Summary
Community mention groups, like Slack user groups. A community's relay stores the groups (NIP-MG), and everyone in the community sees the same ones. This PR adds the host side:
session.mentionGroups.directoryis a live snapshot of the relay-signed kind39010groups. It shows groups only after a complete paged read, takes the newest version of each group from live updates, and reads again after every reconnect. A failed read never empties the list; the directory reportsunavailableand offers Retry. On arostercommunity, a group's members are its current roster members and owner-admitted agents. A group waits while that membership is read, so a message never goes to a partial set.put,removeandsetManagesign kind47000/47001/47002with the group's current version as the precondition. The development broker signs them; the native host signs only those exact shapes. A retry resends the same signed event, so the relay answers from its receipt. A stale version (conflict:), a taken name (duplicate:) and a refusal (restricted:/invalid:) come back as distinct outcomes.@chooser. Groups show as "Group · N people, M agents" rows in the inline@suggestions and the mention picker. Selecting one inserts one@groupchip (the feat(composer): one chip for several recipients, sent as @label #2878 group completion edit) that notifies each current member. A group is disabled when it is empty, still loading its members, changed since it was listed, or has a member who can't be mentioned here. Space and typed names never select a group, and group names block Space from picking a namesake person.mention_groups.max_membersin NIP-11, both transports carry it, and the directory shows it asmaxMembers, so no number is hard-coded in the app.communities.md(new "Community mention groups" section),agents.mdandbuzz-help.md.Stacking
This PR is stacked on #2878 (one
@teamgroup chip). The commits for this PR start atdb3a30164; the earlier commits are #2878's. Merge #2878 first. The relay side is in block/buzz: #9587 (database compatibility), then #9589 (the NIP-MG feature).Evidence
39010heads):@rows: the chip, the waiting and disabled states, a changed group, a failed directory and Retry, and a group saved during a pending Space read.max_membersparsing on the native and browser paths.maxMembersfrom the browser transport fails the broker test.browser-host/vite-config.test.mjsunder load average 46; it passes on its own run.tsc, Biome anddesign:checkare clean.@Riskshows "Risk Review · Group · 1 person · 1 not in channel", and Enter inserts one chip.ptag, and the roster then lists Bob.@row with no reload.previs answeredconflict: mention group version changed, and a put with 21 members is answeredinvalid: a group can have at most 20 members.51d423ce2.7eae91527): command tags,39010heads and paging, NIP-11 fields, answer prefixes and retry receipts match. One mismatch is fixed incadd597db: with no steward and the setting at admins, the relay refuses every edit, socanEditis now false there (any member can still set it back to Everyone).cadd597db(three P2 findings), fixed inbb61e8d6fwith a test for each that fails on the parent: group ids follow the relay's rule (any canonical non-nil UUID) in the directory, the command builder and the native signer;putcopies its arrays so a retry can't change; each reconcile rechecks agents with no owner proof. Communities, mentions, channels and broker suites: 2175/2175. Native relay tests in the app crate: 106/106 pass, including the updated mention-group signing test. The full native suite crashes inwindow_state::tests::onboarding_snapshot_is_kept_until_next_launch_restore, which crashes on the pre-fixcadd597dbtoo, so the full-suite result is not verified locally.5e81602f6, each with a test that fails on the parent. On a roster community whose relay publishes no roster, groups now notify nobody instead of everyone. Owner-proof profile lookups are split into reads of 500 authors, so a large directory stays within a relay's authors limit. Communities, mentions and channels: 2094/2094. An agent review found no blocking issue.Cost
Each client reads all group heads once (paged, 500 per page) and then follows live updates. On a roster community it also reads the roster and the profiles of non-roster members to check owner-admitted agents, 500 authors per read, as the profile directory does.
Known limitations
@groupas plain text. The reader chip is a separate stacked PR.max_members, a group with more than 32 members can't be mentioned (the per-message limit).put/remove/setManagehave no built-in editor yet; the Mention Groups plugin's editor comes next.Merge order
This PR merges last. It needs two things first, in either order:
@teamchip) merged. This branch contains its commits.Then merge #3655 (this PR). The repository squash-merges, so after #2878 merges, rebase this PR onto
mainbefore it merges.🤖 Generated with Claude Code