172 lines
6.3 KiB
JavaScript
172 lines
6.3 KiB
JavaScript
import assert from "node:assert/strict";
|
||
import { readFile } from "node:fs/promises";
|
||
import test, { after, before } from "node:test";
|
||
import { createServer } from "vite";
|
||
|
||
let server;
|
||
let fetchE46HFullRectifiedFrontReplay;
|
||
|
||
before(async () => {
|
||
server = await createServer({
|
||
server: { middlewareMode: true },
|
||
appType: "custom",
|
||
logLevel: "silent",
|
||
});
|
||
({ fetchE46HFullRectifiedFrontReplay } = await server.ssrLoadModule(
|
||
"/src/core/laboratory/e46hFullRectifiedFrontReplay.ts",
|
||
));
|
||
});
|
||
|
||
after(async () => {
|
||
await server?.close();
|
||
});
|
||
|
||
test("E46H binds the full FRONT video to five semantic failures without promotion", async () => {
|
||
const resultId = `e46h-full-rectified-front-replay-${"a".repeat(64)}`;
|
||
const identity = "b".repeat(64);
|
||
const reviewWindows = [
|
||
["wall", 6, 10.9, 6, "semantic-false-positive"],
|
||
["shrub", 178.6, 180.3, 371, "semantic-false-positive"],
|
||
["ground", 250.7, 265.6, 481, "semantic-false-positive"],
|
||
["road", 392.2, 400.6, 822, "semantic-false-positive"],
|
||
["empty", 419.4, 426.9, null, "empty-scene-expected"],
|
||
["terrace", 440.8, 448.4, 927, "semantic-false-positive"],
|
||
].map(([id, start, end, track, verdict]) => ({
|
||
id,
|
||
label: `${start}–${end}`,
|
||
start_seconds: start,
|
||
end_seconds: end,
|
||
source_track_id: track,
|
||
verdict,
|
||
}));
|
||
const payload = {
|
||
schema_version: "missioncore.e46h-full-rectified-front-replay-catalog/v1",
|
||
items: [{
|
||
schema_version: "missioncore.e46h-full-rectified-front-replay-view/v1",
|
||
result_id: resultId,
|
||
created_at_utc: "2026-08-04T14:17:42.899Z",
|
||
source_session_id: "20260720T065719Z_viewer_live",
|
||
camera_source_id: "sensor.camera.right",
|
||
status: "diagnostic-regression-large-semantic-false-tracks",
|
||
baseline_result_id: `e46g-rectified-detector-bakeoff-${"c".repeat(64)}`,
|
||
selection: {
|
||
first_source_frame_index: 0,
|
||
last_source_frame_index: 4487,
|
||
frame_count: 4488,
|
||
excluded_source_tail_frame_count: 1,
|
||
},
|
||
rectification: {
|
||
provider: "NVIDIA Gst-nvdewarper",
|
||
provider_version: "DeepStream 9.1",
|
||
projection: "fisheye-to-perspective",
|
||
view: "front",
|
||
output_resolution: [960, 544],
|
||
horizontal_fov_degrees: 100,
|
||
},
|
||
metrics: {
|
||
frame_count: 4488,
|
||
route_duration_seconds: 453.566029,
|
||
detection_observation_count: 26782,
|
||
track_observation_count: 30634,
|
||
unique_track_count: 942,
|
||
mean_tracked_objects_per_frame: 6.825758,
|
||
zero_detection_frame_count: 46,
|
||
zero_track_frame_count: 70,
|
||
tracker_recovered_frame_count: 2,
|
||
full_layer_blackout_event_count: 2,
|
||
route_id_gap_event_count: 0,
|
||
short_track_count: 91,
|
||
short_track_fraction: 0.096603,
|
||
track_class_switch_count: 0,
|
||
large_track_observation_count: 278,
|
||
large_track_fraction: 0.009075,
|
||
},
|
||
acceptance: {
|
||
exact_recorded_right_source_bound: true,
|
||
factory_calibration_bound: true,
|
||
official_nvidia_dewarper_executed: true,
|
||
selected_stock_detector_tracker_executed: true,
|
||
retained_route_accounted: true,
|
||
terminal_source_frame_excluded: true,
|
||
full_visual_review_completed: false,
|
||
independent_truth_available: false,
|
||
candidate_accepted: false,
|
||
navigation_or_safety_accepted: false,
|
||
},
|
||
decision: {
|
||
selected_provider: "front-trafficcamnet-stock-nvdcf",
|
||
custom_detector_or_tracker_logic_used: false,
|
||
provider_promoted: false,
|
||
next_action: "compare another ready provider",
|
||
},
|
||
method: {
|
||
schema_version: "missioncore.laboratory-method/v1",
|
||
completeness: "complete",
|
||
execution_class: "hybrid",
|
||
pipeline_id: "e46h-right-kb4-front-trafficcamnet-full-replay/v1",
|
||
components: [{
|
||
kind: "model",
|
||
name: "NVIDIA TrafficCamNet",
|
||
version: "2.0",
|
||
role: "ready detector",
|
||
identity_sha256: identity,
|
||
}],
|
||
},
|
||
limitations: ["not truth"],
|
||
visual_review: {
|
||
status: "full-continuous-and-targeted-review-completed",
|
||
complete_video_reviewed: true,
|
||
reviewed_video_range_seconds: [0, 448.8],
|
||
verdict: "useful-front-continuity-but-semantic-regression-blocks-promotion",
|
||
review_windows: reviewWindows,
|
||
finding: "five large false semantic tracks",
|
||
blackout_interpretation: "empty scene",
|
||
next_action: "compare another ready provider",
|
||
},
|
||
video: {
|
||
url: `/api/v1/laboratory/e46h/results/${resultId}/overlay.mp4`,
|
||
media_type: "video/mp4",
|
||
byte_length: 336027470,
|
||
sha256: identity,
|
||
width: 960,
|
||
height: 544,
|
||
duration_seconds: 448.8,
|
||
},
|
||
ground_truth: false,
|
||
authority: {
|
||
ground_truth: false,
|
||
independent_truth: false,
|
||
candidate_accepted: false,
|
||
commands_enabled: false,
|
||
navigation_or_safety_accepted: false,
|
||
},
|
||
}],
|
||
};
|
||
const result = await fetchE46HFullRectifiedFrontReplay({
|
||
fetcher: async () => new Response(JSON.stringify(payload), {
|
||
status: 200,
|
||
headers: { "Content-Type": "application/json" },
|
||
}),
|
||
});
|
||
assert.equal(result.metrics.frameCount, 4488);
|
||
assert.equal(result.visualReview.reviewWindows.length, 6);
|
||
assert.equal(result.visualReview.reviewWindows.filter(({ verdict }) => verdict === "semantic-false-positive").length, 5);
|
||
assert.equal(result.acceptance.candidateAccepted, false);
|
||
assert.equal(result.decision.providerPromoted, false);
|
||
assert.doesNotMatch(JSON.stringify(result), /Users|D:\\|runtime\/experiments/);
|
||
});
|
||
|
||
test("E46H uses the fixed LAB anatomy and a seekable full video navigator", async () => {
|
||
const [resultView, visual] = await Promise.all([
|
||
readFile(new URL("../src/workspaces/laboratory/E46HFullRectifiedFrontReplayResult.tsx", import.meta.url), "utf8"),
|
||
readFile(new URL("../src/workspaces/laboratory/E46HFullRectifiedFrontReplayVisual.tsx", import.meta.url), "utf8"),
|
||
]);
|
||
assert.match(resultView, /LaboratorySummary/);
|
||
assert.match(resultView, /LaboratoryEvidence/);
|
||
assert.match(resultView, /LaboratoryResultSummary/);
|
||
assert.match(resultView, /448,8/);
|
||
assert.match(visual, /LaboratoryEvidenceViewer/);
|
||
assert.match(visual, /reviewWindows/);
|
||
assert.match(visual, /<video/);
|
||
});
|