All Phase 1 components exceed 90% line coverage: - router.rs: 96.20% - topology.rs: 100% - scatter.rs: 100% - merger.rs: 94.67% All 169 tests pass. DoD requirements met. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2.8 KiB
2.8 KiB
Phase 1 — Core Routing: Verification Summary
Status: COMPLETE ✓
All Definition of Done requirements verified.
DoD Checklist
- Rendezvous assignment is deterministic given fixed node list (verified by
test_rendezvous_determinismandacceptance_determinism_1000_runs) - Adding a 4th node in a 3-node group moves at most ~2 × (1/4) of shards (verified by
acceptance_reshuffle_bound_on_add) - 64 shards / 3 nodes / RF=1 → each node holds 15–27 shards (verified by
test_shard_distribution_64_3_rf1) - Top-RF placement changes minimally on add / remove (verified by
acceptance_rf2_placement_stabilityandacceptance_reshuffle_bound_on_remove) write_targetsreturns exactlyRG × RFnodes, one from each group (verified bytest_write_targets_count)query_group(seq, RG)distributes evenly (verified bytest_query_group_distribution)covering_setwithin a group returns exactly one node per shard (verified bytest_covering_set_one_per_shard)mergerpasses the merge/facet/limit tests (verified by 25+ merger tests)- 92 tests for router/topology/scatter/merger modules
- All 169 miroir-core tests pass
Implementation Summary
router.rs
score(shard_id, node_id)— Rendezvous hash using XxHash64 with seed 0assign_shard_in_group()— Deterministic assignment with tie-breakingwrite_targets()— Returns RG × RF nodes for writesquery_group()— Round-robin group selectioncovering_set()— One node per shard with replica rotationshard_for_key()— Key-based shard routing
topology.rs
Topologystruct with groups, nodes, RF, shardsNodehealth state machine (Healthy/Active/Degraded/Joining/Draining/Failed/Removed)Groupwith healthy node filtering- Write eligibility rules per node status
scatter.rs
Scattertrait for fan-out orchestrationStubScatterfor Phase 1 (wired in Phase 2)- Request/response types for scatter operations
merger.rs
- Global sort by
_rankingScoredescending - Offset/limit applied after merge
- BTreeMap for deterministic facet serialization
_rankingScoreand_miroir_*field strippingestimatedTotalHitssummation- Binary heap optimization for large result sets
Test Coverage (2025-05-09 Verification)
All 169 tests pass in 99.32s.
Code Coverage (cargo-llvm-cov)
- router.rs: 96.20% lines, 97.44% regions, 98.33% functions
- topology.rs: 100% lines, 100% regions, 100% functions
- scatter.rs: 100% lines, 100% regions, 100% functions
- merger.rs: 94.67% lines, 96.83% regions, 91.84% functions
All Phase 1 components exceed 90% line coverage requirement.
Overall miroir-core
- 88.46% lines (includes future phase modules: hedging.rs 0%, replica_selection.rs 0%, query_planner.rs 65.82%, migration.rs 77.73%)
- Phase 1 components only: ≥94.67% lines