feat(lab): bind M4.8 regression to reference graph

This commit is contained in:
DCCONSTRUCTIONS
2026-08-25 00:07:58 +03:00
parent eb416ff80a
commit 669bb64423
3 changed files with 36 additions and 1 deletions
+14
View File
@@ -57,6 +57,7 @@ _SMALL_STATIC_RESULT_ID = re.compile(
r"^m48-small-static-passage-regression-[a-f0-9]{64}$"
)
_SMALL_STATIC_ANCHOR_ID = re.compile(r"^anchor-[a-f0-9]{24}$")
_M47_LAB_RESULT_ID = re.compile(r"^m47-reference-graph-lab-[a-f0-9]{64}$")
_FAILURE_ID = re.compile(r"^m48-failure-[a-f0-9]{64}$")
_REVIEW_SESSION_ID = re.compile(r"^m48-review-session-[a-f0-9]{64}$")
_CORRECTION_SESSION_ID = re.compile(r"^m48-correction-session-[a-f0-9]{64}$")
@@ -1478,6 +1479,17 @@ def build_m48_object_quality_router(
metrics = _object(result.report.get("metrics"), "M4.8 regression metrics")
gates = _object(result.report.get("gates"), "M4.8 regression gates")
decision = _object(result.report.get("decision"), "M4.8 regression decision")
pack_identity = _object(pack.manifest.get("identity"), "M4.8 pack identity")
pack_source = _object(pack_identity.get("source"), "M4.8 pack source")
reference_graph_lab_result_id = pack_source.get("m47_lab_result_id")
if (
not isinstance(reference_graph_lab_result_id, str)
or _M47_LAB_RESULT_ID.fullmatch(reference_graph_lab_result_id) is None
):
raise HTTPException(
status_code=409,
detail="M4.8 regression lost its canonical reference graph binding",
)
return {
"schema_version": _SMALL_STATIC_RESULT_VIEW_SCHEMA,
"result_id": result.result_id,
@@ -1486,6 +1498,7 @@ def build_m48_object_quality_router(
"run_label": result.manifest["identity"].get("run_label"),
"pipeline_id": result.manifest["identity"].get("pipeline_id"),
"experiment_id": result.manifest["identity"].get("experiment_id"),
"reference_graph_lab_result_id": reference_graph_lab_result_id,
"accepted": result.manifest.get("accepted"),
"metrics": copy.deepcopy(metrics),
"gates": copy.deepcopy(gates),
@@ -1513,6 +1526,7 @@ def build_m48_object_quality_router(
"anchor_id": row["anchor_id"],
"clip_id": row["clip_id"],
"sequence": row["sequence"],
"anchor_extent_xyxy": copy.deepcopy(row["anchor_extent_xyxy"]),
"requires_avoidance_or_clearance": row[
"requires_avoidance_or_clearance"
],