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
@@ -10,6 +10,7 @@ import type {
const RESULT_ID = /^m48-small-static-passage-regression-[a-f0-9]{64}$/;
const PACK_ID = /^m48-object-quality-pack-[a-f0-9]{64}$/;
const REFERENCE_GRAPH_LAB_RESULT_ID = /^m47-reference-graph-lab-[a-f0-9]{64}$/;
const ANCHOR_ID = /^anchor-[a-f0-9]{24}$/;
const SAFE_URL = /^\/api\/v1\/laboratory\/m48\/[A-Za-z0-9/_?&=.%:-]+$/;
@@ -28,6 +29,7 @@ export interface M48SmallStaticRegressionMetrics {
export interface M48SmallStaticRegressionResult {
resultId: string;
packId: string;
referenceGraphLabResultId: string;
createdAtUtc: string;
runLabel: "M4.8R1";
pipelineId: "m48-class-free-object-quality/v1";
@@ -53,6 +55,7 @@ export interface M48SmallStaticRegressionCaseSummary {
anchorId: string;
clipId: string;
sequence: number;
anchorExtentXyxy: readonly [number, number, number, number];
requiresAvoidanceOrClearance: boolean;
workerCandidateCount: number;
bestIou: number;
@@ -198,6 +201,7 @@ function parseSummary(value: unknown): M48SmallStaticRegressionCaseSummary {
anchorId,
clipId: textValue(row.clip_id, "M4.8R1.case.clip_id"),
sequence: integerValue(row.sequence, "M4.8R1.case.sequence"),
anchorExtentXyxy: extentValue(row.anchor_extent_xyxy, "M4.8R1.case.anchor_extent_xyxy"),
requiresAvoidanceOrClearance: booleanValue(row.requires_avoidance_or_clearance, "M4.8R1.case.requires_avoidance_or_clearance"),
workerCandidateCount: integerValue(row.worker_candidate_count, "M4.8R1.case.worker_candidate_count"),
bestIou: numberValue(row.best_iou, "M4.8R1.case.best_iou"),
@@ -223,6 +227,15 @@ export async function fetchM48SmallStaticRegression(
exact(payload.schema_version, "missioncore.m48-small-static-passage-regression-result-view/v1", "M4.8R1.schema_version");
const packId = textValue(payload.pack_id, "M4.8R1.pack_id");
if (!PACK_ID.test(packId)) throw new M48SmallStaticRegressionContractError("M4.8R1.pack_id: нарушена идентичность.");
const referenceGraphLabResultId = textValue(
payload.reference_graph_lab_result_id,
"M4.8R1.reference_graph_lab_result_id",
);
if (!REFERENCE_GRAPH_LAB_RESULT_ID.test(referenceGraphLabResultId)) {
throw new M48SmallStaticRegressionContractError(
"M4.8R1.reference_graph_lab_result_id: нарушена идентичность.",
);
}
const metrics = objectValue(payload.metrics, "M4.8R1.metrics");
const gates = objectValue(payload.gates, "M4.8R1.gates");
const decision = objectValue(payload.decision, "M4.8R1.decision");
@@ -235,6 +248,7 @@ export async function fetchM48SmallStaticRegression(
return {
resultId,
packId,
referenceGraphLabResultId,
createdAtUtc: textValue(payload.created_at_utc, "M4.8R1.created_at_utc"),
runLabel: "M4.8R1",
pipelineId: "m48-class-free-object-quality/v1",