refactor(ui): reuse canonical graph for M4.8 regression

This commit is contained in:
DCCONSTRUCTIONS
2026-08-25 00:08:33 +03:00
parent 669bb64423
commit 1084984da2
9 changed files with 322 additions and 261 deletions
@@ -1,5 +1,5 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { existsSync, readFileSync } from "node:fs";
import { after, before, test } from "node:test";
import { createServer } from "vite";
@@ -10,6 +10,7 @@ let fetchM48SmallStaticRegressionCase;
const resultId = `m48-small-static-passage-regression-${"a".repeat(64)}`;
const packId = `m48-object-quality-pack-${"b".repeat(64)}`;
const referenceGraphLabResultId = `m47-reference-graph-lab-${"d".repeat(64)}`;
const anchorId = `anchor-${"c".repeat(24)}`;
const authority = {
mode: "replay-simulated",
@@ -40,6 +41,7 @@ test("M4.8R1 keeps pipeline identity and assisted evidence authority explicit",
schema_version: "missioncore.m48-small-static-passage-regression-result-view/v1",
result_id: resultId,
pack_id: packId,
reference_graph_lab_result_id: referenceGraphLabResultId,
created_at_utc: "2026-08-24T12:00:00Z",
run_label: "M4.8R1",
pipeline_id: "m48-class-free-object-quality/v1",
@@ -73,6 +75,7 @@ test("M4.8R1 keeps pipeline identity and assisted evidence authority explicit",
});
assert.equal(summary.pipelineId, "m48-class-free-object-quality/v1");
assert.equal(summary.experimentId, "m48-small-static-passage-regression/v1");
assert.equal(summary.referenceGraphLabResultId, referenceGraphLabResultId);
assert.equal(summary.metrics.workerMissedAnchorCount, 14);
assert.equal(summary.independentTruth, false);
});
@@ -86,6 +89,7 @@ test("M4.8R1 bounded case binds one exact assisted anchor and frozen objects", a
anchor_id: anchorId,
clip_id: "m48-clip-03",
sequence: 256,
anchor_extent_xyxy: [0.2, 0.3, 0.4, 0.7],
requires_avoidance_or_clearance: true,
worker_candidate_count: 1,
best_iou: 0.01,
@@ -98,6 +102,7 @@ test("M4.8R1 bounded case binds one exact assisted anchor and frozen objects", a
}),
});
assert.equal(cases[0].outcome, "missed-assisted-anchor");
assert.deepEqual(cases[0].anchorExtentXyxy, [0.2, 0.3, 0.4, 0.7]);
const item = await fetchM48SmallStaticRegressionCase(resultId, anchorId, {
fetcher: async () => response({
@@ -150,14 +155,26 @@ test("M4.8R1 bounded case binds one exact assisted anchor and frozen objects", a
assert.equal(item.groundTruth, false);
});
test("M4.8R1 visual reuses the held viewer and keeps manual boxes exact-frame only", () => {
const visual = readFileSync(
new URL("../src/workspaces/laboratory/M48SmallStaticRegressionVisual.tsx", import.meta.url),
test("M4.8R1 deletes the third viewer and projects anchors through the canonical graph", () => {
const deletedVisual = new URL(
"../src/workspaces/laboratory/M48SmallStaticRegressionVisual.tsx",
import.meta.url,
);
assert.equal(existsSync(deletedVisual), false);
const evidence = readFileSync(
new URL("../src/workspaces/laboratory/M48SmallStaticRegressionEvidence.tsx", import.meta.url),
"utf8",
);
assert.match(visual, /<LaboratoryEvidenceViewer/);
assert.match(visual, /<M48BlindClipPlayer/);
assert.match(visual, /<M48EvidenceModeRail/);
assert.match(visual, /firstSequence: sequence,[\s\S]*lastSequence: sequence/);
assert.doesNotMatch(visual, /Rerun|MediaSource|setInterval/);
const canonicalVisual = readFileSync(
new URL("../src/workspaces/laboratory/M4ReplayThreatVisual.tsx", import.meta.url),
"utf8",
);
assert.match(evidence, /fetchM47ReferenceGraphLab/);
assert.match(evidence, /<M4ReplayThreatVisual/);
assert.match(evidence, /sourceSequence: item\.sequence - 1/);
assert.doesNotMatch(evidence, /M48BlindClipPlayer|M48EvidenceModeRail|Rerun|MediaSource/);
assert.match(canonicalVisual, /reviewAnchors/);
assert.match(canonicalVisual, /РУЧНОЙ ЯКОРЬ · ПРОПУСК WORKER 006/);
assert.match(canonicalVisual, /showSpatialSemantic/);
assert.match(canonicalVisual, /showRollingMap/);
});