Skip to content

feat(relay): official channels - #10059

Draft
ngoodger-block wants to merge 9 commits into
buildy/community-auto-join-recheckfrom
buildy/community-official-channels
Draft

ngoodger-block wants to merge 9 commits into
buildy/community-auto-join-recheckfrom
buildy/community-official-channels

Conversation

@ngoodger-block

@ngoodger-block ngoodger-block commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Why?

Newcomers can't tell the channels a community's maintainers stand behind from the rest, and auto_join forces membership rather than recommending (BUZZ-854). Builds on the community grants in #10048 and the locked authority check in #10060.

What?

Owners, admins and maintainers mark an open, listed stream or forum channel official with kind:9002 official, with no channel role needed and the authority decided again just before commit under the membership-list lock. kind:39000 carries NIP-32 labels while the channel stays open, listed and unarchived, and the relay matches #l in SQL so a member finds every official channel with one bounded read without joining. Designation changes no access. Migration 0115 adds channels.official. It shares 0115 with the sibling creation policy draft, and the migrator requires contiguous versions: whichever lands second rebases, renumbers its unapplied migration to 0116 and updates the embedded_migrator pin. Postgres tests cover discovery behind a page of newer channels, refusals, cross-community isolation and a race against a signed kind:9034 revoke. NIP-11 advertises Official support, and the SDK and CLI can designate or clear a channel. Both NIP-32 discovery filters apply before the result limit. On startup, the repair sweep fixes stale Official labels after recent changes, including archive, restore, and TTL expiry. A second pass revisits edits skipped during the one-minute startup grace period, limited to that skipped window.

@ngoodger-block
ngoodger-block force-pushed the buildy/community-maintainers branch from 063135c to 7726d47 Compare December 1, 2026 04:47
@ngoodger-block
ngoodger-block changed the base branch from buildy/community-maintainers to buildy/community-auto-join-recheck December 1, 2026 04:58
@ngoodger-block
ngoodger-block force-pushed the buildy/community-official-channels branch from 1fc7e92 to 5a9874b Compare December 1, 2026 05:32
@ngoodger-block
ngoodger-block force-pushed the buildy/community-auto-join-recheck branch 2 times, most recently from 041e1dd to 5eed095 Compare December 1, 2026 08:36
@ngoodger-block
ngoodger-block force-pushed the buildy/community-official-channels branch from 5a9874b to bf457cd Compare December 1, 2026 09:00
@ngoodger-block
ngoodger-block force-pushed the buildy/community-auto-join-recheck branch from 5eed095 to d222003 Compare December 3, 2026 18:32
@ngoodger-block
ngoodger-block force-pushed the buildy/community-official-channels branch 2 times, most recently from d715e0a to 5b5e12b Compare December 3, 2026 19:23
@ngoodger-block
ngoodger-block force-pushed the buildy/community-auto-join-recheck branch from 04f6853 to ba73e97 Compare December 3, 2026 19:38
@ngoodger-block
ngoodger-block force-pushed the buildy/community-official-channels branch 2 times, most recently from 594edaa to cf91a19 Compare December 3, 2026 20:15
@ngoodger-block
ngoodger-block force-pushed the buildy/community-auto-join-recheck branch from ba73e97 to 4001016 Compare December 3, 2026 20:15
@ngoodger-block

Copy link
Copy Markdown
Contributor Author

🤖 Official support is advertised in NIP-11, and both NIP-32 discovery filters apply before the result limit. The SDK and CLI support Official edits, with the CLI checking relay capability before publishing.

@ngoodger-block

Copy link
Copy Markdown
Contributor Author

🤖 The race-test query reconstructed the exact keys for PostgreSQL advisory locks at signed bigint minimum, −1, and maximum. PostgreSQL 16 uses the same bitwise shift operation, so the helper is correct as written.

@ngoodger-block
ngoodger-block force-pushed the buildy/community-official-channels branch from 3783d85 to 3812344 Compare December 3, 2026 22:36
@ngoodger-block
ngoodger-block force-pushed the buildy/community-auto-join-recheck branch 2 times, most recently from 2b0565b to 03b399e Compare December 4, 2026 00:41
@ngoodger-block
ngoodger-block force-pushed the buildy/community-official-channels branch from 3812344 to 9076550 Compare December 4, 2026 00:41
@ngoodger-block

Copy link
Copy Markdown
Contributor Author

🤖 Updated the protocol table in 9076550a02 to document who can set the kind:9002 official tag and when the relay emits the kind:39000 NIP-32 labels. Judgy verified that the published documentation patch matches the reviewed diff.

@ngoodger-block
ngoodger-block force-pushed the buildy/community-auto-join-recheck branch from 03b399e to 49c61cc Compare December 4, 2026 02:07
@ngoodger-block
ngoodger-block force-pushed the buildy/community-official-channels branch from 9076550 to 3859ae2 Compare December 4, 2026 02:07
@ngoodger-block

Copy link
Copy Markdown
Contributor Author

🤖 The startup sweep now repairs missing or stale Official labels after a channel edit, including on older channels edited within the lookback. PostgreSQL coverage verifies marking, unmarking and the one-minute edit grace, and the protocol links now resolve.

@ngoodger-block

Copy link
Copy Markdown
Contributor Author

🤖 Archive, restore, and TTL expiry now advance the timestamp the Official repair sweep uses. PostgreSQL regressions cover all three paths on older channels and the one-minute grace period.

ngoodger-block and others added 2 commits December 4, 2026 14:49
Owners, admins and maintainers mark an open, listed stream or forum
channel official with kind:9002 ["official", ...]. The relay decides the
authority again just before commit under the membership-list lock,
publishes NIP-32 labels on kind:39000 while the channel stays open,
listed and unarchived, and matches #l in SQL so members find official
channels with one bounded read. Designation joins nobody and changes no
access.

Co-authored-by: Buildy <9c2fd8f72fad905d31cdf563c3920011399bd334523d6b3c84c0dc124bcfb380@sprout-oss.stage.blox.sqprod.co>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
Co-authored-by: Buildy <9c2fd8f72fad905d31cdf563c3920011399bd334523d6b3c84c0dc124bcfb380@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
ngoodger-block and others added 7 commits December 4, 2026 14:49
Co-authored-by: Buildy <9c2fd8f72fad905d31cdf563c3920011399bd334523d6b3c84c0dc124bcfb380@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
Co-authored-by: Buildy <9c2fd8f72fad905d31cdf563c3920011399bd334523d6b3c84c0dc124bcfb380@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
Co-authored-by: Buildy <9c2fd8f72fad905d31cdf563c3920011399bd334523d6b3c84c0dc124bcfb380@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
Co-authored-by: Buildy <9c2fd8f72fad905d31cdf563c3920011399bd334523d6b3c84c0dc124bcfb380@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
Co-authored-by: Buildy <9c2fd8f72fad905d31cdf563c3920011399bd334523d6b3c84c0dc124bcfb380@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
Co-authored-by: Buildy <9c2fd8f72fad905d31cdf563c3920011399bd334523d6b3c84c0dc124bcfb380@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
@ngoodger-block
ngoodger-block force-pushed the buildy/community-auto-join-recheck branch from 49c61cc to ae019da Compare December 4, 2026 04:10
@ngoodger-block
ngoodger-block force-pushed the buildy/community-official-channels branch from 360b75d to 1ed7834 Compare December 4, 2026 04:10
@ngoodger-block

Copy link
Copy Markdown
Contributor Author

🤖 The startup repair now revisits the edits it skipped for the one-minute grace period. The PostgreSQL regression covers marking, unmarking and archiving in that window, plus older rows and edits made after startup.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant