## Summary Verified that all Phase 1 acceptance criteria are met: ### Router Correctness (router.rs) - ✅ Rendezvous determinism across 1000 runs - ✅ Minimal reshuffling on node add/remove - ✅ Uniform distribution (64 shards, 3 nodes, RF=1 → 18–26 per node) - ✅ RF=2 placement stability - ✅ write_targets returns RG × RF nodes - ✅ query_group distributes evenly - ✅ covering_set returns one node per shard with replica rotation - ✅ shard_for_key uses seed 0 (matches Meilisearch Enterprise) ### Result Merger (merger.rs) - ✅ Global sort by _rankingScore - ✅ Offset/limit applied after merge - ✅ Conditional _rankingScore stripping - ✅ _miroir_* reserved fields always stripped - ✅ Facet counts summed across shards - ✅ estimatedTotalHits summed - ✅ processingTimeMs = max across shards ### Coverage - ✅ miroir-core: 91.80% line coverage (exceeds 90% requirement) - router.rs: 96.20% - topology.rs: 100.00% - scatter.rs: 100.00% - merger.rs: 94.67% ### Test Results All 151 tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3.7 KiB
Phase 1 (miroir-cdo): Core Routing — Final Verification Summary
Date
2026-05-09
Definition of Done Verification
All acceptance criteria from plan §8 have been verified:
Router Correctness Tests (router.rs)
-
✅ Rendezvous determinism: Same (shard_id, nodes) → identical Vec across 1000 randomized runs
- Test:
acceptance_determinism_1000_runs
- Test:
-
✅ Minimal reshuffling on add: 64 shards, 3→4 nodes → at most 2 × (1/4) × 64 edges differ
- Test:
acceptance_reshuffle_bound_on_add
- Test:
-
✅ Minimal reshuffling on remove: 64 shards, 4→3 nodes → ~RF × S / Ng edges differ
- Test:
acceptance_reshuffle_bound_on_remove
- Test:
-
✅ Uniform distribution: 64 shards, 3 nodes, RF=1 → each node holds 18–26 shards
- Test:
acceptance_uniformity_64_shards_3_nodes_rf1
- Test:
-
✅ RF=2 placement stability: Top-2 nodes change minimally on add/remove
- Test:
acceptance_rf2_placement_stability
- Test:
-
✅ write_targets returns RG × RF nodes: Exactly one node from each replica group
- Test:
test_write_targets_count
- Test:
-
✅ query_group distributes evenly: Round-robin distributes queries uniformly
- Test:
test_query_group_distribution
- Test:
-
✅ covering_set returns one node per shard: With intra-group replica rotation
- Tests:
test_covering_set_one_per_shard,test_covering_set_replica_rotation
- Tests:
-
✅ shard_for_key uses seed 0: Matches known fixture values
- Test:
acceptance_shard_for_key_fixture
- Test:
Result Merger Tests (merger.rs)
-
✅ Global sort by _rankingScore: Descending order with tie-breaking
- Test:
test_global_sort_by_ranking_score
- Test:
-
✅ Offset and limit applied after merge: Pagination works correctly
- Test:
test_offset_and_limit_applied_after_merge
- Test:
-
✅ _rankingScore stripping: Removed when not requested by client
- Tests:
test_ranking_score_stripped_when_not_requested,test_ranking_score_included_when_requested
- Tests:
-
✅ _miroir_shard always stripped: Reserved fields removed
- Test:
test_strip_all_miroir_reserved_fields
- Test:
-
✅ Facet aggregation: Counts summed across shards
- Test:
test_facet_counts_summed_across_shards
- Test:
-
✅ estimatedTotalHits summed: Across all shards
- Test:
test_estimated_total_hits_summed
- Test:
-
✅ processingTimeMs max: Slowest shard time reported
- Test:
test_processing_time_max_across_shards
- Test:
Coverage
- ✅ miroir-core ≥ 90% line coverage: 91.80% overall (via cargo-llvm-cov)
- router.rs: 96.20%
- topology.rs: 100.00%
- scatter.rs: 100.00%
- merger.rs: 94.67%
Test Results
All 151 tests pass successfully:
test result: ok. 151 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Implementation Summary
The Phase 1 core routing implementation provides:
- Rendezvous hashing (HRW) with twox-hash and seed 0 to match Meilisearch Enterprise
- Deterministic shard assignment with minimal reshuffling on topology changes
- Group-scoped assignment preventing both replicas from landing in the same group
- Write target calculation returning exactly RG × RF nodes
- Query distribution via round-robin group selection
- Covering set calculation with intra-group replica rotation
- Result merging with global sort, facet aggregation, and reserved field stripping
Critical Implementation Details
- Hash seed: Uses seed 0 (XxHash64::with_seed(0)) to match Meilisearch Enterprise
- Canonical order: (shard_id, node_id) - this ordering is critical for consistency
- Tie-breaking: Lexicographic by node_id when hash scores collide
- Group isolation: Hashing is scoped to intra-group node lists
Status
Phase 1 (miroir-cdo) Core Routing is COMPLETE and verified.