Skip to content

feat(M81): automatic threshold tuning from historical reports - #176

Merged
hlin99 merged 1 commit into
mainfrom
feat/m81-auto-threshold
Apr 6, 2026
Merged

hlin99 merged 1 commit into
mainfrom
feat/m81-auto-threshold

Conversation

@hlin99

@hlin99 hlin99 commented Apr 6, 2026

Copy link
Copy Markdown
Member

Summary

Add xpyd-acc auto-threshold command that analyzes historical batch reports and recommends optimal --fail-threshold and --numeric-tolerance values.

Features

  • Percentile-based recommendations (default p95, configurable via --percentile)
  • Confidence scoring: high (≥500 samples, ≥3 reports), medium, low
  • --json <path> export
  • Rich terminal output with distribution summary

Files

  • src/xpyd_acc/auto_threshold.py (new)
  • src/xpyd_acc/cli/report.py — handler
  • src/xpyd_acc/cli/parsers.py — subcommand registration
  • src/xpyd_acc/cli/__init__.py — dispatch wiring
  • tests/test_auto_threshold.py (18 tests)
  • docs/iterations/current.md — updated

Closes #175

- auto_threshold.py: analyze_thresholds(), ThresholdRecommendation, format_recommendations()
- Percentile-based fail_threshold and numeric_tolerance recommendations
- Confidence scoring based on sample size and report count
- CLI: xpyd-acc auto-threshold --reports ... --percentile ... --json ...
- 18 tests covering computation, serialization, formatting, CLI integration

Closes #175

@hlin99-Review-Bot hlin99-Review-Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved (hlin99-Review-Bot)

Idea: Valuable addition — auto-threshold tuning from historical data is a natural next step after the batch comparison and multi-dataset features. Aligns well with project goals.

Code:

  • auto_threshold.py is clean: good separation of analysis, loading, and formatting
  • Percentile computation handles edge cases (empty, single element)
  • Confidence tiers are sensible (sample count + report count)
  • load_reports() is fault-tolerant with logging — nice
  • CLI wiring follows established patterns (parsers → report → init)
  • 18 tests with good coverage (edge cases, serialization, CLI integration)
  • docs/iterations/current.md updated ✓
  • CI all green ✓

No issues found. Ship it.

@hlin99-Review-BotX hlin99-Review-BotX left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved (hlin99-Review-BotX)

Idea: Auto-threshold tuning is a natural complement to the batch comparison pipeline — lets users derive empirical thresholds instead of guessing. Good addition.

Code:

  • auto_threshold.py: clean separation of analysis, loading, formatting. _percentile() handles edge cases correctly (empty, single element). Confidence tiers are well-calibrated.
  • load_reports() is fault-tolerant with proper logging — robust for real-world use.
  • CLI wiring follows established parsers → report → __init__ pattern consistently.
  • 18 tests with solid coverage: edge cases, serialization, CLI integration.
  • docs/iterations/current.md updated ✓
  • CI all green ✓

Second approval — ship it.

@hlin99
hlin99 merged commit 9061452 into main Apr 6, 2026
5 checks passed
@hlin99
hlin99 deleted the feat/m81-auto-threshold branch April 6, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(M81): Automatic Threshold Tuning

3 participants