feat(P02): complete integration + tech-debt + NFR measurement phase — v0.1.12 tagged
Phase 2 (Integration + Tech-Debt + NFR Measurement) complete. 4 slices, 2 waves, 9 tasks. 4 REQs covered. 60 new tests (469 total). 8 v0.4 P1+ tech-debt findings addressed. Verify: APPROVE_WITH_NOTES. NFR measurement (p95 latency + guardrail FP/FN), cohort aggregation assist metrics (5 new metrics, no schema change), assist cost tracking + C-3 budget check, tech-debt wave (argon2id offload, cookie-secret validation, credential enum, f-string SQL, cache persistence, zoneinfo, audit log, 429 mock). ---ci--- project: praxis phase: 2 milestone: v0.5 status: complete requirements: covered: [REQ-NFR-ASSIST-01, REQ-IDEATE-04, REQ-IDEATE-06, REQ-IDEATE-07] partial: [] ---/ci---
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
"""GET /api/operator/failure-patterns — failure patterns view (TASK-08-03, D-053).
|
||||
"""GET /api/operator/failure-patterns — failure patterns + safety signals (TASK-08-03, TASK-10-02, D-053).
|
||||
|
||||
Auth-gated. Returns failure pattern metrics: failure_mode frequency (cells
|
||||
with metric prefix `failure_mode:`) + branch outcome distribution (cells
|
||||
with metric prefix `branch:`). Weak-spot rubric criteria (mean < 3.0) are
|
||||
highlighted by the frontend. All k-anonymized.
|
||||
with metric prefix `branch:`) + the assist guardrail block rate safety signal
|
||||
(TASK-10-02 — `assist_guardrail_block_rate`). Weak-spot rubric criteria
|
||||
(mean < 3.0) are highlighted by the frontend. All k-anonymized.
|
||||
|
||||
The `assist_guardrail_block_rate` is a safety signal for operators: a sudden
|
||||
spike signals either a prompt regression or learners pushing boundaries. High
|
||||
block rate = flag for operator review.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -23,9 +28,17 @@ from server.operator._common import (
|
||||
|
||||
router = APIRouter(prefix="/api/operator", tags=["operator-failure-patterns"])
|
||||
|
||||
# The assist guardrail block-rate safety signal (TASK-10-02, D-060 layer 3).
|
||||
ASSIST_GUARDRAIL_BLOCK_RATE = "assist_guardrail_block_rate"
|
||||
|
||||
|
||||
def _is_failure_metric(metric: str) -> bool:
|
||||
return metric.startswith("failure_mode:") or metric.startswith("branch:")
|
||||
# Failure patterns (v0.4) + the assist guardrail block-rate safety signal (v0.5).
|
||||
return (
|
||||
metric.startswith("failure_mode:")
|
||||
or metric.startswith("branch:")
|
||||
or metric == ASSIST_GUARDRAIL_BLOCK_RATE
|
||||
)
|
||||
|
||||
|
||||
@router.get("/failure-patterns", response_model=ViewResponse)
|
||||
|
||||
Reference in New Issue
Block a user