diff --git a/crates/miroir-core/src/anti_entropy.rs b/crates/miroir-core/src/anti_entropy.rs index a22f27f..f74a586 100644 --- a/crates/miroir-core/src/anti_entropy.rs +++ b/crates/miroir-core/src/anti_entropy.rs @@ -1691,9 +1691,15 @@ mod tests_mode_a_acceptance { "pod-2".to_string(), "pod-3".to_string(), ]); - coordinator_1.set_peer_set_for_test(peer_set_3pods.clone()).await; - coordinator_2.set_peer_set_for_test(peer_set_3pods.clone()).await; - coordinator_3.set_peer_set_for_test(peer_set_3pods.clone()).await; + coordinator_1 + .set_peer_set_for_test(peer_set_3pods.clone()) + .await; + coordinator_2 + .set_peer_set_for_test(peer_set_3pods.clone()) + .await; + coordinator_3 + .set_peer_set_for_test(peer_set_3pods.clone()) + .await; // Track which shards pod-3 owns initially let mut pod3_owned_initial = Vec::new(); @@ -1707,8 +1713,12 @@ mod tests_mode_a_acceptance { // Pod-3 dies: remove it from the peer set let peer_set_2pods = crate::peer_discovery::PeerSet::new(vec!["pod-1".to_string(), "pod-2".to_string()]); - coordinator_1.set_peer_set_for_test(peer_set_2pods.clone()).await; - coordinator_2.set_peer_set_for_test(peer_set_2pods.clone()).await; + coordinator_1 + .set_peer_set_for_test(peer_set_2pods.clone()) + .await; + coordinator_2 + .set_peer_set_for_test(peer_set_2pods.clone()) + .await; // Verify that all shards previously owned by pod-3 are now owned by pod-1 or pod-2 for shard_id in &pod3_owned_initial { diff --git a/crates/miroir-core/src/rebalancer_worker/mod.rs b/crates/miroir-core/src/rebalancer_worker/mod.rs index 106a024..3ca5e37 100644 --- a/crates/miroir-core/src/rebalancer_worker/mod.rs +++ b/crates/miroir-core/src/rebalancer_worker/mod.rs @@ -18,7 +18,7 @@ mod acceptance_tests; mod settings_broadcast_acceptance_tests; pub use anti_entropy_worker::{AntiEntropyWorker, AntiEntropyWorkerConfig}; -pub use drift_reconciler::{DriftRepairCallback, DriftReconciler, DriftReconcilerConfig}; +pub use drift_reconciler::{DriftReconciler, DriftReconcilerConfig, DriftRepairCallback}; use crate::migration::{MigrationCoordinator, MigrationId, MigrationNodeId, ShardId}; use crate::rebalancer::{MigrationExecutor, Rebalancer, RebalancerMetrics}; diff --git a/crates/miroir-core/tests/chaos.rs b/crates/miroir-core/tests/chaos.rs index 28c1aea..09f878e 100644 --- a/crates/miroir-core/tests/chaos.rs +++ b/crates/miroir-core/tests/chaos.rs @@ -311,7 +311,10 @@ impl TestCluster { } /// Wait for a Meilisearch node to be healthy. - async fn wait_for_meili_healthy(&self, node_index: usize) -> Result<(), Box> { + async fn wait_for_meili_healthy( + &self, + node_index: usize, + ) -> Result<(), Box> { let client = reqwest::Client::new(); let health_url = format!("http://localhost:{}/health", self.meili_port(node_index)); @@ -322,11 +325,7 @@ impl TestCluster { } } - Err(format!( - "Meilisearch node {} not healthy after timeout", - node_index - ) - .into()) + Err(format!("Meilisearch node {} not healthy after timeout", node_index).into()) } } diff --git a/crates/miroir-proxy/src/middleware.rs b/crates/miroir-proxy/src/middleware.rs index d410790..0108ebf 100644 --- a/crates/miroir-proxy/src/middleware.rs +++ b/crates/miroir-proxy/src/middleware.rs @@ -808,45 +808,49 @@ impl Metrics { }; // ── §13.15 Tenant affinity metrics (cardinality cap: top 100 tenants, rest bucketed) ── - let (tenant_queries_total, tenant_pinned_groups, tenant_fallback_total, tenant_session_pin_override_total) = - if config.tenant_affinity.enabled { - let q = CounterVec::new( - Opts::new( - "miroir_tenant_queries_total", - "Queries routed per tenant and group", - ), - &["tenant", "group"], - ) - .expect("create tenant_queries_total"); - let p = GaugeVec::new( - Opts::new( - "miroir_tenant_pinned_groups", - "Current pinned group per tenant", - ), - &["tenant"], - ) - .expect("create tenant_pinned_groups"); - let f = CounterVec::new( - Opts::new( - "miroir_tenant_fallback_total", - "Tenant affinity fallback invocations", - ), - &["reason"], - ) - .expect("create tenant_fallback_total"); - let o = Counter::new( - "miroir_tenant_session_pin_override_total", - "Session pin overrides tenant affinity (plan §13.15 interaction)", - ) - .expect("create tenant_session_pin_override_total"); - reg!(q); - reg!(p); - reg!(f); - reg!(o); - (Some(q), Some(p), Some(f), Some(o)) - } else { - (None, None, None, None) - }; + let ( + tenant_queries_total, + tenant_pinned_groups, + tenant_fallback_total, + tenant_session_pin_override_total, + ) = if config.tenant_affinity.enabled { + let q = CounterVec::new( + Opts::new( + "miroir_tenant_queries_total", + "Queries routed per tenant and group", + ), + &["tenant", "group"], + ) + .expect("create tenant_queries_total"); + let p = GaugeVec::new( + Opts::new( + "miroir_tenant_pinned_groups", + "Current pinned group per tenant", + ), + &["tenant"], + ) + .expect("create tenant_pinned_groups"); + let f = CounterVec::new( + Opts::new( + "miroir_tenant_fallback_total", + "Tenant affinity fallback invocations", + ), + &["reason"], + ) + .expect("create tenant_fallback_total"); + let o = Counter::new( + "miroir_tenant_session_pin_override_total", + "Session pin overrides tenant affinity (plan §13.15 interaction)", + ) + .expect("create tenant_session_pin_override_total"); + reg!(q); + reg!(p); + reg!(f); + reg!(o); + (Some(q), Some(p), Some(f), Some(o)) + } else { + (None, None, None, None) + }; // ── §13.16 Shadow traffic metrics ── let ( diff --git a/crates/miroir-proxy/src/routes/session.rs b/crates/miroir-proxy/src/routes/session.rs index a3df971..6d1911e 100644 --- a/crates/miroir-proxy/src/routes/session.rs +++ b/crates/miroir-proxy/src/routes/session.rs @@ -155,7 +155,10 @@ where ); return Err(( StatusCode::TOO_MANY_REQUESTS, - format!("Too many failed login attempts. Try again in {} seconds.", ws), + format!( + "Too many failed login attempts. Try again in {} seconds.", + ws + ), )); } else { return Err((