feat(halacha): #84.7 — queue throughput + quality metrics
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 5s
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 5s
הרחבת metrics.halacha_backlog (G2 — אותה פונקציה, אין מסלול-מטריקות מקביל; כבר מוגשת דרך /api/system/diagnostics) במדדי-תור שחסרו: - throughput_24h / throughput_7d — קצב-ההחלטות (reviewed_at בחלון). - approve/reject/defer ratios (קודם רק approve). - median_seconds_per_decision — זמן-חציוני-לפריט, מחושב רק על פערים [1ש',30דק'] כדי לבטא קצב-אנושי אינטראקטיבי (פער-0 של batch panel/auto מוחרג, וגם פערים >30דק' בין sessions). 41.4s בייצור; None כשהתור כולו batch. - by_reviewer — פילוח panel/auto/chair/other (מי החליט). spot-check post-hoc כבר מכוסה ע"י halacha_panel_audit.py (re-judge של מאושרי-פאנל). _median חולץ כ-helper טהור ובדיק. invariants: G2 (הרחבת מטריקה קיימת) · INV-QA1/G10 (נראות שער-האנוש — גם מהירות וגם איכות). tests: 4 offline (_median) + אומת חי על ה-DB (476 pending, throughput 115/956, median 41.4s). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
24
mcp-server/tests/test_metrics_median.py
Normal file
24
mcp-server/tests/test_metrics_median.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""Test for #84.7 — _median helper used by the queue-metrics time-per-item proxy."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from legal_mcp.services import metrics
|
||||
|
||||
|
||||
def test_median_empty_is_none():
|
||||
assert metrics._median([]) is None
|
||||
assert metrics._median([None, None]) is None
|
||||
|
||||
|
||||
def test_median_odd():
|
||||
assert metrics._median([3.0, 1.0, 2.0]) == 2.0
|
||||
|
||||
|
||||
def test_median_even_averages_middle():
|
||||
assert metrics._median([4.0, 1.0, 3.0, 2.0]) == pytest.approx(2.5)
|
||||
|
||||
|
||||
def test_median_ignores_none():
|
||||
assert metrics._median([None, 5.0, None, 1.0, 3.0]) == 3.0
|
||||
Reference in New Issue
Block a user