feat(relay): support community-scoped NIP-AR artifacts (#9650)

## Summary

NIP-AR clients can store community-scoped artifacts and subscribe to
live changes for one exact artifact type. Community and channel
artifacts share revision and retry semantics and use separate identity
scopes. Community owners and admins can choose whether a type accepts
edits from all admitted members or only administrators. This PR combines
the protocol from #9638 with the relay implementation.
[Protocol](0b8949f5e2/docs/nips/NIP-AR.md (community-scoped-artifacts-proposed-extension))

- Kind `45010` binds community writes to a signed tenant UUID. Explicit
community filters select signed HTTP reads and WebSocket sync. NIP-11
advertises capability after the schema transition.
- Kind `9034` sets per-type policy using compare-and-set. The relay
commits the policy update and audit entry together. Readers fetch the
current policy and its revision through the explicit policy view.
- Kind `9005` redacts a community revision. Relay peers send
tenant-scoped change metadata and re-read the authorized head for
delivery. This reuses the existing snapshot, bounded buffering, and
resync semantics.

## Rollout

Migration `0097` expands storage and retains the existing channel write
key. Deploy compatible serving backends, deletion executors and operator
tools with community scope disabled. Then run the guarded key transition
and enable the capability. The resulting rollback floor is the first
compatible relay version. [Rollout
guide](0b8949f5e2/docs/community-artifact-rollout.md)

## Why each change belongs in the relay or protocol

| Change | Necessity | Minimality |
| --- | --- | --- |
| NIP-AR community scope | The current protocol gives every artifact a
home channel and defines channel-based access. Clients need a shared
contract for community identity, admission, reads and moderation to
interoperate.
[NIP-AR.md:9](493cb4cc13/docs/nips/NIP-AR.md (L9))
[NIP-AR.md:65](493cb4cc13/docs/nips/NIP-AR.md (L65))
| An optional version-1 section reuses the artifact envelope version and
revision operations. The channel sections state where their existing
rules apply.
[NIP-AR.md:242](0b8949f5e2/docs/nips/NIP-AR.md (L242))
|
| Signed community revisions | The validator requires an `h` tag, and
the write path stores an event and mentions for that channel. A
client-defined tag cannot establish a different audience on the relay.
[artifact.rs:122](493cb4cc13/crates/buzz-core/src/artifact.rs (L122))
[artifact.rs:196](493cb4cc13/crates/buzz-db/src/store/artifact.rs (L196))
| The existing event kind accepts a mutually exclusive, signed community
UUID. HTTP and WebSocket bind it to the resolved tenant at ingest and
reuse the revision authentication checks.
[community_artifact.rs:120](0b8949f5e2/crates/buzz-relay/src/handlers/community_artifact.rs (L120))
[community_artifact.rs:174](0b8949f5e2/crates/buzz-relay/src/handlers/community_artifact.rs (L174))
|
| Scoped heads and revisions | The database key places every artifact in
one identity space per community. Only the relay can advance an accepted
head atomically across clients.
[artifact_heads.sql:2](493cb4cc13/schema/tables/public/artifact_heads.sql (L2))
[artifact.rs:187](493cb4cc13/crates/buzz-db/src/store/artifact.rs (L187))
| The head and revision ledger gain a scope discriminator. Community
revisions keep their signed payload in the ledger and reuse the
compare-and-set, replay and tombstone rules.
[community_artifact.rs:350](0b8949f5e2/crates/buzz-db/src/store/community_artifact.rs (L350))
|
| Community admission | Channel reads check channel visibility and
membership. A client can filter its own view but cannot enforce
admission for other readers or synchronize delivery with a revocation.
[artifact_query.rs:65](493cb4cc13/crates/buzz-db/src/store/artifact_query.rs (L65))
| Explicit community reads and writes share an admission check against
current membership, verified delegation and bans. Administrative
authority requires a direct role.
[community_artifact.rs:36](0b8949f5e2/crates/buzz-db/src/store/community_artifact.rs (L36))
|
| Per-type write policy | The administrative scope dispatch has no
artifact-policy command. A client preference cannot enforce an edit rule
against another client or a concurrent write.
[ingest.rs:650](493cb4cc13/crates/buzz-relay/src/handlers/ingest.rs (L650))
| One signed admin command sets policy for one exact type using
compare-and-set. A bounded map on the existing community row records the
policy and revision. A shared lock orders policy changes with writes,
and the existing audit chain commits in the same transaction.
[community_artifact.rs:183](0b8949f5e2/crates/buzz-db/src/store/community_artifact.rs (L183))
[community_artifact.rs:365](0b8949f5e2/crates/buzz-db/src/store/community_artifact.rs (L365))
[community_artifact.rs:189](0b8949f5e2/crates/buzz-relay/src/handlers/community_artifact.rs (L189))
|
| Signed HTTP reads | The artifact endpoint dispatches to the channel
store. It cannot return a community head, its history or the
authoritative write policy.
[artifact.rs:70](493cb4cc13/crates/buzz-relay/src/api/artifact.rs (L70))
[artifact_query.rs:65](493cb4cc13/crates/buzz-db/src/store/artifact_query.rs (L65))
| One scope selector on the existing signed endpoint extends the
current, history and head views and adds an exact-type policy lookup.
Counts and HTTP incremental tokens stay channel-only.
[artifact.rs:73](0b8949f5e2/crates/buzz-relay/src/api/artifact.rs (L73))
[artifact_sync.rs:154](0b8949f5e2/crates/buzz-relay/src/api/artifact_sync.rs (L154))
|
| Community WebSocket sync | The relay requires channel IDs and confirms
live interest on those channels. A client cannot register community
interest through the existing filter.
[artifact_sync.rs:51](493cb4cc13/crates/buzz-core/src/artifact_sync.rs (L51))
[artifact_sync.rs:440](493cb4cc13/crates/buzz-relay/src/handlers/artifact_sync.rs (L440))
| One exact type selects the community set. The relay reuses
subscription ownership, snapshot paging, bounded buffering, EOSE and
resync, with a current admission check before delivery.
[artifact_sync.rs:683](0b8949f5e2/crates/buzz-relay/src/handlers/artifact_sync.rs (L683))
[artifact_sync.rs:755](0b8949f5e2/crates/buzz-relay/src/handlers/artifact_sync.rs (L755))
[artifact_sync.rs:934](0b8949f5e2/crates/buzz-relay/src/handlers/artifact_sync.rs (L934))
|
| Cross-node delivery | Redis routes channel and ordinary global events.
A connected client cannot coordinate when peers reread an authorized
head.
[topic.rs:15](493cb4cc13/crates/buzz-pubsub/src/topic.rs (L15))
| One tenant-scoped topic carries the identity, exact type and change
cause. Each relay filters its own subscriptions and rereads the
authorized head or signals resync.
[artifact_sync.rs:211](0b8949f5e2/crates/buzz-relay/src/handlers/artifact_sync.rs (L211))
[artifact_sync.rs:1039](0b8949f5e2/crates/buzz-relay/src/handlers/artifact_sync.rs (L1039))
|
| Ordinary event audience | Generic queries and search apply event-store
rules. A client cannot enforce who else receives a response from those
paths, including on a relay with community writes disabled.
[event.rs:785](493cb4cc13/crates/buzz-db/src/store/event.rs (L785))
[query.rs:329](493cb4cc13/crates/buzz-search/src/query.rs (L329))
| Community payloads stay in the ledger. Ordinary reads and fan-out
enforce the channel boundary, including for rows from older paths.
Explicit artifact views enforce community admission.
[event.rs:7267](0b8949f5e2/crates/buzz-db/src/store/event.rs (L7267))
[event.rs:153](0b8949f5e2/crates/buzz-relay/src/handlers/event.rs (L153))
|
| Community redaction | The moderation path requires a channel in `h`. A
client delete cannot apply relay moderation to a stored community
revision.
[side_effects.rs:671](493cb4cc13/crates/buzz-relay/src/handlers/side_effects.rs (L671))
| The existing moderation kind gains one community-scoped target form
for direct owners and admins. Redaction preserves the accepted revision
ID and sends affected syncs through the existing resync path.
[community_artifact.rs:214](0b8949f5e2/crates/buzz-relay/src/handlers/community_artifact.rs (L214))
[community_artifact.rs:609](0b8949f5e2/crates/buzz-db/src/store/community_artifact.rs (L609))
|
| Community purge | The deletion executor retains the community row as a
tombstone. Client-side removal cannot clear authoritative policy on that
row or prove it was erased.
[deletion.rs:2448](493cb4cc13/crates/buzz-db/src/store/deletion.rs (L2448))
[deletion.rs:3488](493cb4cc13/crates/buzz-db/src/store/deletion.rs (L3488))
| The existing purge covers both ledger tables. The tombstone
transaction clears the policy map when the column exists, and the
absence check verifies it.
[deletion.rs:2451](0b8949f5e2/crates/buzz-db/src/store/deletion.rs (L2451))
[deletion.rs:3489](0b8949f5e2/crates/buzz-db/src/store/deletion.rs (L3489))
|
| Schema rollout | Older writers use the existing two-column conflict
target. Clients cannot preserve that write contract during a key change
or attest which relay binaries are serving.
[artifact.rs:196](493cb4cc13/crates/buzz-db/src/store/artifact.rs (L196))
| Migration 0097 adds columns and indexes without a backfill and
preserves the old key. A separate guarded SQL operation installs the
scoped key after the compatible fleet is in place. The rollout guide
documents the sequence and rollback boundary.
[0097_community_artifact_expand.sql:7](0b8949f5e2/migrations/0097_community_artifact_expand.sql (L7))
[community-artifact-contract.sql:13](0b8949f5e2/scripts/maintenance/community-artifact-contract.sql (L13))
[community-artifact-rollout.md:38](0b8949f5e2/docs/community-artifact-rollout.md (L38))
|
| NIP-11 and enablement | The baseline artifact descriptor supplies
neither the tenant UUID nor a signal that the scoped schema is active.
Clients cannot infer activation across mixed-version deployments.
[nip11.rs:478](493cb4cc13/crates/buzz-relay/src/nip11.rs (L478))
| One optional discovery object advertises the version, canonical tenant
UUID and policy limit. The handlers and NIP-11 share the configuration
and schema-readiness gate.
[nip11.rs:482](0b8949f5e2/crates/buzz-relay/src/nip11.rs (L482))
[community_artifact.rs:51](0b8949f5e2/crates/buzz-relay/src/handlers/community_artifact.rs (L51))
|

## Size

Measured with `git diff` from `493cb4cc1` to `0b8949f5e`. Dedicated test
files and changed lines inside Rust `#[cfg(test)]` items count as tests.
Each side of a mixed hunk is classified against its own revision.

| | Added | Removed |
| --- | ---: | ---: |
| Production, including schema and rollout SQL | 2,249 | 117 |
| Tests | 1,897 | 53 |
| Docs | 180 | 8 |
| Standalone runtime probe | 397 | 0 |
| **Total** | **4,723** | **178** |

The total includes
`crates/buzz-relay/examples/community_artifact_probe.rs`. The production
and test rows exclude it. The probe supports manual mixed-version and
feature-disabled checks against a running relay.

## Validation

Validated at `0b8949f5e29f5ccf51ec5e2d487f09e2f49bffeb` against
`493cb4cc1369ff9fdb44ae6c50f18c66d1fb6474`.

- The signed HTTP and WebSocket workflow exercised the old and new
channel writers on the expanded schema, the guarded key transition,
community snapshot and live sync, policy compare-and-set and replay,
tenant binding, scope isolation, and redaction followed by resync.
Restarting the relay with community scope disabled after the transition
withheld capability advertisement and preserved channel artifact
operations.
- The normal `buzz-db` suite passed 268 tests, including doctests. All
860 `buzz-db` PostgreSQL tests passed, including the wide `#e` read
regression from #9591.
- The full eight-package PostgreSQL run passed 1,695 of 1,696 tests.
`handlers::ingest::postgres_tests::reaction_and_deletion_h_must_name_the_target_channel`
failed while setting up its private-channel fixture. The same fixture
failed on the protocol base `27a4c8a86e9e9795bfaf5fe59f35164a6389a9ed`.
- The hosted PostgreSQL run at `686b8445` passed 1,698 of 1,699 tests.
The same test was the sole failure on the PR and on `main` at
`493cb4cc13`. In both runs, fixture setup returned `restricted: not a
channel member` while storing the private target. #9640 fixes the
fixture by invalidating the author's membership cache after creating the
private channel. Its PostgreSQL run passes the test. [PR run
44325182932](https://github.com/block/buzz/actions/runs/44325182932/job/134884438543)
· [Main run
44254013047](https://github.com/block/buzz/actions/runs/44254013047/job/134638066441)
· [Fix #9640](https://github.com/block/buzz/pull/9640) · [Passing test
on
#9640](https://github.com/block/buzz/actions/runs/44248427229/job/134618695910)
- `just test-unit` and `just test` passed on Linux in separate runs. The
commands recorded 6,611 and 7,243 passing test executions, respectively,
with overlap between the suites. These runs passed the CLI socket
ownership tests and push-gateway fixture that failed during the earlier
parallel hook run. Both Tauri Clippy configurations and 3,560 Tauri test
executions also passed at this commit.
- `just ci` passed Rust formatting, workspace Clippy, and desktop,
Tauri, and web checks. It stopped at mobile formatting after the Linux
environment failed to resolve `pub.dev` for the Flutter dependencies.


## End-user test

The PR author’s agent ran the app and plugin end to end on Linux against
a local relay built at `0b8949f5e`. The final browser rerun passed all
15 steps plus the public default-channel case. The native desktop run
passed all seven steps it covered.

- A group saved by the owner appeared in a member’s open Settings
without a reload.
- Changing the write policy to owners and admins made the member’s
editor read-only. The relay refused a signed write by that member and
preserved the current record.
- The audit log identified the policy revision as the accepted
kind-`9034` event ID. The policy change back to everyone used that ID as
`prev`.
- A second relay with community artifacts disabled advertised no
community scope, and the app withheld shared group actions.

[End-user test
evidence](https://github.com/block/buzz-app/pull/3838#end-user-test-agentsmd-step-3)

Supersedes #9646. The reviewed commit is now on an upstream branch.

---------

Signed-off-by: Krish Ray <kray@block.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
LordMelkor
2026-11-18 18:57:40 -05:00
committed by GitHub
parent b544fcea4a
commit eebf62b61d
60 changed files with 5018 additions and 281 deletions

View File

@@ -1,18 +1,18 @@
NIP-AR
======
Channel Artifacts
-----------------
Channel and Community Artifacts
-------------------------------
`draft` `optional` `relay`
Defines `kind:45010` for editable records called **artifacts**. Each artifact has one home channel and may be attached to a thread. Its home determines who can read it. Any number of artifacts, including of the same type, may share a channel or thread.
Defines `kind:45010` for editable records called **artifacts**. A channel artifact has one home channel and may be attached to a thread. Its home determines who can read it. The optional [community scope](#community-scoped-artifacts-proposed-extension) has its own audience and no channel home. Any number of artifacts, including of the same type, may share a channel or thread.
The relay manages identity, access, and revisions. Clients define the content types, such as `buzz.task` or `buzz.project`.
## Event format
Each event contains a complete snapshot. For example, a task created directly in a channel (standard signing fields omitted):
Each event contains a complete snapshot. This section defines the channel envelope. This task is created in a channel, with the standard signing fields omitted.
```json
{
@@ -52,7 +52,7 @@ Clients place fields needed for filtering in client-defined tags. The relay matc
## Identity and edits
An artifact is identified by `(community, d)`, independently of its author or home. `d` and `type` are immutable. Kind 45010 is a regular stored event, not a NIP-01 addressable event. It falls in Buzz's forum and social kind range (45000–45999) but is not a forum post and follows none of the forum rules.
A channel artifact is identified by `(community, d)` within the channel identity space, independently of its author or home. `d` and `type` are immutable. Kind 45010 is a regular stored event, not a NIP-01 addressable event. It falls in Buzz's forum and social kind range (45000–45999) but is not a forum post and follows none of the forum rules.
Creation requires an unused `d`, `op=create`, and no `prev`. Every later revision MUST name the current accepted event in `prev`. The relay checks authorization and advances the current revision atomically: two competing edits cannot both succeed. Timestamps do not choose the winner.
@@ -62,9 +62,11 @@ A `create` whose `d` is already in use fails. When the sender cannot read the ex
On creation or when changed from the previous accepted revision, `root` MUST identify an existing, undeleted conversation anchor in `h`. Later loss of that anchor does not prevent edits. Replies belong to that conversation, not to an artifact revision.
## Access
## Channel access
Channel read permission governs every artifact read, including lookups, history, search, previews, counts, and live updates. Threads inherit their channel's audience. Membership and visibility changes take effect on subsequent reads and deliveries.
This section applies to channel artifacts. Community artifacts follow [Admission and authorization](#admission-and-authorization) instead.
Channel read permission governs every channel artifact read, including lookups, history, search, previews, counts, and live updates. Threads inherit their channel's audience. Membership and visibility changes take effect on subsequent reads and deliveries.
Write permission means permission to post a kind-9 message in the channel, including authentication, token restrictions, moderation, and archive checks. Relays apply these checks the same way, and at the same point, as for a kind-9 message. This includes agents and, where channel policy permits, nonmembers of open channels. Artifact writes use `messages:write`, the scope that admits kind-9 posting.
@@ -132,7 +134,7 @@ sequenceDiagram
["REQ", "s1", {"artifact": "current", "#h": ["<channel>"], "#type": ["buzz.task"]}]
```
The filter MUST include `#h` with 1 or more channels. It accepts the same `#name` predicates and limits as a NIP-AR current-state query, with the same AND/OR rules, and also `kinds: [45010]`. It accepts no `limit` or `offset`. A relay rejects a filter without `#h`, or with an unknown key, with `CLOSED`.
A channel sync filter MUST include `#h` with 1 or more channels. It accepts the same `#name` predicates and limits as a NIP-AR current-state query, with the same AND/OR rules, and also `kinds: [45010]`. It accepts no `limit` or `offset`. A relay rejects a channel sync filter without `#h`, or any filter with an unknown key, with `CLOSED`. A community sync adds the `scope` key and forbids `#h` instead; see [Reading and syncing](#reading-and-syncing).
**Scope.** The sync's scope is the set of artifacts that a NIP-AR current-state query with the same filter returns to this reader at that time. The rules below use this one definition for access, matching and system channels.
@@ -237,6 +239,69 @@ Clients validate content before interpreting it as a known type. Unknown types o
Artifact text is untrusted. A type name, relationship tag, or payload cannot authorize a privileged action. Moving, deleting, or revoking access cannot erase copies already downloaded.
## Community-scoped artifacts (proposed extension)
### Envelope and identity
A relay advertising `artifacts.community_scope.version = 1` accepts a second form of kind 45010. A community artifact uses `["ar","1"]`, `["community","<community UUID>"]` and the usual `d`, `type`, `title`, `op` and `prev` tags. It MUST omit `h` and `root`. A channel artifact retains its existing envelope and MUST omit the new `community` tag. Reject a missing, mixed or repeated scope. The signed community UUID MUST equal the tenant resolved by the connection or HTTP request, including on retries. Clients obtain this stable UUID from the serving relay's `artifacts.community_scope.community_id` in NIP-11. Two hostnames that serve the same community advertise the same ID. The NIP-11 `artifacts` object advertises the scope:
```json
"community_scope": {"version": 1, "community_id": "<community UUID>", "max_policies": 256}
```
`max_policies` is the bound on stored type policies; this version uses 256. Scope UUIDs on input and output MUST be canonical lowercase, hyphenated, non-nil UUIDs.
Both scopes reuse the existing head and revision ledger. The identity in a community is `(community, scope class, d)`. Every channel remains in the same channel identity space, so moving a channel artifact preserves its identity. An artifact cannot move between scope classes. Reject `op=move` for a community artifact. In both scopes, `type` is immutable, and a revision naming an identity in the wrong scope answers like an unavailable head.
For one record per canonical key in a community type, clients MAY derive:
```
d = UUIDv8(first 16 bytes of SHA-256(
"nip-ar-community-artifact\0" + community_uuid + "\0" + type + "\0" + key))
```
The inputs are UTF-8. The UUID is lowercase and hyphenated. The type's client contract defines the canonical key, including case and Unicode normalization. Apply the version and variant bits as in the channel derivation. The distinct prefix separates the two derivations. Channel authors can choose arbitrary UUIDs, so the relay MUST also separate the two identity spaces in storage. The same UUID may exist in each scope and cannot reserve a record in the other. Within a scope, the first accepted create reserves the identity. The relay does not interpret names or content, and does not require the key or verify its derivation.
### Admission and authorization
| Operation | Required permission |
| --- | --- |
| Read, policy lookup, history, head, or sync | Current effective community admission and `messages:read`. |
| Create, update, delete, or restore | Current effective community admission, `messages:write` and the current write policy for the type. A community timeout blocks the write. |
| Set a type's write policy | A direct community owner or admin acting under `admin:users`. Apply the relay's administrative ban and timeout rules. |
Apply the same authenticated transport, event signer, expiry, size, quota and moderation rules on HTTP and WebSocket. A channel-restricted credential cannot use community scope, even if it covers every channel. Unauthenticated reads and generic channel permissions confer no community access. Treat lookup failure as denial or an error, with no artifact data. On an open relay, any authenticated principal admitted by current relay rules qualifies under `everyone`, even with no roster row. On a roster relay, the principal needs current effective membership, direct or through verified delegation admitted by the relay. Delegation does not transfer an owner's or admin's role. Apply the principal's and applicable owner's community restrictions. A ban blocks reads and writes, including replay. A timeout leaves reads available. Channel membership, archive, posting restrictions and channel admin roles do not grant or restrict these operations.
### Type write policy
The policy is tenant-scoped and keyed by the exact canonical artifact `type`. Missing means `everyone` with no prior policy revision. `admins` admits only an author who personally holds the community owner or admin role. The default on a rosterless open community is still `everyone`. Setting policy requires a configured community owner or admin.
Use the signed relay-admin command `SET_ARTIFACT_TYPE_POLICY` (proposed kind 9034, pending allocation). Require `community`, `type`, `policy` (`everyone` or `admins`), and `prev` (the current policy command ID or `0` for no prior command). Omit `h` and use empty content. The signed `community` MUST equal the tenant resolved by the request. After verifying the signature, refuse a command signed for another community before consulting any accepted-command record, including on retry, so an admin of several communities cannot apply it to the wrong one. Apply the relay-admin freshness and signer checks. Return a conflict for stale `prev`; an exact retry of the current accepted command is a no-op if the requester is still authorized. A superseded policy command may conflict on retry. Read current policy before retrying a conflicted command. The relay records the accepted admin action in its audit trail. The command is neither a kind 45010 revision nor an event in an ordinary subscription. A client with artifact-signing access alone cannot sign this command through that capability.
A signed HTTP `/query` policy lookup takes one exact type. For example, `{"artifact":"policy","scope":"community","#type":["example.settings"]}`. It returns `{"policy":"everyone","revision":null}` for an unset type, or the current policy and accepted command ID. The relay advertises and enforces a bound on stored policy entries. At the bound, it rejects a command for a type with no entry, whatever its `policy`, and still accepts changes to existing entries. Switching a configured type back to `everyone` retains its revision, and the entry still counts toward the bound. Retaining the revision prevents an older command from resetting the compare-and-set history.
A committed policy change governs new revisions, including updates, deletes and restores of existing records. It neither rewrites records nor changes their audience. A write and a policy change MUST be serialized so their admission and commit order agree. Serialize policy updates against write admission before acquiring the artifact's identity lock, including if the type has never had a policy. Recheck the write policy in the transaction. An older pending write that still qualifies must still satisfy the head compare-and-set. An exact previously accepted artifact replay by the same signer, with current community read admission and an unrestricted `messages:write` credential, returns only acknowledgement. It does not re-evaluate the edit policy, timeout or freshness, and it does not write or publish again. This acknowledgement grants no authority to create a new revision. A ban still refuses the replay. Check current community admission and the signed community before consulting receipts.
### Reading and syncing
Select the community scope explicitly with `"scope":"community"` on the signed HTTP views `current`, `head` and `history`. For WebSocket sync, use:
```json
["REQ", "s1", {"artifact":"current","scope":"community","#type":["example.settings"]}]
```
This sync selects one exact type and can use the existing exact tag predicates. `#h` is forbidden, and `head` still requires `#d`. Apply admission and scope before any filtering or paging. Reject community-scoped count requests in this version with an explicit error, never a zero or empty count. A legacy filter still sees only channel artifacts. Generic event reads, search, counts, direct ID fetches and ordinary live fan-out MUST exclude community artifact payloads. Route authorized reads through the explicit artifact views. HTTP incremental tokens and deltas remain channel-only in this version. Reject attempts to apply them to community scope.
Use the same snapshot, buffer bounds, `EOSE` and head sequencing as channel sync. Confirm live interest in the authenticated tenant before opening the snapshot. Only pass change signals to sync, and re-read authorized heads before delivery. A tag or deletion transition follows the existing before-and-after match rule. There is no kind 45011 move removal for community scope. Check current community admission, including any required FI credential, within the initial snapshot and each live head read. When an invalidation or a denied live read reveals loss of access, close the sync with `CLOSED "resync: ..."` or disconnect the session. An idle sync may retain an older set until the next relevant signal or socket revocation. A failed initial read cannot send `EOSE`. After loss of access, the client discards the active set for that community; after re-admission it starts with a fresh complete snapshot. Follow existing sync rules for loss of pub/sub, output and redaction signals. Changing an edit policy alone changes no content or read access.
### Delete and moderation
A community soft delete reserves its `d` under the same rules as a channel soft delete. The authorized way to recreate a canonical key is to read its deletion head and send `restore` with that ID in `prev`. A rename to a different key is a create and delete with separate commits. Existing references still address the old identity. A kind-5 deletion cannot target a community artifact revision.
For community moderation, use a community-bound kind 9005 command with a single target revision `e` and no `h`. Verify that the target is a community-scoped kind 45010 revision in this tenant. Require the existing moderation write scope and direct owner or admin authority, independent of who can edit its type. Redact through the existing moderation path and retain the accepted revision ID. Redaction of a current head ends any affected sync with resync. A kind 9005 with one valid `h` and no `community` uses the existing channel path. Reject repeated, missing or mixed scopes. This command does not emit a channel removal or update chat counters. Deleting the community itself purges both scopes, their acceptance ledgers and the type policies.
A relay MUST enable community writes and advertise the capability only after all backends that can serve the community enforce the community audience on queries, lookups, moderation and delivery.
## Incremental reads
Incremental reads maintain an eventually consistent local store. They do not prove a complete set at one database snapshot. Absence from a page never proves deletion or loss of access.