Skip to content

Commit bc453f3

Browse files
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67dTyler Longwell
andcommitted
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 <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
1 parent 2738faf commit bc453f3

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

crates/buzz-relay/src/handlers/req.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,13 @@ pub(crate) fn author_only_filters_authorized(filters: &[Filter], authed_pubkey_h
993993
})
994994
}
995995

996+
fn topic_for_subscription(channel_id: Option<uuid::Uuid>) -> EventTopic {
997+
match channel_id {
998+
Some(channel_id) => EventTopic::Channel(channel_id),
999+
None => EventTopic::Global,
1000+
}
1001+
}
1002+
9961003
#[cfg(test)]
9971004
mod tests {
9981005
use super::*;
@@ -1441,10 +1448,3 @@ mod tests {
14411448
assert!(!p_gated_filters_authorized(&[f], &agent));
14421449
}
14431450
}
1444-
1445-
fn topic_for_subscription(channel_id: Option<uuid::Uuid>) -> EventTopic {
1446-
match channel_id {
1447-
Some(channel_id) => EventTopic::Channel(channel_id),
1448-
None => EventTopic::Global,
1449-
}
1450-
}

crates/buzz-relay/src/state.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ impl ConnectionManager {
5858
}
5959

6060
/// Registers a connection with its outbound sender, cancellation token,
61-
/// shared backpressure counter, mutable subscription map, and grace limit.
61+
/// server-resolved community, shared backpressure counter, mutable
62+
/// subscription map, and grace limit.
63+
// Each argument is a distinct per-connection attribute stored verbatim in
64+
// `ConnEntry`; a params struct would only relocate the same fields.
65+
#[allow(clippy::too_many_arguments)]
6266
pub fn register(
6367
&self,
6468
conn_id: Uuid,
@@ -229,9 +233,11 @@ pub struct AppState {
229233
pub local_event_ids: Arc<moka::sync::Cache<[u8; 32], ()>>,
230234
/// Membership cache: (community_id, channel_id, pubkey_bytes) → is_member.
231235
/// Short TTL (10s) — membership changes are rare but must propagate.
236+
#[allow(clippy::type_complexity)]
232237
pub membership_cache: Arc<moka::sync::Cache<(CommunityId, Uuid, Vec<u8>), bool>>,
233238
/// Accessible channel IDs cache: (community_id, pubkey_bytes) → channel UUIDs.
234239
/// Short TTL (10s) — invalidated on membership or channel visibility changes.
240+
#[allow(clippy::type_complexity)]
235241
pub accessible_channels_cache: Arc<moka::sync::Cache<(CommunityId, Vec<u8>), Vec<Uuid>>>,
236242
/// Per-community channel visibility string, used to gate the private-channel fan-out
237243
/// access check so open channels stay zero-cost. Invalidated on a flip.

crates/buzz-relay/src/tenant.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ mod tests {
285285
/// Delete this `#[ignore]` when the fix lands; verified RED with
286286
/// `cargo test -p buzz-relay --include-ignored
287287
/// tenant::tests::redteam_attack2::empty_raw_host_fails_closed_even_if_db_has_empty_host_row`
288-
288+
289289
#[tokio::test]
290290
async fn empty_raw_host_fails_closed_even_if_db_has_empty_host_row() {
291291
// Simulate operator misconfig / buggy migration: an empty-host row
@@ -311,7 +311,7 @@ mod tests {
311311
/// so this is the same fence collapse via a different raw input.
312312
///
313313
/// Delete `#[ignore]` when the fix lands.
314-
314+
315315
#[tokio::test]
316316
async fn whitespace_only_raw_host_fails_closed_even_if_db_has_empty_host_row() {
317317
let r = resolver_with("", 0xdeadbeef);
@@ -338,5 +338,4 @@ mod tests {
338338
assert!(matches!(err, BindError::UnmappedHost));
339339
}
340340
}
341-
342341
}

0 commit comments

Comments
 (0)