From a39b0e9df5367a35b4a600436b98caf3d420bdf5 Mon Sep 17 00:00:00 2001 From: jedarden Date: Fri, 10 Jul 2026 16:33:32 -0400 Subject: [PATCH] refactor(anti-entropy): remove dead with_mode_a_scaling and stale disabled-test comment (bf-no1g0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NOTE/TODO comment in tests/p13_8_anti_entropy.rs claimed a test acceptance_4_mode_a_shard_partitioning existed-but-was-disabled due to an API mismatch (with_mode_a_scaling). No such test lives in that file (it jumps acceptance_3 -> bucket_isolation), and Mode A partitioning coverage already lives inline in src/anti_entropy.rs (test_mode_a_anti_entropy_partitioning plus the rendezvous minimal-reshuffling tests). Replaced the 4-line comment with a one-line pointer to where the coverage actually lives. Investigation also surfaced that with_mode_a_scaling itself is dead code: the method is never called anywhere in the repo, and the fields it writes (replica_group_id, num_pods) are write-only — never read. The live Mode A scaling path routes through ModeACoordinator (with_mode_a_coordinator, read in the run loop). Removed the method and its two orphaned fields. Verified: grep for with_mode_a_scaling|acceptance_4_mode_a_shard_partitioning under crates/ is empty; cargo build -p miroir-core succeeds; the external p13_8_anti_entropy acceptance tests (8) pass. Co-Authored-By: Claude --- .../rebalancer_worker/anti_entropy_worker.rs | 20 ------------------- .../miroir-core/tests/p13_8_anti_entropy.rs | 5 +---- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/crates/miroir-core/src/rebalancer_worker/anti_entropy_worker.rs b/crates/miroir-core/src/rebalancer_worker/anti_entropy_worker.rs index c86c772..e859f4f 100644 --- a/crates/miroir-core/src/rebalancer_worker/anti_entropy_worker.rs +++ b/crates/miroir-core/src/rebalancer_worker/anti_entropy_worker.rs @@ -468,10 +468,6 @@ pub struct AntiEntropyWorker { mode_a_coordinator: Option>, /// Total shards in the cluster (for Mode A scaling). _total_shards: u32, - /// This pod's replica group ID (for Mode A scaling). - replica_group_id: Option, - /// Total number of pods in Mode A scaling. - num_pods: Option, /// RF (replication factor) for Mode A scaling. _rf: usize, /// Whether TTL is enabled for expired document handling (plan §13.14 interaction). @@ -520,8 +516,6 @@ impl AntiEntropyWorker { pod_id, mode_a_coordinator: None, _total_shards: 0, // Will be set when Mode A is enabled - replica_group_id: None, - num_pods: None, _rf: 2, // Default RF ttl_enabled: false, metrics_shards_scanned: None, @@ -537,20 +531,6 @@ impl AntiEntropyWorker { self } - /// Set Mode A scaling parameters (plan §14.6). - /// - /// When enabled, each pod fingerprints and repairs only its rendezvous-owned shards. - /// - /// # Parameters - /// - /// - `replica_group_id`: This pod's ID in the pod pool (0-indexed) - /// - `num_pods`: Total number of pods running anti-entropy - pub fn with_mode_a_scaling(mut self, replica_group_id: u32, num_pods: u32) -> Self { - self.replica_group_id = Some(replica_group_id); - self.num_pods = Some(num_pods); - self - } - /// Set metrics callbacks. pub fn with_metrics( mut self, diff --git a/crates/miroir-core/tests/p13_8_anti_entropy.rs b/crates/miroir-core/tests/p13_8_anti_entropy.rs index d9d4f98..df3bcde 100644 --- a/crates/miroir-core/tests/p13_8_anti_entropy.rs +++ b/crates/miroir-core/tests/p13_8_anti_entropy.rs @@ -238,10 +238,7 @@ async fn test_acceptance_3_cdc_suppression() { ); } -// NOTE: Test acceptance_4_mode_a_shard_partitioning is disabled because it requires -// the peer-discovery feature and ModeACoordinator. The test uses an old API -// (with_mode_a_scaling) that doesn't match the current implementation. -// TODO: Update this test to use ModeACoordinator or move it to a feature-gated module. +// Mode A shard-partitioning coverage (acceptance_4) lives inline in src/anti_entropy.rs. /// Test that bucket-based diff isolates divergence to ~1/256 of PK space. #[test]