miroir/crates
jedarden 3a968df6bd feat(query): implement §13.4 shard-aware query planner for PK-constrained searches
Implements P5.4 §13.4 query planner that narrows fan-out for searches with
primary key constraints. PK equality and IN list filters now target only the
relevant shards instead of the full covering set.

**Changes:**
- Add `plan_search_scatter_with_narrowing()` in scatter.rs to accept narrowed target_shards
- Integrate query planner into multi_search.rs scatter planning
- Add query planner metrics to middleware.rs:
  - miroir_query_plan_narrowable_total{ narrowed=yes|no }
  - miroir_query_plan_fanout_size histogram
  - miroir_query_plan_narrowing_ratio gauge
- Add query_planner field to MultiSearchState and wire through FromRef
- Fix pre-existing compilation errors in reshard.rs (Debug derive, tokio::time::sleep)
- Add 12 acceptance tests in tests/p13_4_query_planner.rs

**Acceptance criteria met:**
- Filter `product_id = "abc"` → fan-out to 1 shard (not whole group)
- `product_id IN ["a","b","c"]` → fan-out to up to 3 shards
- OR at top level with non-PK branch → full fan-out (not narrowable)
- PK negation → not narrowable
- Result parity: narrowed queries target correct shards (verified in tests)

Closes: miroir-uhj.4
2026-05-24 07:51:39 -04:00
..
miroir-core feat(query): implement §13.4 shard-aware query planner for PK-constrained searches 2026-05-24 07:51:39 -04:00
miroir-ctl feat(proxy): implement streaming routed dump import (P5.9, §13.9) 2026-05-24 06:07:00 -04:00
miroir-proxy feat(query): implement §13.4 shard-aware query planner for PK-constrained searches 2026-05-24 07:51:39 -04:00