feat(ui): stabilize shared M4.8 review viewer
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { after, before, test } from "node:test";
|
||||
import { createServer } from "vite";
|
||||
|
||||
let server;
|
||||
let fetchM48SmallStaticRegression;
|
||||
let fetchM48SmallStaticRegressionCases;
|
||||
let fetchM48SmallStaticRegressionCase;
|
||||
|
||||
const resultId = `m48-small-static-passage-regression-${"a".repeat(64)}`;
|
||||
const packId = `m48-object-quality-pack-${"b".repeat(64)}`;
|
||||
const anchorId = `anchor-${"c".repeat(24)}`;
|
||||
const authority = {
|
||||
mode: "replay-simulated",
|
||||
physical_live: false,
|
||||
commands_enabled: false,
|
||||
actuation_allowed: false,
|
||||
navigation_or_safety_accepted: false,
|
||||
};
|
||||
|
||||
before(async () => {
|
||||
server = await createServer({ appType: "custom", logLevel: "silent", server: { middlewareMode: true } });
|
||||
({
|
||||
fetchM48SmallStaticRegression,
|
||||
fetchM48SmallStaticRegressionCases,
|
||||
fetchM48SmallStaticRegressionCase,
|
||||
} = await server.ssrLoadModule("/src/core/laboratory/m48SmallStaticRegression.ts"));
|
||||
});
|
||||
|
||||
after(async () => server?.close());
|
||||
|
||||
function response(value) {
|
||||
return { ok: true, status: 200, json: async () => value };
|
||||
}
|
||||
|
||||
test("M4.8R1 keeps pipeline identity and assisted evidence authority explicit", async () => {
|
||||
const summary = await fetchM48SmallStaticRegression(resultId, {
|
||||
fetcher: async () => response({
|
||||
schema_version: "missioncore.m48-small-static-passage-regression-result-view/v1",
|
||||
result_id: resultId,
|
||||
pack_id: packId,
|
||||
created_at_utc: "2026-08-24T12:00:00Z",
|
||||
run_label: "M4.8R1",
|
||||
pipeline_id: "m48-class-free-object-quality/v1",
|
||||
experiment_id: "m48-small-static-passage-regression/v1",
|
||||
accepted: false,
|
||||
metrics: {
|
||||
assisted_anchor_count: 14,
|
||||
assisted_tracklet_count: 14,
|
||||
anchor_clip_count: 8,
|
||||
requires_avoidance_or_clearance_count: 12,
|
||||
worker_recalled_anchor_count: 0,
|
||||
worker_missed_anchor_count: 14,
|
||||
assisted_anchor_recall: 0,
|
||||
extent_iou_threshold: 0.5,
|
||||
minimum_assisted_anchor_recall: 0.9,
|
||||
},
|
||||
gates: {
|
||||
anchor_set_non_empty: true,
|
||||
development_anchor_recall_target: false,
|
||||
independent_truth_available: false,
|
||||
},
|
||||
decision: {
|
||||
state: "failed-development-regression-baseline",
|
||||
summary: "Worker 006 matched 0/14.",
|
||||
next_action: "Publish another immutable run.",
|
||||
},
|
||||
ground_truth: false,
|
||||
independent_truth: false,
|
||||
authority,
|
||||
}),
|
||||
});
|
||||
assert.equal(summary.pipelineId, "m48-class-free-object-quality/v1");
|
||||
assert.equal(summary.experimentId, "m48-small-static-passage-regression/v1");
|
||||
assert.equal(summary.metrics.workerMissedAnchorCount, 14);
|
||||
assert.equal(summary.independentTruth, false);
|
||||
});
|
||||
|
||||
test("M4.8R1 bounded case binds one exact assisted anchor and frozen objects", async () => {
|
||||
const cases = await fetchM48SmallStaticRegressionCases(resultId, {
|
||||
fetcher: async () => response({
|
||||
schema_version: "missioncore.m48-small-static-passage-regression-case-catalog/v1",
|
||||
result_id: resultId,
|
||||
cases: [{
|
||||
anchor_id: anchorId,
|
||||
clip_id: "m48-clip-03",
|
||||
sequence: 256,
|
||||
requires_avoidance_or_clearance: true,
|
||||
worker_candidate_count: 1,
|
||||
best_iou: 0.01,
|
||||
matched_at_threshold: false,
|
||||
outcome: "missed-assisted-anchor",
|
||||
}],
|
||||
case_count: 1,
|
||||
ground_truth: false,
|
||||
authority,
|
||||
}),
|
||||
});
|
||||
assert.equal(cases[0].outcome, "missed-assisted-anchor");
|
||||
|
||||
const item = await fetchM48SmallStaticRegressionCase(resultId, anchorId, {
|
||||
fetcher: async () => response({
|
||||
schema_version: "missioncore.m48-small-static-passage-regression-case-view/v1",
|
||||
result_id: resultId,
|
||||
pack_id: packId,
|
||||
anchor: {
|
||||
anchor_id: anchorId,
|
||||
clip_id: "m48-clip-03",
|
||||
object_id: "object-01",
|
||||
sequence: 256,
|
||||
extent_xyxy: [0.2, 0.3, 0.4, 0.7],
|
||||
visibility: "visible",
|
||||
geometry_association: "unknown",
|
||||
freshness: "current",
|
||||
motion: "static",
|
||||
threat: "not-threat",
|
||||
requires_avoidance_or_clearance: true,
|
||||
},
|
||||
comparison: {
|
||||
anchor_id: anchorId,
|
||||
clip_id: "m48-clip-03",
|
||||
sequence: 256,
|
||||
requires_avoidance_or_clearance: true,
|
||||
worker_candidate_count: 1,
|
||||
best_iou: 0.01,
|
||||
matched_at_threshold: false,
|
||||
outcome: "missed-assisted-anchor",
|
||||
source_time_ns: 25_600_000_000,
|
||||
anchor_extent_xyxy: [0.2, 0.3, 0.4, 0.7],
|
||||
worker_objects: [{
|
||||
prediction_id: "proposal-256-0",
|
||||
extent_xyxy: [0.7, 0.2, 0.9, 0.6],
|
||||
geometry_association: "associated",
|
||||
freshness: "current",
|
||||
motion: "static",
|
||||
threat: "not-threat",
|
||||
}],
|
||||
best_prediction_id: "proposal-256-0",
|
||||
extent_iou_threshold: 0.5,
|
||||
},
|
||||
camera_url: `/api/v1/laboratory/m48/packs/${packId}/source/clips/m48-clip-03/frames/256/camera`,
|
||||
spatial_url: `/api/v1/laboratory/m48/packs/${packId}/source/clips/m48-clip-03/frames/256/spatial`,
|
||||
ground_truth: false,
|
||||
authority,
|
||||
}),
|
||||
});
|
||||
assert.equal(item.anchor.sequence, 256);
|
||||
assert.equal(item.comparison.workerObjects[0].predictionId, "proposal-256-0");
|
||||
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),
|
||||
"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/);
|
||||
});
|
||||
Reference in New Issue
Block a user