Repository navigation
Revert "feat(relay): support community-scoped NIP-AR artifacts" - #9689
Conversation
This reverts commit eebf62b. Community scope adds a relay access gate outside channel membership and needs relay maintainer review before it ships. Reverting before migration 0097 reaches a deployed database keeps the revert free of a schema recovery step. Co-authored-by: Paul <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@buzz.block.builderlab.xyz> Signed-off-by: Will Pfleger <wpfleger@block.xyz>
d17ffe2 to
1a70c29
Compare
🔐 Codex Security Review
Review SummaryOverall Risk: MEDIUM
Findings[MEDIUM]
|
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Star Lord recommends changes at 1a70c29 before merge. The source review found a startup regression for databases that applied the published migration. Databases using the scoped primary key also need a separate rollback plan, because the restored channel artifact upsert requires the legacy key. Reverted upsert · Rollback floor
The reverted change also made channel snapshot and live sends check a pending resync and connection cancellation under the queue lock. Keep those fences so a reader who loses access or sees a redaction while a frame is in flight receives no further payload. Co-authored-by: Paul <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@buzz.block.builderlab.xyz> Signed-off-by: Will Pfleger <wpfleger@block.xyz>
The public main image already shipped 0097, and auto-migrating databases have recorded it; removing the file makes those relays refuse to start. 0097 only adds columns and indexes the channel code ignores, so keep it and declare its expanded shape with the legacy primary key. Co-authored-by: Paul <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@buzz.block.builderlab.xyz> Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Review found that SET NOT NULL scanned artifact_heads under ACCESS EXCLUSIVE. docs/database.md requires three steps instead: - 0098 adds a NOT VALID check; - 0099 validates it under SHARE UPDATE EXCLUSIVE, so writes continue; - 0100 sets NOT NULL from the validated check and drops 0097's indexes and columns. 0098 also refuses a database whose artifact head key is the scoped key from the removed operator contract, before any cleanup runs. The migrations name #9689 as a required stop, because relays built from #9650 read the dropped column. Tests now bind the surviving head's exact channel and event, and check its revision. New tests check that 0099 runs beside an open head writer and that 0098 refuses the scoped key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
Relay images built from #9650 up to, but not including, #9689 read the columns 0100 drops. The chart's upgrade notes now tell operators to move every pod, job and rollback target to sha-a406191 or later first, and how to roll back after 0100. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
…ction-p * origin/main: (200 commits) fix(mobile): keep open shared sessions in Solo (#9704) fix(mobile): align channel indicators and Duo section menus (#9703) fix(mobile): allow person mentions in Solo chats (#9705) fix(mobile): let code scroll under the code block copy button (#9612) Transcribe Bestie hold recordings into text on device (#9645) feat(cli): show and search verified identity in users get (#9647) fix(mobile): keep agent poster up until the iOS video draws (#9688) test(relay): stop bridge cancel_fixture tests timing out on the first replica connect (#9691) Revert "feat(relay): support community-scoped NIP-AR artifacts" (#9689) feat(relay): add conditional Solo member role updates (#9667) feat(mobile): add saved channel section filters (#8479) feat(relay): support community-scoped NIP-AR artifacts (#9650) feat(mobile): add a diagnostics test report and test crash to Settings (#9676) fix(pubsub): round the rate-limit retry hint up from PTTL (#9552) feat(mobile): add diagnostic reporting module with crash capture (#9613) fix(mobile): recover stuck read-state updates and stale Mark Read (#9492) test(relay): refresh the author's membership cache after the stray-h private channel insert (#9640) fix(mobile): name the cause of account-unavailable sign-in errors (#9628) perf(db): bound deep keyset history pages by the cursor timestamp (#9549) feat(cli)!: consistent channels list/get/search output (type, visibility, labels, real created_at) (#9617) ... Signed-off-by: Matthew Boston <mboston@squareup.com>
…eaction-recipients * origin/main: (72 commits) fix(mobile): keep open shared sessions in Solo (#9704) fix(mobile): align channel indicators and Duo section menus (#9703) fix(mobile): allow person mentions in Solo chats (#9705) fix(mobile): let code scroll under the code block copy button (#9612) Transcribe Bestie hold recordings into text on device (#9645) feat(cli): show and search verified identity in users get (#9647) fix(mobile): keep agent poster up until the iOS video draws (#9688) test(relay): stop bridge cancel_fixture tests timing out on the first replica connect (#9691) Revert "feat(relay): support community-scoped NIP-AR artifacts" (#9689) feat(relay): add conditional Solo member role updates (#9667) feat(mobile): add saved channel section filters (#8479) feat(relay): support community-scoped NIP-AR artifacts (#9650) feat(mobile): add a diagnostics test report and test crash to Settings (#9676) fix(pubsub): round the rate-limit retry hint up from PTTL (#9552) feat(mobile): add diagnostic reporting module with crash capture (#9613) fix(mobile): recover stuck read-state updates and stale Mark Read (#9492) test(relay): refresh the author's membership cache after the stray-h private channel insert (#9640) fix(mobile): name the cause of account-unavailable sign-in errors (#9628) perf(db): bound deep keyset history pages by the cursor timestamp (#9549) feat(cli)!: consistent channels list/get/search output (type, visibility, labels, real created_at) (#9617) ... Signed-off-by: Matthew Boston <mboston@squareup.com>
## What Migrations `0098`–`0100` undo migration `0097` (community artifact expand). The declared schema goes back to its shape before #9650. #9650 added `0097`. The revert, #9689, removed the feature but kept `0097` byte for byte, because databases that auto-migrated recorded its checksum. No code on `main` reads or writes what `0097` added. This PR removes it with forward migrations, as `docs/database.md` requires ("Never edit a merged migration. Fix forward."). `artifact_heads.channel_id` gets `NOT NULL` back in the three steps from *Adding `NOT NULL` to a populated table*: - `0098` checks that the artifact head key is `(community_id, artifact_id)`, then adds `CHECK (channel_id IS NOT NULL) NOT VALID`. - `0099` validates the check under `SHARE UPDATE EXCLUSIVE`, so channel artifact reads and writes continue. - `0100` sets `NOT NULL` from the validated check (no scan), drops the check, drops `artifact_heads_live_type`, `artifact_heads_scoped_identity` and `artifact_revisions_scoped_identity`, and drops `artifact_heads.scope`, `artifact_revisions.scope`, `artifact_revisions.community_event`, `artifact_revisions.redacted` and `communities.artifact_type_policies`. The primary keys don't change. `0097` never changed them. ## Review checklist (docs/database.md) - **Phase:** contract. It follows the expand in #9650 (`0097`) and the code revert in #9689. - **Required stop:** every relay pod, job and rollback target must run #9689 (`sha-a406191`) or later before `0100` runs. The chart's upgrade notes (`deploy/charts/buzz/README.md`) say this, along with how to roll back with auto-migration off. No tagged relay release contains #9650. Only rolling images from `eebf62b6` up to, but not including, `a4061916` are affected. Relays built from #9650 itself read `artifact_heads.scope` and write with `ON CONFLICT` on `artifact_heads_scoped_identity`. Releases before #9650 never read these objects. - **Fails closed:** `0098` refuses a database whose artifact head key is the scoped key from #9650's removed operator contract script or declared schema. That database needs the recovery in #9689's Compatibility section. `0099` fails if any head has a null `channel_id`. Both stop before any cleanup. - No trigger, function, procedure, rule or foreign key is added. No migration changes existing rows. - Every schema location in Rule 4 is updated: `migrations/` and `schema/tables/public/` (`artifact_heads.sql`, `artifact_revisions.sql`, `communities.sql`). No reconcile-script or gateway change applies. - **Currently deployed relay:** a relay from #9689 or later doesn't use these objects, and neither does a relay from before #9650. The populated-table test runs every migration over channel artifact data. - **Locks:** each migration sets `lock_timeout = '5s'` and `statement_timeout = '30s'`. No index is built. ## Tests - `admin_schema_parity_between_desired_state_and_migrations` compares `artifact_heads`, `artifact_revisions` and `communities` across the desired-state and migrated paths. It fails without `0100`. - `populated_artifact_tables_auto_migrate_through_every_migration` checks that a channel head and revision written before `0097` survive with the same channel and event. - `artifact_unexpand_validates_while_channel_heads_are_written`: `0099` completes while a channel head write is still open. It fails if `0099` sets `NOT NULL` directly. - `artifact_unexpand_refuses_scoped_head_key`: `0098` stops on the scoped key and leaves `0097`'s columns in place. ## What got simpler The schema loses 5 unused columns and 3 unused indexes. `artifact_heads.channel_id` is required again, as the channel code assumes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Luke Tornquist <tornquist@squareup.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…c-spec-mobile * origin/main: fix(mobile): keep glass controls mounted and the wide thread push parallax (#9726) fix(mobile): stabilize Duo chat switching and sheet layering (#9717) Require relay schema owner review for migrations and schema (#9708) fix(relay): resurface a hidden DM when someone else messages it (#9678) fix(deploy): pin self-host installs to relay 0.3.0 (#9714) fix(mobile): keep open shared sessions in Solo (#9704) fix(mobile): align channel indicators and Duo section menus (#9703) fix(mobile): allow person mentions in Solo chats (#9705) fix(mobile): let code scroll under the code block copy button (#9612) Transcribe Bestie hold recordings into text on device (#9645) feat(cli): show and search verified identity in users get (#9647) fix(mobile): keep agent poster up until the iOS video draws (#9688) test(relay): stop bridge cancel_fixture tests timing out on the first replica connect (#9691) Revert "feat(relay): support community-scoped NIP-AR artifacts" (#9689) feat(relay): add conditional Solo member role updates (#9667) feat(mobile): add saved channel section filters (#8479) feat(relay): support community-scoped NIP-AR artifacts (#9650) feat(mobile): add a diagnostics test report and test crash to Settings (#9676) fix(pubsub): round the rate-limit retry hint up from PTTL (#9552) feat(mobile): add diagnostic reporting module with crash capture (#9613) Signed-off-by: Will Pfleger <wpfleger@block.xyz> # Conflicts: # mobile/test/features/activity/activity_page_test.dart
…-workflow-verified-mentions * 'main' of https://github.com/block/buzz: (21 commits) chore: require relay owner review for the relay and db crates (#9728) fix(mobile): align Huddle cards and preserve conversation navigation (#9713) Match mobile mention chips to desktop styling (#9706) feat(relay): push mentions to people outside a listed channel (#9623) fix(db): undo migration 0097 (#9710) fix(mobile): keep glass controls mounted and the wide thread push parallax (#9726) fix(mobile): stabilize Duo chat switching and sheet layering (#9717) Require relay schema owner review for migrations and schema (#9708) fix(relay): resurface a hidden DM when someone else messages it (#9678) fix(deploy): pin self-host installs to relay 0.3.0 (#9714) fix(mobile): keep open shared sessions in Solo (#9704) fix(mobile): align channel indicators and Duo section menus (#9703) fix(mobile): allow person mentions in Solo chats (#9705) fix(mobile): let code scroll under the code block copy button (#9612) Transcribe Bestie hold recordings into text on device (#9645) feat(cli): show and search verified identity in users get (#9647) fix(mobile): keep agent poster up until the iOS video draws (#9688) test(relay): stop bridge cancel_fixture tests timing out on the first replica connect (#9691) Revert "feat(relay): support community-scoped NIP-AR artifacts" (#9689) feat(relay): add conditional Solo member role updates (#9667) ... Signed-off-by: Camilo Sanchez <camilos@squareup.com>
|
🤖 A note for the record, now that this revert has merged. It isn't a request to bring the feature back. Without community-scoped artifacts, the Mention Groups plugin now keeps a community's groups in one open system channel, at one of eight channel IDs derived from the community's host. That works on today's relay, but a plugin can't stop someone from taking those IDs first:
Closing either gap needs the relay: for example, data that belongs to the community rather than to a channel, or channel IDs that only community owners and admins can create. The community scope in #9650 had neither gap, because its records belonged to the community. |
Reverts #9650 (squash commit
eebf62b6), except for migration0097and the channel artifact sync fences it added.Community scope adds a relay access gate based on community admission rather than channel membership, a new relay-admin command kind (
9034) and an operator-run key transition. Its design and NIP-AR text need relay maintainer review before they ship. Two integration gaps also remain:events, so an attachment referenced only by a community artifact is unreadable when media-read enforcement is on.The feature can return as a new PR once those are resolved.
Kept from #9650
0097, byte for byte. Published images already include it, and databases that auto-migrated have recorded it. Dropping it would stop those relays from starting. It only adds columns and indexes that the channel code ignores. The declared schema matches that expanded shape and keeps the(community_id, artifact_id)primary key, so the operator key transition no longer exists.Compatibility
This revert supports databases that applied only migration
0097, which is all that auto-migration runs. A database that ran #9650's operator contract script, or was bootstrapped from #9650's declared schema, has no(community_id, artifact_id)key, so channel artifact writes fail there. Before deploying to such a database, check thatartifact_heads_pkeyis on(community_id, artifact_id)and thatartifact_headshas no rows withscope = 'community'; if either check fails, it needs a separate recovery step.