fix(lab): stabilize replay and densify LiDAR overlay

This commit is contained in:
DCCONSTRUCTIONS
2026-08-25 17:51:50 +03:00
parent 15be698097
commit b5080671c9
8 changed files with 520 additions and 52 deletions
@@ -9,6 +9,7 @@ let fetchM4ThreatReplayResult;
let fetchM4ThreatVisual;
let fetchM4ThreatTimeline;
let fetchM4ThreatTimelineChunk;
let fetchM4ThreatCameraPointOverlay;
let selectM4ThreatTimelineFrame;
let selectM4ThreatTimelineSequence;
let advanceRecordedEvidencePlayback;
@@ -30,6 +31,7 @@ before(async () => {
fetchM4ThreatVisual,
fetchM4ThreatTimeline,
fetchM4ThreatTimelineChunk,
fetchM4ThreatCameraPointOverlay,
selectM4ThreatTimelineFrame,
selectM4ThreatTimelineSequence,
} = await server.ssrLoadModule("/src/core/laboratory/m4ReplayThreat.ts"));
@@ -359,8 +361,9 @@ test("M4.8S timeline binds factory-KB4 camera points through its exact endpoint"
point_sample_limit: 4096,
maximum_source_points_per_frame: 3092,
point_delivery: "exact-current-increment",
camera_point_delivery: "factory-kb4-projected-current-increment",
camera_point_sample_limit: 4096,
camera_point_delivery: "factory-kb4-causal-registered-accumulation",
camera_point_window_seconds: 2,
camera_point_sample_limit: 20000,
world_state_delivery: "source-paced-latest-wins",
world_state_frame_count: 4481,
superseded_frame_count: 8,
@@ -385,7 +388,8 @@ test("M4.8S timeline binds factory-KB4 camera points through its exact endpoint"
},
});
assert.equal(requested, `${endpointRoot}/${replayResultId}/timeline`);
assert.equal(timeline.cameraPointDelivery, "factory-kb4-projected-current-increment");
assert.equal(timeline.cameraPointDelivery, "factory-kb4-causal-registered-accumulation");
assert.equal(timeline.cameraPointWindowSeconds, 2);
assert.equal(timeline.worldStateFrameCount, 4481);
assert.equal(timeline.supersededFrameCount, 8);
@@ -418,6 +422,35 @@ test("M4.8S timeline binds factory-KB4 camera points through its exact endpoint"
assert.equal(chunk.frames[0].terminalOutcome, "superseded");
assert.deepEqual(chunk.frames[0].cameraProjectedPointsXyd[0], [100.5, 200.25, 3.75]);
assert.equal(chunk.frames[0].cameraProjection, "factory-kb4-exact");
const overlay = await fetchM4ThreatCameraPointOverlay(replayResultId, 1, {
endpointRoot,
fetcher: async (input) => {
requested = String(input);
return new Response(JSON.stringify({
schema_version: "missioncore.m48s-camera-point-overlay/v1",
result_id: replayResultId,
sequence: 1,
source_time_ns: 35_521_857_292,
points_xyd: [[100.5, 200.25, 3.75], [101.5, 201.25, 3.8]],
source_frame_count: 11,
source_point_count: 28000,
front_point_count: 18000,
projected_point_count: 12000,
sample_count: 2,
window_seconds: 2,
projection: "factory-kb4-causal-registered-accumulation",
authority: "visual-derived",
}), { status: 200 });
},
});
assert.equal(
requested,
`${endpointRoot}/${replayResultId}/timeline/frames/1/camera-points`,
);
assert.equal(overlay.sourceFrameCount, 11);
assert.equal(overlay.sampleCount, 2);
assert.equal(overlay.projection, "factory-kb4-causal-registered-accumulation");
});
test("M4.6 local SLAM surface reprojects registered increments into the active body frame", () => {
@@ -468,9 +501,9 @@ test("M4.6 local SLAM surface reprojects registered increments into the active b
assert.deepEqual(surface.pointsBodyXyzM, [[0, 1, 0], [1, 0, 0]]);
});
test("M4.6 spatial buffering keeps previous, active and two future chunks", () => {
assert.deepEqual(m4ThreatChunkWindowStarts(48, 24, 4489), [24, 48, 72, 96]);
assert.deepEqual(m4ThreatChunkWindowStarts(0, 24, 4489), [0, 24, 48]);
test("M4.6 spatial buffering keeps the active and one future chunk", () => {
assert.deepEqual(m4ThreatChunkWindowStarts(48, 24, 4489), [48, 72]);
assert.deepEqual(m4ThreatChunkWindowStarts(0, 24, 4489), [0, 24]);
});
test("M4.6 spatial buffering drops stale in-flight windows across rapid jumps", () => {
@@ -486,8 +519,8 @@ test("M4.6 spatial buffering drops stale in-flight windows across rapid jumps",
if (!inFlight.has(start)) inFlight.set(start, controller(start));
}
}
assert.deepEqual([...inFlight.keys()], [4464, 4488]);
assert.deepEqual(aborted, [0, 24, 48, 1464, 1488, 1512, 1536]);
assert.deepEqual([...inFlight.keys()], [4488]);
assert.deepEqual(aborted, [0, 24, 1488, 1512]);
});
test("recorded evidence clock advances by selected rate and stops at the sealed end", () => {
@@ -604,6 +637,7 @@ test("M4.6 viewer keeps media and spatial panes on one playback clock", async ()
assert.match(imageScene, /<RecordedEvidencePointCloudOverlay/);
assert.match(videoScene, /<RecordedEvidencePointCloudOverlay/);
assert.match(pointOverlay, /factory-kb4-exact/);
assert.match(pointOverlay, /factory-kb4-causal-registered-accumulation/);
assert.match(metricScene, /OrbitControls/);
assert.match(visual, /LOCAL SLAM/);
assert.match(visual, /showLocalSurface/);