Repository navigation
fix(relay): allow deleting archived channels - #7569
Open
hyein-cbio wants to merge 1 commit into
Open
hyein-cbio wants to merge 1 commit into
hyein-cbio wants to merge 1 commit into
Conversation
🔐 Codex Security Review
|
hyein-cbio
force-pushed
the
hyein-cbio/jawfish
branch
from
October 17, 2026 22:44
a1e4b32 to
5719be4
Compare
cursor
Bot
force-pushed
the
hyein-cbio/jawfish
branch
from
October 20, 2026 21:46
5719be4 to
293f93c
Compare
Archive is a write-lock, not a tombstone. Owners could unarchive (kind:9002 archived=false) but not delete (kind:9008), so ephemeral huddle backing channels archived on hang-up or by the TTL reaper could not be removed. Signed-off-by: Hyein Cho <hyein.cho.cbio@gmail.com>
hyein-cbio
marked this pull request as draft
October 22, 2026 22:15
hyein-cbio
force-pushed
the
hyein-cbio/jawfish
branch
from
October 22, 2026 22:15
293f93c to
eb7a717
Compare
hyein-cbio
marked this pull request as ready for review
October 22, 2026 22:28
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow authorized NIP-29 delete-group events (
kind:9008) on archived channels. Huddle hang-up and the TTL reaper archive ephemeral backing channels; the relay currently rejects their deletion withinvalid: channel is archivedbefore the owner check and soft-delete handler can run.Both pre-storage archive gates (
ingestandvalidate_admin_event) now use one shared predicate:This adds the delete-group exception while preserving the current
maincontracts:9002): all pass these archive gates. The atomic DB write decides whether an edit is allowed under the channel row lock, after duplicate detection, as introduced by fix(relay): apply channel setting changes atomically and lock every membership writer #8516. Reintroducing anarchived=falsepre-check would incorrectly reject racing retransmissions instead of returning the duplicate result. Fresh name-only orarchived=trueedits on archived channels remain rejected by that DB write.9008): passes the archive gates, but still requires owner authorization (or the owning human of an owner-role agent). The existing handler performs the soft delete; this PR does not change it.9022, or9001whose targetptag names its author. Membership and last-owner checks still apply.Other events remain subject to the archive write-lock. The ingest gate's existing
target_denialhandling is unchanged.Rebased onto
block/buzz mainat20ba95ed8906b2b7ae1819bdddadf82c09778097. The PR remains one DCO-signed commit touching onlyingest.rs,side_effects.rs, ande2e_relay.rs.Related issue
Same bug as #2954, also reported in #7596. Earlier PRs addressing it: #2988 and #4669. This is not a new diagnosis.
Compared with #2988 and #4669
All three address the same two archive gates and touch the same three files. The comparison below describes the versions inspected, not a claim that an older PR cannot be updated.
90009002variants; both self-departure forms; reject9000, removal of another member,9005, and kind 19002validation after duplicate detection#2988's E2E is stronger than ours: this PR's E2E does not independently prove non-owner authorization, post-delete disappearance, or the rename write-lock. Both earlier PRs also use named kind constants; this helper retains numeric kinds, consistent with nearby admin handling. Our advantages are the shared gate predicate, the broader unit table, and compatibility with the current upstream lifecycle rules—not a different fix for the underlying bug.
Testing
Rust 1.95.0; all commands below ran with
SQLX_OFFLINE=true:cargo fmt --all --check— passed.cargo test -p buzz-relay --lib -- side_effects::tests— 10 passed, 0 failed.cargo clippy -p buzz-relay --all-targets -- -D warnings— passed, no warnings.cargo clippy -p buzz-test-client --all-targets -- -D warnings— passed, no warnings.9008from the production helper madearchived_channel_gate_allows_delete_groupfail withexpected kind 9008 to pass. Restoring it returned the suite to 10 passed.9001p tag with.allow_self_tagging(), so it exercises the real self-departure predicate.git diff --check origin/main..HEAD— passed.Live relay and human verification (completed)
Validated commit
eb7a71785f2ebd54acbb4329d6b57e2ecbc73404against an isolated local relay atws://127.0.0.1:17571, backed by disposable Postgres 17, Redis 7, and S3-compatible storage. No production data or credentials were used.test_owner_can_delete_archived_channel— 1 passed. A direct SQL query also confirmed that the channel had botharchived_atanddeleted_atset.main(20ba95ed) failed withinvalid: channel is archived, reproducing the original defect.test_nip29_departure_wire_archived_channel_allows_self_leave— 1 passed against the PR relay.only owner can delete group; the owner could delete without unarchiving. SQL confirmed the soft delete.archived=t, deleted=t.Known limitation:
test_unarchive_emits_member_added_notificationtimed out waiting for the membership notification on both the PR relay and unmodifiedmainin separate local databases. This is not an all-E2E-green claim; the failure was reproduced on the baseline. The full repository CI suite was not run locally.The committed deletion E2E remains unchanged and
#[ignore], because it needs a live relay; it does not duplicate the upstream self-departure E2E.To exercise the deletion flow against a configured local test relay:
SQLX_OFFLINE=true cargo test -p buzz-test-client --test e2e_relay test_owner_can_delete_archived_channel -- --ignored --exactExpected: the owner can archive the test channel and then submit
9008without unarchiving first; both events are accepted. No UI changes or screenshots. Local test services have been cleaned up.