Repository navigation
Retire the 0032 roster trigger in migration 0095 - #8696
Conversation
🔐 Codex Security Review
Review SummaryOverall Risk: NONE
FindingsNo concrete security, correctness, or reliability findings were identified. Notes
Generated by Codex Security Review | |
TheSentinel454
left a comment
There was a problem hiding this comment.
🤖 Approving at d835556. Splitting the drop out of #8494 means the 0076 step can be rolled out and judged on its own. Every kind:39002 writer still has the application roster check, and the migration test fails if 0076 stops dropping the trigger. The SQL is identical to the 0074 we ran yesterday against a local relay, where a #8611 relay started both with and without the trigger. The one red PostgreSQL test (session_statement_timeouts_bound_writer_and_reader_sessions, PoolTimedOut) does not touch this change, and it passed in #8494, which contains all of this PR. As the PR says, merge only after #8611 runs in every environment.
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude's code review agent — APPROVE at exact head d835556200dce52c0b50c6d1c24816c59fd0ca91 (base 3dbc95c3f668547e501c7d5f306d85ca5dcd055e).
I reviewed this as the integrated A-Team verdict, incorporating the product/operator lane and the systems/integration lane. No unresolved author-actionable defect was found.
What I verified:
- Freshness/review state: GitHub PR head and local review head both stayed at
d835556200dce52c0b50c6d1c24816c59fd0ca91; authenticated reviewer and PR author are different GitHub identities; there are no unresolved review threads; required checks are green, with Mobile/Web skipped by path filter. - Migration scope:
migrations/0076_retire_channel_roster_trigger.sqlonly dropstrg_events_guard_channel_roster_snapshotandguard_channel_roster_snapshot()with boundedlock_timeout/statement_timeout; no data rewrite or backfill is introduced. - Desired-state convergence: the schema no longer installs the retired roster trigger/function, while the remaining events floor/write-fence triggers stay intact.
- Runtime contract: the application-side kind
39002roster validation remains on the production write seams before event insertion/replacement, including the relay-authored member snapshot path. - Regression coverage: the migration/schema tests pin the migration count/statements, desired-state absence, and the post-0076 behavior where raw stale roster inserts are no longer blocked by the retired trigger.
Validation evidence reviewed:
- GitHub required checks at this head: Rust lint/unit, PostgreSQL tests, Desktop E2E Relay, Backend Integration, Relay E2E, Security, DCO, Desktop RC all green; Mobile/Web skipped by path filter.
- Local exact-head lane evidence:
cargo fmt --check,scripts/test-postgres-test-discovery.sh,cargo test -p buzz-db --lib embedded_migrator_contains_consolidated_initial_schema -- --nocapture, andcargo test -p buzz-db --liball passed in the lane checkouts. Local Postgres-gated tests were not rerun outside CI.
Important operational gate, not author rework: the PR's documented required stop is still real. The visible relay-v* tags currently top out at relay-v0.2.1, and none contain #8611's merge commit (646ef8abf9bc5ac3e698826b38811033537a4806). Do not merge/deploy 0076 until a relay-v* release containing #8611 is tagged and deployed to every serving and rollback target, and the release notes name that required stop.
Author action: none from this review.
Verification owner: release/merge operator must enforce the #8611 required-stop gate before merge/deploy.
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent
Verdict: APPROVE
Reviewed: 3dbc95c3f668547e501c7d5f306d85ca5dcd055e..d835556200dce52c0b50c6d1c24816c59fd0ca91 (exact head d835556200dce52c0b50c6d1c24816c59fd0ca91)
Risk: medium-high operational/database risk. The code change is narrow, but it retires a database trigger/function that used to enforce the kind:39002 roster snapshot contract at the database boundary.
Behavior/contracts traced: migration 0076_retire_channel_roster_trigger, desired-state schema convergence, event insert/replaceable writer seams, relay-authored roster snapshot path, PostgreSQL/relay CI evidence, and the PR’s documented rollout prerequisite for #8611.
Findings: no unresolved author-actionable code/product defect.
Integrated review evidence:
- Product/operator lane found no user-facing or operator-trust defect. The migration documents the required #8611 stop, lock/statement timeout behavior, and drops only
trg_events_guard_channel_roster_snapshotplusguard_channel_roster_snapshot()(migrations/0076_retire_channel_roster_trigger.sql:1-20). - Systems lane verified desired-state convergence:
schema/schema.sql:65-68no longer includes the roster function,schema/triggers/events.sql:1-12keeps only the remaining events triggers, andscripts/reconcile-schema-after-pgschema.sql:16-21no longer carries roster child-trigger cleanup. - The app-side roster guard remains on the production write seams before event writes: canonical roster validation in
crates/buzz-db/src/store/channel_members.rs:72-152; generic append calls before insert incrates/buzz-db/src/store/event.rs:492and:1880; replaceable writers guard before delete/insert incrates/buzz-db/src/store/replaceable.rs:120-132,:263-264, and:442-492; relay-authored member snapshots revalidate in the locked writer path incrates/buzz-db/src/store/channel_members.rs:398-456and:510-526. - Test coverage pins the retirement: migration count/statements in
crates/buzz-db/src/runtime/migration.rs:779-788, desired-state absence in:1331-1347, andmigration_0076_retires_the_roster_triggerincrates/buzz-db/src/store/channel_members.rs:5049-5113proves pre-0076 trigger presence, post-0076 absence, and raw stale-roster acceptance after retirement.
Author action: none.
Verification owner: release/operator. The PR’s own rollout gate must be enforced before merge/deploy: do not merge/deploy migration 0076 until a relay-v* containing #8611’s merge commit 646ef8abf9bc5ac3e698826b38811033537a4806 is tagged and deployed to every serving and rollback relay target, with release notes naming that required stop. Visible relay-v* tags still topped out at relay-v0.2.1 in the review-room check and did not contain that commit. That is an operational release gate, not author code rework.
Validation: review lanes reported exact-head green required GitHub checks for Rust Lint, Unit Tests, PostgreSQL Tests, Desktop E2E Relay, Backend Integration, Relay E2E, Security, DCO, and Desktop RC, with Mobile/Web skipped by path filter. Local exact-head checks reported by the lanes: cargo fmt --check PASS, scripts/test-postgres-test-discovery.sh PASS, cargo test -p buzz-db --lib embedded_migrator_contains_consolidated_initial_schema -- --nocapture PASS, and cargo test -p buzz-db --lib PASS (182 passed; 642 ignored). Local Postgres-gated tests were not rerun by the lanes; exact-head GitHub PostgreSQL Tests were green.
Manual/native evidence: not applicable; this is a relay/database migration retirement with no Desktop/UI runtime behavior.
Residual risk: rollout ordering is the material remaining risk and is owned by the release/operator gate above.
Agent correction: duplicate exact-head approval submitted after an equivalent approval already existed; dismissing duplicate per review idempotency contract.
d835556 to
33d4fbb
Compare
`bot` has the same permissions as `member`; it only labels a key with a recorded agent owner. Writers store `member` for both ordinary roles, and every role read computes the label: `bot` exactly when users.agent_owner_pubkey is set for the key in that community. - The app-side roster check treats `member` and `bot` as one role. - When first AUTH or a v1/v2 invite claim records an agent's owner, the relay updates its owner caches and republishes the agent's rosters in the background, at most two republishes at a time per process. - A re-add that changes only member/bot reports the member as already present. - The relay refuses to start while the 0032 roster trigger is installed: migration 0079 (#8696) must run first. This restacks the branch onto #8696 after main took migrations 0076-0078. It replaces these earlier commits: - Update the owner caches when an invite claim records an agent owner (47458e4) - Republish an agent's rosters when an invite claim records its owner (35fc447) - Renumber the roster-trigger retirement to migration 0076 (62290cf) - test(relay): bind the member/bot re-add report to the kind:9000 path (c1aabfa) - Treat member and bot as one role when reporting a re-add (d20e11d) - Drop the one-shot member/bot roster reconcile scan (f8ebee0) - Refuse to start while the 0032 roster trigger is installed (a4311bb) - Bound roster republishes and tighten the 0074 rollout (4c2448c) - test(relay): first AUTH is not held by a contended roster lock (143e4c7) - Compute the member/bot label at read time and retire the roster trigger (02ccba9) Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
33d4fbb to
64b5dcb
Compare
`bot` has the same permissions as `member`; it only labels a key with a recorded agent owner. Writers store `member` for both ordinary roles, and every role read computes the label: `bot` exactly when users.agent_owner_pubkey is set for the key in that community. - The app-side roster check treats `member` and `bot` as one role. - When first AUTH or a v1/v2 invite claim records an agent's owner, the relay updates its owner caches and republishes the agent's rosters in the background, at most two republishes at a time per process. - A re-add that changes only member/bot reports the member as already present. - The relay refuses to start while the 0032 roster trigger is installed: migration 0079 (#8696) must run first. This restacks the branch onto #8696 after main took migrations 0076-0078. It replaces these earlier commits: - Update the owner caches when an invite claim records an agent owner (47458e4) - Republish an agent's rosters when an invite claim records its owner (35fc447) - Renumber the roster-trigger retirement to migration 0076 (62290cf) - test(relay): bind the member/bot re-add report to the kind:9000 path (c1aabfa) - Treat member and bot as one role when reporting a re-add (d20e11d) - Drop the one-shot member/bot roster reconcile scan (f8ebee0) - Refuse to start while the 0032 roster trigger is installed (a4311bb) - Bound roster republishes and tighten the 0074 rollout (4c2448c) - test(relay): first AUTH is not held by a contended roster lock (143e4c7) - Compute the member/bot label at read time and retire the roster trigger (02ccba9) Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
64b5dcb to
ecce12f
Compare
`bot` has the same permissions as `member`; it only labels a key with a recorded agent owner. Writers store `member` for both ordinary roles, and every role read computes the label: `bot` exactly when users.agent_owner_pubkey is set for the key in that community. - The app-side roster check treats `member` and `bot` as one role. - When first AUTH or a v1/v2 invite claim records an agent's owner, the relay updates its owner caches and republishes the agent's rosters in the background, at most two republishes at a time per process. - A re-add that changes only member/bot reports the member as already present. - The relay refuses to start while the 0032 roster trigger is installed: migration 0081 (#8696) must run first. This restacks the branch onto #8696 after main took migrations 0076-0078. It replaces these earlier commits: - Update the owner caches when an invite claim records an agent owner (47458e4) - Republish an agent's rosters when an invite claim records its owner (35fc447) - Renumber the roster-trigger retirement to migration 0076 (62290cf) - test(relay): bind the member/bot re-add report to the kind:9000 path (c1aabfa) - Treat member and bot as one role when reporting a re-add (d20e11d) - Drop the one-shot member/bot roster reconcile scan (f8ebee0) - Refuse to start while the 0032 roster trigger is installed (a4311bb) - Bound roster republishes and tighten the 0074 rollout (4c2448c) - test(relay): first AUTH is not held by a contended roster lock (143e4c7) - Compute the member/bot label at read time and retire the roster trigger (02ccba9) Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
|
Hi @loganj, I have resolved the merge conflicts with the latest
A clean, zero-conflict branch is available at: You can pull it directly into your branch: git fetch https://github.com/presentyourlove/buzz.git fix/retire-roster-trigger-8696
git merge --ff-only FETCH_HEAD |
ecce12f to
c3969f4
Compare
9205580 to
70cd5d0
Compare
… functions (contract) (#9598) ## Summary Phase 2 of retiring the two remaining plain SQL functions. Phase 1 moved their work into the relay: - #9396 builds the community deletion lock key in Rust (`deletion::community_deletion_lock_key`, locked with `hashtextextended($1, 0)`). - #9397 reads profile names with inline SQL (`PROFILE_NAME_FIELDS` in `buzz-search`). No relay at or after #9397's merge (`279a31da`) calls either function. This PR drops them: - **Migration 0093** runs `DROP FUNCTION community_deletion_lock_key(UUID)` and `DROP FUNCTION profile_name_fields(TEXT)` under a 5s `lock_timeout`, with no `IF EXISTS` and no `CASCADE`. If anything still depends on a function, the migration fails instead. Migrations 0029 and 0064 stay frozen. No database function calls either one any more: 0090 dropped the fence functions, which were the only SQL callers of the lock key. - **Desired state:** removes both `schema/functions/` files and their `schema.sql` includes. Both boot paths stay catalog-equivalent (`admin_schema_parity_between_desired_state_and_migrations`). - **Tests:** - New `migration_0093_drops_plain_sql_functions`. It migrates to 0092, checks that both functions exist and that serving and deletion catalog validation pass, then runs 0093 and checks that both functions are gone and that validation still passes. This covers new code on either side of the drop. - The migration listing test pins 0093's statements and that it has no `CASCADE`. - `desired_state_catalog_has_no_universal_fence_and_still_boots` now asserts that both functions are absent. - Replaces the Rust-vs-SQL lock key parity test with `community_deletion_lock_key_bytes_are_fixed`, a unit test that maps fixed UUIDs (nil, max, and one with hex letters) to their exact keys. Older replicas and the repair-script key in `docs/database.md` build the same string, so a changed prefix or UUID format must fail a test. - Removes two relay test-schema wrappers (`bridge.rs`, `ingest.rs`) that forwarded `community_deletion_lock_key` to `public`. Writers no longer call it, and the wrapper's `CREATE FUNCTION` would fail once the function is gone. - **Docs:** `docs/trigger-retirement-deployment.md` gets a `0093` section with the required stop. ## Deploy gate **Required stop:** any relay build at or after `279a31da` (#9397's merge, which follows #9396). `relay-v0.3.0` does not contain it. A relay older than that which still serves after 0093 fails every write and deletion that takes the community deletion lock, with `42883 community_deletion_lock_key(uuid) does not exist`, and its profile name search fails with `42883 profile_name_fields(text) does not exist`. 0093 takes no table locks and needs no cleanup. Migration number: #8696 and #9398 also propose `0093`. Whichever lands second renumbers. ## Review-Proven Rules - **RPR #2 (every path):** I checked every reference on `main` and at the stop build `279a31da`. At both, only test code reads either function: no boot, readiness, catalog or runtime query depends on them. Serving and deletion catalog validation pass before and after 0093, in the new test. - **RPR #3 (falsifiable):** removing the `profile_name_fields` drop from 0093 turns `migration_0093_drops_plain_sql_functions` red. - **RPR #3 (lock key bytes):** a changed prefix, `.simple()` UUID formatting, or uppercase formatting each turns `community_deletion_lock_key_bytes_are_fixed` red. ## What got simpler Two database functions, their desired-state files, a cross-language parity test and two test-only SQL wrappers are gone. After this PR, the only functions left in `schema/functions/` are trigger functions. ## Validation Blox gate at `95ac71c8`: - `cargo fmt --all --check`, and `cargo clippy -p buzz-db -p buzz-relay --all-targets -D warnings`. - `buzz-db --lib` unit tests: 216/216, including the migration listing test. - `buzz-db` Postgres tests (`migration::`, `deletion::`, `nip_fi_binding::` postgres_tests): 130/130. These include `migration_0093_drops_plain_sql_functions`, `admin_schema_parity_between_desired_state_and_migrations` and `deletion_surface_parity_between_migration_0029_and_schema_sql`. - `buzz-search` `profile_names*` Postgres tests: 4/4, on a fully migrated database where `profile_name_fields` no longer exists. - The two relay tests whose test-schema wrapper this PR removes: 2/2. - Must-fail check: with the `profile_name_fields` drop removed from 0093, `migration_0093_drops_plain_sql_functions` fails. Second Blox gate at `e1b5513a` (the lock key vector test): - `cargo fmt --all --check`, and `cargo clippy -p buzz-db --all-targets -D warnings`. - `buzz-db --lib` unit tests: 217/217. - Must-fail checks: a changed prefix, `.simple()` and uppercase UUID formatting each fail `community_deletion_lock_key_bytes_are_fixed`. The first gate run found that `deletion_surface_parity_between_migration_0029_and_schema_sql` still expected `community_deletion_lock_key` in `schema.sql`. The second commit fixes that. 🤖 Generated with [Claude Code](https://claude.com/claude-code) buzz-review-completed --------- Signed-off-by: Luke Tornquist <tornquist@squareup.com> Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
70cd5d0 to
13b5497
Compare
Every kind:39002 roster writer already checks the roster against canonical channel membership in the application (#8316), and since #8611 no relay requires the 0032 trigger at startup. Migration 0095 drops the trigger and its function, with the lock and statement timeouts from 0049. The desired-state schema and the pgschema reconcile script no longer install them. With this trigger gone, events has no triggers left, so schema/triggers/events.sql and the reconcile script's pre-attach trigger drops go too. Relays from this change still store and publish the requested role, so they serve correctly whether or not 0095 has run. Every relay, and every rollback target, must run #8611 or later before 0095 is applied. Tests that compared the trigger with the app check, or that disabled the trigger first, now test the app check alone. A new Postgres test applies 0095 to a database migrated through 0094 and checks that the trigger and function are gone. The pgschema populated-upgrade fixture now drops the roster trigger on events before pgschema runs, as it does for the other retired parent triggers. Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
docs/trigger-retirement-deployment.md is the operator guide for the trigger-dropping migrations 0089-0091. Migration 0095 drops one more, so add it there: its row, the two ways an older relay fails (a relay without #8316 can save stale rosters; a build with 0032 but without #8611 cannot start once the trigger is gone), the migrate check, and the parent trigger a pgschema deployment must drop first. The guide's stop build already contains #8316 and #8611. The Helm chart README now names the required stop and points to that guide instead of describing it separately (docs/database.md Rule 5). Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
13b5497 to
ab67806
Compare
Main now has 0095 for the roster trigger drop (#8696). Move this drop to 0096 and name 0096 in the chart's required-stop note. Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
…#9398) > [!NOTE] > **Rollout:** #8320 (app guards + catalog expand) is deployed, so the hold is lifted. With `autoMigrate=true`, `0096` runs at startup under a 5s lock timeout, and a failure stops startup. With `BUZZ_AUTO_MIGRATE=false`, deploy this binary first and then run `buzz-admin migrate`. Both orders are safe because the expand tolerates the objects being present or absent. ## What The required stop for `0096` is in `docs/trigger-retirement-deployment.md` (from #9622): a relay build at or after #8320 (`ec778bff`). A build older than that needs the tombstone trigger at startup and readiness. Migration `0096_drop_single_table_guards.sql` drops five triggers and their functions. #8320 moved each invariant into the application writers: | Trigger (table) | Function | |---|---| | `trg_channels_community_id_immutable` (channels) | `channels_community_id_immutable()` | | `communities_deletion_tombstone` (communities) | `enforce_community_tombstone()` | | `community_deletion_request_retargeting_guard` (community_deletion_requests) | `prevent_community_deletion_request_retargeting()` | | `community_deletion_approval_removal_guard` (community_deletion_approvals) | `prevent_community_deletion_approval_removal()` | | `community_deletion_manifest_keys_guard` (community_deletion_manifest_keys) | `protect_community_deletion_manifest_keys()` | Desired state (`schema/`) drops the five functions and four trigger files, plus the channels trigger declaration. The universal write fence on `channels` stays. Both boot paths stay catalog-equivalent: the pgschema-vs-migration parity check now also compares columns, key and FK shapes, and the remaining triggers on all five tables. Executor GUCs stay because `assert_community_write_allowed` still reads them through the universal write fence. `transition_community` and every phase-1 app guard are byte-identical to #8320. `scripts/reconcile-schema-after-pgschema.sql` has no entries for these objects. ## Tests - #8320's six `single_table_guard_*_without_trigger` PG tests no longer need to disable a trigger. They are now plain app-path tests with the same assertions. - New per-test regressions for the desired-template and migration boot paths assert that none of the ten objects exist, including disabled triggers and function overloads. - Deleted assertions that only exercised raw SQL against the triggers: retarget, rewrite and approval mutation, frozen-manifest rewrite, and tombstone DELETE. The app-path coverage for each remains. - The expand regression in #8320 migrates through `0086`, validates serving, readiness and the deletion lifecycle, drops the five guards, then validates again. - Rebased onto main `b568d9bf` after #8696 took `0095`; renumbered to `0096`. Blox gate at `7bda1f45`: fmt, clippy and buzz-db `--lib` pass; the PostgreSQL lane ran 219 tests, all pass. - Gate at `c8bc061c` (on main `051dd2d7`, then numbered `0095`, #9622 folded in): on Blox, `cargo fmt --check`, clippy and the buzz-db `--lib` tests pass. The PostgreSQL lane (migrations, single-table guards, floor retirement, fence and deletion) ran 208 tests: all pass. - Earlier gate at `0840ba49`: CI was green, and the Blox PostgreSQL lane passed 840 of 841 (the one failure, `media_reference_full_query_plans`, is a timing check that fails the same way on main on that host). - The rebase updates main's fence-retirement tests to expect the tombstone trigger gone. ## What got simpler Ten database behavior objects and nine desired-state files are gone (about 150 lines). Each rule has a single owner, the application writer. buzz-review-completed 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Luke Tornquist <tornquist@squareup.com> Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: Tom Brow <tomb@squareup.com> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
…c-spec-mobile * origin/main: (37 commits) buzz-db: drop the five single-table guard triggers (BUZZ-318 phase 2) (#9398) push-gateway: lock expired installations before reaping (#9627) Retire the 0032 roster trigger in migration 0095 (#8696) fix(db): hard-delete superseded relay-signed lists (#9586) Add community-scoped user and agent profile cleanup (#9580) fix(sdk): timestamp channel messages with millisecond offsets (#9548) Check product_feedback's community in the writing transaction (#9608) buzz-db: stop calling the dropped lock-key function in SQL (#9615) Clean up account records and refresh member lists (#9364) perf(mobile): save own thread interest once per unread catch-up (#9614) buzz-db: fix main (renumber the function drop to 0094, update_channel test call) (#9616) feat(relay): name the agent whose add policy refuses a DM (#9601) buzz-db: drop the community_deletion_lock_key and profile_name_fields functions (contract) (#9598) fix(deps): clear chrono, humantime and zip advisories from the dependency policy (#9609) docs: define mobile diagnostic reporting (#9600) build(mobile): link iOS plugins through Swift Package Manager (#9597) feat(push-gateway): enroll Android installations and send FCM wakes (#9560) perf(mobile): cache and animate custom emoji in the iOS picker (#9479) fix(ios): end each bold or strikethrough run at its first closing marker (#9559) Apply the private-to-open rule in update_channel too (#9581) ... Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Summary
Migration 0095 drops the 0032 channel roster trigger (
trg_events_guard_channel_roster_snapshot) and its function (guard_channel_roster_snapshot()).The trigger repeats a check that the relay already does in Rust. Every kind:39002 roster writer checks the roster against the channel's membership before it saves it (#8316). Since #8611, no relay requires the trigger at startup. This PR is the last step of the trigger retirement sequence in
docs/database.md.This PR was split out of #8494 so the migration can roll out by itself. A relay from this PR does not change how it stores or publishes roles, and it has no new startup check. It serves correctly whether or not 0095 has run. #8494 stacks on this PR and must not merge until 0095 has run in every environment.
Details
DROP TRIGGERandDROP FUNCTION, withlock_timeout = '1s'andstatement_timeout = '5s'as in 0049.DROP TRIGGERtakesACCESS EXCLUSIVEon eacheventspartition in turn, so event reads and writes block while it runs. A timeout rolls it back with no change, and it can be retried.schema/functions/guard_channel_roster_snapshot.sqlis removed. This was the last trigger onevents, soschema/triggers/events.sqland its include go too, as do the pre-attach trigger drops inscripts/reconcile-schema-after-pgschema.sql.docs/trigger-retirement-deployment.mdfor migrations 0089–0091. (0092 from feat(deletion): clean up media for users and owned agents #9365 and 0093 from feat(push-gateway): enroll Android installations and send FCM wakes #9560 drop nothing; 0094 from buzz-db: drop the community_deletion_lock_key and profile_name_fields functions (contract) #9598 drops two plain SQL functions and has its own section there.) This PR adds 0095 to it: its row, the two ways an older relay fails, the migrate check, and the parent trigger a pgschema deployment must drop first. The Helm chart README names the required stop and points to that guide.Rollout
Required stop: the stop build in
docs/trigger-retirement-deployment.md(a relay build at or after68785206, the merge of #8325). That build contains #8316 (the app-side roster check) and #8611 (no startup trigger check), so it covers 0095 too.relay-v0.3.0contains #8316 and #8611 but not #8325, so it is no longer enough on its own: any build with 0095 also has 0089–0091. Without the stop, an untaggedmainbuild between 0032 and #8611 refuses to start once the trigger is gone, and a relay without #8316 can save stale kind:39002 snapshots (docs/database.mdRule 5).Merge gate. Every push to main publishes relay
:mainimages, and the Helm chart defaults tomigrate.autoMigrate=true. Do not merge this PR until the stop build or later runs on every serving and rollback target. That is the same gate #8326 had for 0089–0091.After that, either way works:
autoMigrate=true, the first relay from this PR applies 0095 at startup.autoMigrate=false, runbuzz-admin migratewhen convenient. Relays from this PR serve with or without 0095.As with every new migration, an older binary with auto-migration on refuses a database that has 0095 (sqlx
VersionMissing). A rollback past this release needs auto-migration off (docs/database.md).What happens next
#8494 computes the
member/botlabel at read time. The 0032 trigger compares labels with the stored role exactly, so it would refuse those rosters. #8494 adds a startup check that refuses to serve while the trigger is installed. Merge it only after 0095 has run everywhere.Testing
migration_0095_retires_the_roster_trigger: on a database migrated through 0094, the trigger and function are installed. After the remaining migrations, both are gone, and a raw kind:39002 insert that does not match membership is accepted. It fails if 0095 does not drop them.embedded_migrator_contains_consolidated_initial_schemapins 95 migrations and the 0095 statements, and checks that the desired-state schema no longer installs the function.migration_schema_desired_pgschema_reconcile_matches_populated_upgrade: its fixture drops each retired parent trigger before pgschema runs (pgschema drops partition copies before the parent, which PostgreSQL refuses with 2BP01). It now drops the roster trigger too.cargo check,cargo fmt --check, and 245/245 buzz-db unit tests pass; 760/764 buzz-db Postgres tests pass. The fourevent_follow_up_contracttests fail the same way onmainlocally and pass in CI. CI runs clippy and the full PostgreSQL lane.🤖 Generated with Claude Code