fix(db): skip tombstoned communities in community_hosts enumeration - #7630
Open
olympusbuildz wants to merge 1 commit into
Open
olympusbuildz wants to merge 1 commit into
olympusbuildz wants to merge 1 commit into
Conversation
The community_hosts_with_operation query selected every row from communities with no deletion_state filter. After a whole-community deletion completes, the row remains as a tombstone (deletion_state = 'tombstone') while awaiting physical retention expiry. Both the NIP-43 maintenance sweep (usage_community_hosts) and the push worker pass these ids to reconcile_nip43_membership_snapshots, which calls publish_nip43_membership_list on each. The community write fence rejects the write, producing a WARN log every ~60s indefinitely. Filter the enumeration to active-only communities, matching the archival/deletion predicates already used elsewhere in community.rs. Fixes block#7558 Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
🔐 Codex Security Review
|
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.
The community_hosts_with_operation query selected every row from
communitieswith nodeletion_statefilter. After a whole-community deletion completes, the row remains as a tombstone (deletion_state = 'tombstone') while awaiting physical retention expiry — this is by design.Both the NIP-43 maintenance sweep (
usage_community_hosts) and the push worker pass these ids toreconcile_nip43_membership_snapshots, which callspublish_nip43_membership_liston each. The community write fence rejects the write, producing aWARNlog ("NIP-43 membership reconciliation failed") every ~60s indefinitely — exactly the symptom reported in #7558.Root cause: missing
deletion_statepredicate incommunity_hosts_with_operation(crates/buzz-db/src/store/usage.rs:399).Fix: filter to
archived_at IS NULL AND deleted_at IS NULL AND deletion_state = 'active', matching the archival/deletion predicates already used elsewhere in community.rs.Regression test:
test_community_hosts_excludes_tombstoned_communitiesverifies a tombstoned community is excluded while an active one is returned.Verification:
cargo test -p buzz-db --lib store::usage::— compiles, new test registered (Postgres tests are #[ignore])cargo clippy -p buzz-db -- -D warnings— cleancargo fmt --check -p buzz-db— cleancargo check -p buzz-relay— compilesFixes #7558