# `tests/perf/` — relative-baseline perf regression pins (PF-01..08)

> **Charter:** the home for `@pytest.mark.perf` regression pins. Each pin
> measures a hot-path metric and compares it to a **recorded baseline**
> (`baselines.json`), with a tier tag and a numeric failure message — never an
> absolute wall-clock budget (PF-01 / PAPER-50). Excluded from the default
> gate (`-m 'not perf'`); run on a tagged hardware tier.

## Files

| File | What |
|---|---|
| `test_perf_pins.py` | the per-surface pins (current_context, redaction, JsonFormatter, async emit, operation_span no-op, bootstrap) + the relative scaling/ratio invariants |
| `conftest.py` | the `bench` (measure) + `baselines` (assert/record) fixtures — the PF-01/03/04/07 harness |
| `baselines.json` | the recorded baselines (value/units/recorded_at/recorded_commit/threshold_pct/hw_tier). **Generated, never hand-edited.** |
| `hw_tiers.md` | the hardware-tier definitions (PF-08) |

## Running

```sh
pytest tests/perf -m perf -o addopts=        # run the pins against the baseline
mgf-fed bench rebaseline                  # re-record ALL baselines (PF-04)
mgf-fed bench rebaseline <metric>         # re-record one metric
```

A re-baseline is a **deliberate, separate commit** whose body explains *why*
the baseline moved (PF-04) — never folded into a feature change.
