Operator-Use
Operator-Use copied to clipboard
[Phase 0.2.2] Create performance benchmark harness
Phase
Phase 0 — Foundations | Track 0.2 — Test Infrastructure | Priority: P1
Summary
Create tests/benchmarks/ with timing fixtures and baseline recording for performance regression testing.
What
- Create
tests/benchmarks/__init__.py - Create
tests/benchmarks/conftest.pywith:benchmark_timer— context manager that records execution timebaseline_store— JSON file storing baseline measurementsregression_check— compares current vs baseline, fails if >10% regression
- Create
tests/benchmarks/baselines.jsonfor storing recorded baselines - Integrate with
pytest-benchmarkfor standardized reporting
Why
Phase 3 (Performance) requires a way to measure, record, and compare performance. Building the harness now means every optimization has proof it worked.
Acceptance Criteria
- [ ]
tests/benchmarks/directory exists with conftest - [ ]
pytest-benchmarkadded to dev dependencies - [ ] At least one example benchmark test runs and records a baseline
- [ ] Regression detection works (artificially degrade, verify it flags)
References
- pytest-benchmark
- Design Doc:
docs/plans/2026-03-29-security-ai-guardrails-performance-design.md
Blocks
All Phase 3 issues (benchmarks use this harness)