#!/usr/bin/env bash # hotpath_warp_ab_gate.sh — relative-budget gate for the hotpath warp A/B rig # (rustfs/backlog#935 HP-14, item 4). # # The load driver scripts/run_object_batch_bench_enhanced.sh already emits a # baseline_compare.csv with delta_{reqps,latency,throughput}_pct columns but # does not itself decide pass/fail. This script applies the relative budget: # a metric that regresses past --fail-pct fails the gate, past --warn-pct # warns, otherwise passes. Because #4221 shows a deliberate 26x cost is # sometimes the correct durability fix, --allow-regression downgrades every # FAIL to an exempted WARN and records the reason instead of blocking. # # Metric direction: # reqps, throughput -> higher is better; regression is a negative delta. # latency (incl p99) -> lower is better; regression is a positive delta. # # Input CSV header (from run_object_batch_bench_enhanced.sh compare_baseline): # size,tool,concurrency,new_median_reqps,baseline_median_reqps,delta_reqps_pct, # new_median_latency_ms,baseline_median_latency_ms,delta_latency_pct, # new_median_throughput_bps,baseline_median_throughput_bps,delta_throughput_pct # # Exit code: 0 when no unexempted FAIL (PASS or WARN), 1 otherwise. set -euo pipefail FAIL_PCT=10 WARN_PCT=5 ALLOW_REGRESSION="false" REQUIRE_TAIL_ERROR="false" MARKDOWN_OUT="" EXEMPTION_REASON="deliberate correctness tradeoff" declare -a COMPARE_CSVS=() declare -a COMPARE_LABELS=() usage() { cat <<'USAGE' Usage: hotpath_warp_ab_gate.sh --compare-csv [--compare-csv ...] [options] --compare-csv baseline_compare.csv to evaluate (repeatable). --labeled-compare-csv