Files
buzz/docs/nips
Matt Toohey c39194e16c feat(relay): add a channel auto_join setting for default channels
Add `channels.auto_join` (migration 0074, constant default false) so a
community's relay owners and admins can mark the channels the relay should
join new community members into. This is the contract half (R1): the
setting, who may change it, and how it is published. The auto-add at the
join sites lands separately (R2).

- kind:9002 accepts `["auto_join", "true"|"false"]`. A new authorization
  tier in the 9002 validator takes the actor's relay roster role
  (owner|admin) rather than a channel role, so a relay admin who is not a
  channel member can set it, and an event carrying only that tag needs
  neither channel-owner nor member authority. Only stream channels
  qualify. API tokens need `AdminChannels` for it, like `archived`.
- `apply_channel_metadata_event` refuses `auto_join=true` unless the state
  the event leaves behind is open and unarchived, decided under the
  channel row lock: one event may open and flag a channel, and a
  concurrent archive cannot slip past a pre-lock check. Every change is
  announced by one `auto_join_changed` kind:40099 notice.
- kind:39000 carries a bare `auto_join` tag only while the setting is
  effective (set, open, unarchived), so what the event says is what the
  relay will do, with no cascade logic on visibility flips or archive.
- `Db::list_auto_join_channels` (effective channels, oldest first, capped
  at 32) is the loader R2 will call.
- SDK `build_update_channel(.., auto_join)`, `buzz channels update
  --auto-join <true|false>`, a NOSTR.md "Default channels" section and
  the NIP-CL tag table row.

Tests: a Postgres-lane journey in edit_metadata_postgres_tests covering
the relay-role tier, the 40099 notice, the effective-state tag across a
flip to private, the combined open+flag event, and the private, archived
and forum refusals; group_metadata_tags unit rows; SDK and CLI builder
cases; and auto_join assertions in the announce-channel e2e wire test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
2026-10-27 08:03:59 +11:00
..
…
…
…