miroir/crates/miroir-proxy/tests
jedarden 56a9a93ac9 feat(hedging): implement tail-latency hedging for reads (§13.2, miroir-uhj.2)
Implements P5.2 hedged requests for tail-latency mitigation:

Core changes:
- Added execute_hedged_request() to scatter.rs with tokio::select! racing
  primary vs hedge requests
- Hedge triggers at p95 * multiplier (default 1.2x) with min 15ms floor
- Intra-group alternate preferred, cross-group fallback when enabled
- Max hedges per query cap prevents thundering herd
- Applied to reads only: /search, /indexes/{uid}/documents, GET /documents/{id}
- Write operations bypass hedging entirely (architectural guarantee)

Components:
- HedgingConfig already existed in config/advanced.rs (enabled by default)
- HedgingManager already existed in hedging.rs with EWMA p95 tracking
- execute_hedged_request() integrates hedging into request execution flow

Tests:
- test_hedging_disabled: verifies no hedge when disabled
- test_hedging_fires_on_slow_primary: verifies hedge fires on slow primary
- test_hedging_respects_max_budget: verifies max_hedges_per_query enforced
- test_writes_never_hedge: architectural test that writes bypass hedging
- test_hedging_intra_group_alternate: verifies intra-group replica selection
- test_hedging_cross_group_fallback: verifies cross-group fallback when enabled
- test_hedging_cross_group_disabled: verifies cross-group disabled prevents fallback
- test_hedging_p95_multiplier: verifies deadline computation
- test_hedging_min_trigger: verifies minimum trigger time enforced

Metrics will be added in proxy layer (separate change).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 07:30:16 -04:00
..
docker_compose_integration.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
error_format_parity.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
header_contract.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
integration_test.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p2_2_write_path_acceptance.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p2_5_task_reconciliation.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p2_8_middleware_acceptance_tests.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p2_phase2_dod.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p3_phase3_task_registry.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p5_5_two_phase_settings_broadcast.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p5_8_a_anti_entropy_fingerprint.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p5_8_b_anti_entropy_diff.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p5_14_ttl_automatic_expiration.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p7_1_core_metrics.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p7_5_structured_logging.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p10_5_scoped_key_rotation.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p10_admin_session_revocation.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p13_6_session_pinning.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p13_7_alias_resolution.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p13_7_full_alias_integration.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p24_index_lifecycle.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
p29_reserved_field_rejection.rs feat(multi-search): implement timeout enforcement and acceptance tests (§13.11) 2026-05-24 01:54:20 -04:00
phase2_integration_test.rs feat(hedging): implement tail-latency hedging for reads (§13.2, miroir-uhj.2) 2026-05-24 07:30:16 -04:00
README_integration.md P9.2: Integration test harness with docker-compose 2026-05-23 07:33:34 -04:00