fix(polygon): unify dataset review workflow

This commit is contained in:
DCCONSTRUCTIONS
2026-07-25 19:54:22 +03:00
parent e97573e221
commit 13c35ff446
15 changed files with 568 additions and 509 deletions
@@ -12,6 +12,7 @@ let fetchGroundQualification;
let GroundQualificationContractError;
let parseGooseFrameId;
let groupGooseReviewFrames;
let analyzeGooseDatasetSequence;
const aggregate = {
micro: {
@@ -81,6 +82,7 @@ before(async () => {
parseGooseFrameId,
} = await server.ssrLoadModule("/src/core/polygon/groundQualification.ts"));
({
analyzeGooseDatasetSequence,
groupGooseReviewFrames,
} = await server.ssrLoadModule("/src/workspaces/GooseDatasetReview.tsx"));
});
@@ -230,6 +232,70 @@ test("keeps independent GOOSE recordings in separate playback sequences", () =>
assert.ok(groups[0].durationSeconds > 1.6);
});
test("summarizes only the selected dataset fragment", () => {
const frames = [
{
sequence: 0,
frameId: "2022-07-22_flight__0071_1658494234334310308",
datasetSequenceId: "2022-07-22_flight",
datasetFrameNumber: 71,
sensorTimestampNs: "1658494234334310308",
sourcePointCount: 100_000,
pointCount: 12_000,
current: {
groundIou: 0.4,
naturalGroundRecall: 0.5,
obstacleNonGroundRecall: 0.9,
latencyMs: 100,
},
patchwork: {
groundIou: 0.6,
naturalGroundRecall: 0.7,
obstacleNonGroundRecall: 0.95,
latencyMs: 20,
},
groundIouDelta: 0.2,
},
{
sequence: 1,
frameId: "2022-07-22_flight__0072_1658494244334310308",
datasetSequenceId: "2022-07-22_flight",
datasetFrameNumber: 72,
sensorTimestampNs: "1658494244334310308",
sourcePointCount: 100_000,
pointCount: 12_000,
current: {
groundIou: 0.7,
naturalGroundRecall: 0.8,
obstacleNonGroundRecall: 0.94,
latencyMs: 100,
},
patchwork: {
groundIou: 0.6,
naturalGroundRecall: 0.75,
obstacleNonGroundRecall: 0.93,
latencyMs: 20,
},
groundIouDelta: -0.1,
},
];
const analysis = analyzeGooseDatasetSequence({
datasetSequenceId: "2022-07-22_flight",
frames,
durationSeconds: 10,
minimumGapSeconds: 10,
maximumGapSeconds: 10,
});
assert.equal(analysis.groundIou.current, 0.55);
assert.equal(analysis.groundIou.patchwork, 0.6);
assert.ok(Math.abs(analysis.groundIou.delta - 0.05) < 1e-12);
assert.equal(analysis.patchworkBetterFrames, 1);
assert.equal(analysis.currentBetterFrames, 1);
assert.equal(analysis.worstRegressionFrame.datasetFrameNumber, 72);
assert.equal(analysis.largestGapFrame.datasetFrameNumber, 72);
assert.equal(analysis.largestGapSeconds, 10);
});
test("decodes a point-aligned review frame with intensity", () => {
const decoded = decodeGroundReviewFrame({
schema_version: "missioncore.polygon-ground-review-frame/v1",
@@ -290,7 +290,7 @@ function commandAcceptance(overrides = {}) {
};
}
test("Polygon stays visible while worker capability gates live actions", () => {
test("Polygon exposes one dataset surface and keeps legacy links compatible", () => {
assert.deepEqual(resolvePolygonRunRoute("?workspace=polygon-run"), {
active: true,
runId: null,
@@ -304,18 +304,27 @@ test("Polygon stays visible while worker capability gates live actions", () => {
error: null,
},
);
assert.deepEqual(resolvePolygonRunRoute("?workspace=polygon-datasets"), {
active: true,
runId: null,
error: null,
});
assert.equal(resolvePolygonRunRoute("?workspace=missions").active, false);
assert.match(
resolvePolygonRunRoute("?workspace=polygon-run&run=../../etc").error,
/некорректный/,
);
assert.equal(workspaceById("polygon-run").root, "polygon");
assert.equal(workspaceById("polygon-run"), null);
assert.equal(
workspacesForRoot("polygon").some(({ id }) => id === "polygon-run"),
true,
false,
);
assert.equal(workspaceById("polygon-datasets").root, "polygon");
assert.equal(workspaceById("polygon-datasets").kind, "polygon-datasets");
assert.deepEqual(
workspacesForRoot("polygon").map(({ id }) => id),
["polygon-datasets"],
);
assert.equal(
workspacesForRoot("system").some(({ id }) => id === "polygon-run"),
false,