From 7f191ccb1eae0ddfd3c7464f984ec5f205fdb132 Mon Sep 17 00:00:00 2001 From: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co> Date: Fri, 26 Jun 2026 23:41:50 -0400 Subject: [PATCH] fix(relay): clear clippy on integrated multi-tenant stack The H1 fanout fix threaded a server-resolved CommunityId through the connection registry and two membership caches, tipping three clippy lints: register() to 8 args (too_many_arguments) and the moka cache keys to type_complexity. Allow both locally with rationale, matching existing repo convention (observer_owner_cache already carries the same allow in this file; buzz-db/buzz-cli use too_many_arguments allows). Also relocate topic_for_subscription above the req.rs test module to clear items_after_test_module surfaced by --all-targets. No behavior change; buzz-relay 385/0, clippy --all-targets -D warnings clean. Co-authored-by: Tyler Longwell Signed-off-by: Tyler Longwell --- crates/buzz-relay/src/handlers/req.rs | 14 +++++++------- crates/buzz-relay/src/state.rs | 8 +++++++- crates/buzz-relay/src/tenant.rs | 5 ++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/crates/buzz-relay/src/handlers/req.rs b/crates/buzz-relay/src/handlers/req.rs index 8a1c7cc34..0a0cb5e87 100644 --- a/crates/buzz-relay/src/handlers/req.rs +++ b/crates/buzz-relay/src/handlers/req.rs @@ -993,6 +993,13 @@ pub(crate) fn author_only_filters_authorized(filters: &[Filter], authed_pubkey_h }) } +fn topic_for_subscription(channel_id: Option) -> EventTopic { + match channel_id { + Some(channel_id) => EventTopic::Channel(channel_id), + None => EventTopic::Global, + } +} + #[cfg(test)] mod tests { use super::*; @@ -1441,10 +1448,3 @@ mod tests { assert!(!p_gated_filters_authorized(&[f], &agent)); } } - -fn topic_for_subscription(channel_id: Option) -> EventTopic { - match channel_id { - Some(channel_id) => EventTopic::Channel(channel_id), - None => EventTopic::Global, - } -} diff --git a/crates/buzz-relay/src/state.rs b/crates/buzz-relay/src/state.rs index bf04c52dd..08c13e843 100644 --- a/crates/buzz-relay/src/state.rs +++ b/crates/buzz-relay/src/state.rs @@ -58,7 +58,11 @@ impl ConnectionManager { } /// Registers a connection with its outbound sender, cancellation token, - /// shared backpressure counter, mutable subscription map, and grace limit. + /// server-resolved community, shared backpressure counter, mutable + /// subscription map, and grace limit. + // Each argument is a distinct per-connection attribute stored verbatim in + // `ConnEntry`; a params struct would only relocate the same fields. + #[allow(clippy::too_many_arguments)] pub fn register( &self, conn_id: Uuid, @@ -229,9 +233,11 @@ pub struct AppState { pub local_event_ids: Arc>, /// Membership cache: (community_id, channel_id, pubkey_bytes) → is_member. /// Short TTL (10s) — membership changes are rare but must propagate. + #[allow(clippy::type_complexity)] pub membership_cache: Arc), bool>>, /// Accessible channel IDs cache: (community_id, pubkey_bytes) → channel UUIDs. /// Short TTL (10s) — invalidated on membership or channel visibility changes. + #[allow(clippy::type_complexity)] pub accessible_channels_cache: Arc), Vec>>, /// Per-community channel visibility string, used to gate the private-channel fan-out /// access check so open channels stay zero-cost. Invalidated on a flip. diff --git a/crates/buzz-relay/src/tenant.rs b/crates/buzz-relay/src/tenant.rs index ed150a951..a3c195685 100644 --- a/crates/buzz-relay/src/tenant.rs +++ b/crates/buzz-relay/src/tenant.rs @@ -285,7 +285,7 @@ mod tests { /// Delete this `#[ignore]` when the fix lands; verified RED with /// `cargo test -p buzz-relay --include-ignored /// tenant::tests::redteam_attack2::empty_raw_host_fails_closed_even_if_db_has_empty_host_row` - + #[tokio::test] async fn empty_raw_host_fails_closed_even_if_db_has_empty_host_row() { // Simulate operator misconfig / buggy migration: an empty-host row @@ -311,7 +311,7 @@ mod tests { /// so this is the same fence collapse via a different raw input. /// /// Delete `#[ignore]` when the fix lands. - + #[tokio::test] async fn whitespace_only_raw_host_fails_closed_even_if_db_has_empty_host_row() { let r = resolver_with("", 0xdeadbeef); @@ -338,5 +338,4 @@ mod tests { assert!(matches!(err, BindError::UnmappedHost)); } } - }