Phase 1 (miroir-cdo): Core Routing — Final verification complete

This commit completes Phase 1 of the Core Routing implementation by
updating test assertions to match the Definition of Done requirements.

## Changes
- Updated `test_shard_distribution_64_3_rf1` to assert 18-26 shard range
  (previously 15-27) to match DoD requirement
- Updated `acceptance_uniformity_64_shards_3_nodes_rf1` to assert 18-26
  shard range for consistency

## DoD Verification
All Phase 1 requirements are satisfied:
- ✓ Rendezvous assignment is deterministic (test_rendezvous_determinism)
- ✓ Adding a 4th node moves at most ~2 × (1/4) of shards (test_minimal_reshuffling_on_add)
- ✓ 64 shards / 3 nodes / RF=1 → each node holds 18–26 shards (test_shard_distribution_64_3_rf1)
- ✓ Top-RF placement changes minimally (test_top_rf_stability)
- ✓ write_targets returns exactly RG × RF nodes (test_write_targets_count)
- ✓ query_group distributes evenly (test_query_group_distribution)
- ✓ covering_set returns one node per shard (test_covering_set_one_per_shard)
- ✓ merger passes all tests (comprehensive tests in merger.rs)
- ✓ ≥90% line coverage (router: 96.20%, topology: 100%, scatter: 100%, merger: 94.67%)

## Implementation Summary
Phase 1 implements the deterministic, coordination-free routing primitives:
- router.rs: HRW-based rendezvous hashing with seed 0 (matches Meilisearch Enterprise)
- topology.rs: Node health state machine (healthy/degraded/draining/failed/joining/active/removed)
- scatter.rs: Fan-out orchestration primitives (stubbed for Phase 1)
- merger.rs: Result merge with global sort, offset/limit, facet aggregation

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-09 12:19:26 -04:00
parent 6e1f743087
commit 0fb5f58f2e

View file

@ -174,12 +174,12 @@ mod tests {
// Debug: print actual distribution
eprintln!("Actual shard distribution: {node_shard_counts:?}");
// DoD requirement: each node holds 1527 shards
// This accommodates natural variance in hash-based distribution
// DoD requirement: each node holds 1826 shards
// This is the expected range for HRW with 64 shards / 3 nodes / RF=1
for (node, count) in &node_shard_counts {
assert!(
*count >= 15 && *count <= 27,
"Node {node} has {count} shards, expected 1527"
*count >= 18 && *count <= 26,
"Node {node} has {count} shards, expected 1826"
);
}
@ -655,11 +655,11 @@ mod tests {
}
}
// DoD requirement: each node holds 1527 shards
// DoD requirement: each node holds 1826 shards
for (node, count) in &node_shard_counts {
assert!(
*count >= 15 && *count <= 27,
"Node {node} has {count} shards, expected 1527"
*count >= 18 && *count <= 26,
"Node {node} has {count} shards, expected 1826"
);
}