# O(1) Quality Gate Metric Thresholds for Pacha
# Spec: Phase 2 O(1) Quality Gates with hash-based caching
# Pattern: Toyota Way - Jidoka (MEAN mode: warnings = errors)

[thresholds]
# Hard limits (block commits) - based on Pacha's Makefile tier targets
lint_max_ms = 30_000              # 30s (Tier 1 target: sub-second lint)
lint_full_max_ms = 60_000         # 60s (Tier 2 target: full clippy)
test_tier1_max_ms = 5_000         # 5s (Tier 1 target: fast unit tests)
test_tier2_max_ms = 120_000       # 2min (Tier 2 target: standard tests)
coverage_max_ms = 300_000         # 5min (coverage analysis)
bench_max_ms = 300_000            # 5min (benchmarks)
binary_max_bytes = 10_000_000     # 10MB (CLI binary)

# Soft limits (warnings only)
build_release_max_ms = 180_000    # 3min (typical Rust build time)
mutation_test_max_ms = 3_600_000  # 60min (Tier 3 mutation testing)

[staleness]
# Metrics older than this trigger warnings
max_age_days = 7

[enforcement]
# Pre-commit behavior (MEAN mode = strict)
fail_on_stale_metrics = false     # Warn, don't block
fail_on_missing_metrics = false   # Allow commits if no cache
fail_on_threshold_violation = true # Block commits on violations (MEAN mode)

[trend_analysis]
# Track metrics for Kaizen (continuous improvement)
enabled = true
retention_days = 90
alert_on_regression = true
regression_threshold_pct = 10.0   # Alert if >10% slower

[quality_gates]
# EXTREME TDD targets (95% minimum per CLAUDE.md)
min_coverage_pct = 95.0           # Target: ≥95% line coverage
min_mutation_score_pct = 80.0     # Target: ≥80% mutation score
max_cyclomatic_complexity = 15    # Target: ≤15 per function
min_tdg_grade = "B"               # Target: B or better
max_unsafe_blocks = 0             # Pacha has no unsafe code
max_unwrap_calls = 20             # Minimal unwrap usage
