mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
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>
This commit is contained in:
co-authored by
Tyler Longwell
parent
5f03ea42c3
commit
7f191ccb1e
@@ -993,6 +993,13 @@ pub(crate) fn author_only_filters_authorized(filters: &[Filter], authed_pubkey_h
|
||||
})
|
||||
}
|
||||
|
||||
fn topic_for_subscription(channel_id: Option<uuid::Uuid>) -> 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<uuid::Uuid>) -> EventTopic {
|
||||
match channel_id {
|
||||
Some(channel_id) => EventTopic::Channel(channel_id),
|
||||
None => EventTopic::Global,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<moka::sync::Cache<[u8; 32], ()>>,
|
||||
/// 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<moka::sync::Cache<(CommunityId, Uuid, Vec<u8>), 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<moka::sync::Cache<(CommunityId, Vec<u8>), Vec<Uuid>>>,
|
||||
/// 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.
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user