feat(lab): present chronological perception evidence

This commit is contained in:
DCCONSTRUCTIONS
2026-08-05 07:49:49 +03:00
parent 12c8a2d74c
commit 7a72a206f1
102 changed files with 20122 additions and 222 deletions
@@ -0,0 +1,155 @@
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 fetchE46FDashCamBakeoff;
before(async () => {
server = await createServer({
server: { middlewareMode: true },
appType: "custom",
logLevel: "silent",
});
({ fetchE46FDashCamBakeoff } = await server.ssrLoadModule(
"/src/core/laboratory/e46fDashCamBakeoff.ts",
));
});
after(async () => {
await server?.close();
});
function metrics(overrides = {}) {
return {
frame_count: 4489,
route_duration_seconds: 458.713353,
detection_observation_count: 23478,
track_observation_count: 24937,
detection_box_clipped_count: 0,
track_box_clipped_count: 1630,
unique_track_count: 545,
mean_tracked_objects_per_frame: 5.555135,
zero_detection_frame_count: 39,
zero_track_frame_count: 25,
tracker_recovered_frame_count: 29,
full_layer_blackout_event_count: 1,
route_id_gap_event_count: 0,
short_track_count: 37,
short_track_fraction: 0.06789,
track_class_switch_count: 0,
...overrides,
};
}
test("E46F preserves temporal gains but admits the semantic rejection", async () => {
const resultId = `e46f-dashcam-bakeoff-${"a".repeat(64)}`;
const baselineId = `e46e-ready-stack-${"b".repeat(64)}`;
const identity = "c".repeat(64);
const fetcher = async () => new Response(JSON.stringify({
schema_version: "missioncore.e46f-dashcam-bakeoff-catalog/v1",
items: [{
schema_version: "missioncore.e46f-dashcam-bakeoff-view/v1",
result_id: resultId,
created_at_utc: "2026-08-04T09:00:00Z",
source_session_id: "20260720T065719Z_viewer_live",
camera_source_id: "sensor.camera.right",
metrics: metrics(),
acceptance: {
full_route_accounted: true,
stock_detector_tracker_executed: true,
controlled_detector_only_change: true,
visual_overlay_available: true,
independent_truth_available: false,
navigation_or_safety_accepted: false,
},
method: {
schema_version: "missioncore.laboratory-method/v1",
completeness: "complete",
execution_class: "hybrid",
pipeline_id: "e46f-deepstream-dashcamnet-detectnet-v2-nvdcf/v1",
components: [{
kind: "model",
name: "NVIDIA DashCamNet",
version: "pruned_onnx_v1.0.4",
role: "moving-camera traffic-object detection",
identity_sha256: identity,
}],
},
limitations: ["not independent truth"],
comparison: {
controlled_change: "detector-only",
baseline_result_id: baselineId,
baseline_metrics: metrics({
unique_track_count: 909,
zero_track_frame_count: 28,
full_layer_blackout_event_count: 2,
short_track_fraction: 0.093509,
}),
delta: {
zero_track_frame_count: -3,
full_layer_blackout_event_count: -1,
unique_track_count: -364,
short_track_fraction: -0.025619,
},
large_box_visual_triage: {
area_ratio_threshold: 0.2,
candidate: {
observation_count: 2912,
frame_count: 2173,
track_id_count: 23,
class_observations: { person: 2912 },
},
baseline: {
observation_count: 191,
frame_count: 191,
track_id_count: 4,
class_observations: { car: 191 },
},
interpretation: "diagnostic visual triage; not precision/recall",
},
visual_review: {
status: "rejected-semantic-regression",
sample_video_seconds: [4.2, 9, 22, 44, 264, 418],
finding: "fisheye rim becomes huge person tracks",
next_action: "rectify valid FOV and repeat A/B",
},
verdict: "reject-dashcamnet-on-unrectified-fisheye",
},
video: {
url: `/api/v1/laboratory/e46f/results/${resultId}/overlay.mp4`,
media_type: "video/mp4",
byte_length: 150513080,
sha256: identity,
width: 800,
height: 600,
},
ground_truth: false,
}],
}), { status: 200, headers: { "Content-Type": "application/json" } });
const result = await fetchE46FDashCamBakeoff({ fetcher });
assert.equal(result.resultId, resultId);
assert.equal(result.comparison.verdict, "reject-dashcamnet-on-unrectified-fisheye");
assert.equal(result.comparison.delta.zeroTrackFrameCount, -3);
assert.equal(result.comparison.largeBoxVisualTriage.candidate.observationCount, 2912);
assert.equal(result.comparison.visualReview.status, "rejected-semantic-regression");
assert.equal(result.acceptance.navigationOrSafetyAccepted, false);
assert.equal(result.video.sha256, identity);
assert.doesNotMatch(JSON.stringify(result), /Users|D:\\|runtime\/experiments/);
});
test("E46F uses the fixed LAB anatomy and exposes the frozen full video", async () => {
const [resultView, visual] = await Promise.all([
readFile(new URL("../src/workspaces/laboratory/E46FDashCamBakeoffResult.tsx", import.meta.url), "utf8"),
readFile(new URL("../src/workspaces/laboratory/E46EReadyStackVisual.tsx", import.meta.url), "utf8"),
]);
assert.match(resultView, /LaboratorySummary/);
assert.match(resultView, /LaboratoryEvidence/);
assert.match(resultView, /LaboratoryResultSummary/);
assert.match(resultView, /semantic regression/);
assert.match(visual, /LaboratoryEvidenceViewer/);
assert.match(visual, /<video/);
assert.match(visual, /controls/);
});