Phase 1 (miroir-cdo): Core Routing implementation complete
Implements deterministic, coordination-free routing primitives that
everything else depends on. Any Miroir pod can independently compute
identical write targets and covering sets given a fixed topology.
Core routing (router.rs):
- score(): Rendezvous hashing with XxHash64 seed 0 (matches Meilisearch Enterprise)
- assign_shard_in_group(): HRW assignment with tie-breaking
- write_targets(): Returns exactly RG × RF nodes, one from each group
- query_group(): Round-robin query distribution across replica groups
- covering_set(): One node per shard with intra-group replica rotation
- shard_for_key(): Hash-based document-to-shard mapping
Topology management (topology.rs):
- NodeId, NodeStatus, Node, Group, Topology structs
- Node health state machine (Healthy/Degraded/Draining/Failed/Joining/Active/Removed)
- State transition validation
- Write eligibility logic (Draining nodes conditionally eligible)
- Healthy node filtering
Scatter primitives (scatter.rs):
- Scatter trait with StubScatter implementation
- ScatterRequest, ScatterResponse, NodeResponse structs
Result merger (merger.rs):
- Global sort by _rankingScore descending
- Offset/limit application after merge
- Facet count aggregation across shards
- Estimated total hits summation
- Conditional _rankingScore stripping
- Always strips _miroir_shard
Task registry (task.rs):
- TaskRegistry trait with StubTaskRegistry implementation
- MiroirTask, TaskStatus, NodeTask, NodeTaskStatus
- TaskFilter for listing
Acceptance tests (all passing):
- AT-1: Rendezvous determinism (1000 runs)
- AT-2: Reshuffle bound on add (2 × 1/4 × 64)
- AT-3: Reshuffle bound on remove (~RF × S / Ng)
- AT-4: Uniformity (64 shards, 3 nodes, RF=1 → 18–26 per node)
- AT-5: Top-RF placement stability
- AT-6: shard_for_key fixture verification
- AT-7: Tie-breaking on node_id
- AT-8: Canonical concatenation order (shard_id, node_id)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>