feat(lab): publish E31 through E33 results

This commit is contained in:
DCCONSTRUCTIONS
2026-07-27 14:42:22 +03:00
parent fa2d66ab0e
commit 2c016b117d
11 changed files with 1544 additions and 2 deletions
@@ -0,0 +1,366 @@
export interface E31LaboratoryResult {
resultId: string;
createdAtUtc: string | null;
sourceSessionId: string;
status: "accepted-diagnostic-source-profile";
eligibleForE32: true;
profileId: string;
producerSha256: string;
metrics: {
frameCount: number;
availableBindingCount: number;
availableFraction: number;
lidarCameraP95Ms: number;
posePointP95Ms: number;
selectedOffsetMs: number;
correspondenceCount: number;
supportedFraction: number;
semanticSelfSampleCount: number;
semanticSelfCollateralCount: number;
exactGeometryCorrectionCount: number;
geometryPointMaskStatus: string;
};
limitations: readonly string[];
access: "read-only";
}
export interface E32LaboratoryResult {
resultId: string;
createdAtUtc: string | null;
sourceSessionId: string;
status: "accepted-diagnostic-track-geometry-replay";
profileId: string;
producerSha256: string;
e31ResultId: string;
metrics: {
framesTotal: number;
framesSourceAvailable: number;
semanticPublished: number;
semanticMasked: number;
geometryPublished: number;
observationsArbitrated: number;
overlappingClaimsRemoved: number;
qualifiedPointsPublished: number;
qualifiedPointsWithheld: number;
frameProcessingP95Ms: number;
buildElapsedMs: number;
};
access: "read-only";
}
export interface E33LaboratoryResult {
resultId: string;
createdAtUtc: string | null;
sourceSessionId: string;
status: "accepted-recorded-source-paced-shadow";
e32ResultId: string;
pipelineId: string;
mode: string;
worker: {
node: string;
containerImage: string;
python: string;
numpy: string;
};
metrics: {
sourceFrames: number;
deliveredFrames: number;
inputSuperseded: number;
resultSuperseded: number;
effectiveDeliveryFps: number;
deadlineMissFraction: number;
processingP95Ms: number;
releaseLagP95Ms: number;
resultAgeP95Ms: number;
processRssP95Mib: number;
gpuUtilizationP95Percent: number;
gpuVisible: boolean;
workQueueCapacity: number;
resultQueueCapacity: number;
wallToIdealRatio: number;
};
access: "read-only";
}
export interface AdvancedLaboratoryResults {
e31: E31LaboratoryResult | null;
e32: E32LaboratoryResult | null;
e33: E33LaboratoryResult | null;
}
export class AdvancedLaboratoryContractError extends Error {
constructor(message: string) {
super(message);
this.name = "AdvancedLaboratoryContractError";
}
}
type LaboratoryFetch = (
input: RequestInfo | URL,
init?: RequestInit,
) => Promise<Response>;
function record(value: unknown, label: string): Record<string, unknown> {
if (!value || typeof value !== "object" || Array.isArray(value)) {
throw new AdvancedLaboratoryContractError(`${label}: ожидался объект.`);
}
return value as Record<string, unknown>;
}
function stringValue(value: unknown, label: string): string {
if (typeof value !== "string" || !value.trim()) {
throw new AdvancedLaboratoryContractError(`${label}: ожидалась строка.`);
}
return value;
}
function optionalString(value: unknown, label: string): string | null {
return value === null ? null : stringValue(value, label);
}
function numberValue(value: unknown, label: string): number {
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
throw new AdvancedLaboratoryContractError(`${label}: ожидалось число.`);
}
return value;
}
function integerValue(value: unknown, label: string): number {
const parsed = numberValue(value, label);
if (!Number.isSafeInteger(parsed)) {
throw new AdvancedLaboratoryContractError(`${label}: ожидалось целое число.`);
}
return parsed;
}
function booleanValue(value: unknown, label: string): boolean {
if (typeof value !== "boolean") {
throw new AdvancedLaboratoryContractError(`${label}: ожидался boolean.`);
}
return value;
}
function trueValue(value: unknown, label: string): true {
if (value !== true) {
throw new AdvancedLaboratoryContractError(`${label}: ожидалось true.`);
}
return true;
}
function finiteNumber(value: unknown, label: string): number {
if (typeof value !== "number" || !Number.isFinite(value)) {
throw new AdvancedLaboratoryContractError(`${label}: ожидалось число.`);
}
return value;
}
function exactString<T extends string>(
value: unknown,
expected: T,
label: string,
): T {
if (value !== expected) {
throw new AdvancedLaboratoryContractError(`${label}: неверное значение.`);
}
return expected;
}
function strings(value: unknown, label: string): readonly string[] {
if (!Array.isArray(value)) {
throw new AdvancedLaboratoryContractError(`${label}: ожидался массив.`);
}
return value.map((item, index) => stringValue(item, `${label}[${index}]`));
}
function contentId(value: unknown, prefix: string, label: string): string {
const parsed = stringValue(value, label);
if (!new RegExp(`^${prefix}-[a-f0-9]{64}$`).test(parsed)) {
throw new AdvancedLaboratoryContractError(`${label}: неверный content id.`);
}
return parsed;
}
function sha256(value: unknown, label: string): string {
const parsed = stringValue(value, label);
if (!/^[a-f0-9]{64}$/.test(parsed)) {
throw new AdvancedLaboratoryContractError(`${label}: неверный SHA-256.`);
}
return parsed;
}
function diagnosticAuthority(value: unknown, label: string): void {
const authority = record(value, label);
if (
authority.commands_enabled !== false
|| authority.navigation_or_safety_accepted !== false
) {
throw new AdvancedLaboratoryContractError(`${label}: запрещённые полномочия.`);
}
}
function parseCatalog<T>(
payload: unknown,
parseItem: (value: unknown) => T,
): T | null {
const value = record(payload, "Каталог LAB");
exactString(
value.schema_version,
"missioncore.laboratory-advanced-catalog/v1",
"Каталог LAB.schema_version",
);
booleanValue(value.configured, "Каталог LAB.configured");
integerValue(value.candidate_total, "Каталог LAB.candidate_total");
integerValue(value.invalid_total, "Каталог LAB.invalid_total");
exactString(value.access, "read-only", "Каталог LAB.access");
if (!Array.isArray(value.items)) {
throw new AdvancedLaboratoryContractError("Каталог LAB.items: ожидался массив.");
}
if (value.items.length > 1) {
throw new AdvancedLaboratoryContractError("Каталог LAB.items: нарушен limit=1.");
}
return value.items.length ? parseItem(value.items[0]) : null;
}
function parseE31(value: unknown): E31LaboratoryResult {
const item = record(value, "E31");
const metrics = record(item.metrics, "E31.metrics");
diagnosticAuthority(item.authority, "E31.authority");
return {
resultId: contentId(item.result_id, "e31-source-qualification", "E31.result_id"),
createdAtUtc: optionalString(item.created_at_utc, "E31.created_at_utc"),
sourceSessionId: stringValue(item.source_session_id, "E31.source_session_id"),
status: exactString(
item.status,
"accepted-diagnostic-source-profile",
"E31.status",
),
eligibleForE32: trueValue(item.eligible_for_e32, "E31.eligible_for_e32"),
profileId: stringValue(item.profile_id, "E31.profile_id"),
producerSha256: sha256(item.producer_sha256, "E31.producer_sha256"),
metrics: {
frameCount: integerValue(metrics.frame_count, "E31.metrics.frame_count"),
availableBindingCount: integerValue(metrics.available_binding_count, "E31.metrics.available_binding_count"),
availableFraction: numberValue(metrics.available_fraction, "E31.metrics.available_fraction"),
lidarCameraP95Ms: numberValue(metrics.lidar_camera_p95_ms, "E31.metrics.lidar_camera_p95_ms"),
posePointP95Ms: numberValue(metrics.pose_point_p95_ms, "E31.metrics.pose_point_p95_ms"),
selectedOffsetMs: finiteNumber(metrics.selected_offset_ms, "E31.metrics.selected_offset_ms"),
correspondenceCount: integerValue(metrics.correspondence_count, "E31.metrics.correspondence_count"),
supportedFraction: numberValue(metrics.supported_fraction, "E31.metrics.supported_fraction"),
semanticSelfSampleCount: integerValue(metrics.semantic_self_sample_count, "E31.metrics.semantic_self_sample_count"),
semanticSelfCollateralCount: integerValue(metrics.semantic_self_collateral_count, "E31.metrics.semantic_self_collateral_count"),
exactGeometryCorrectionCount: integerValue(metrics.exact_geometry_correction_count, "E31.metrics.exact_geometry_correction_count"),
geometryPointMaskStatus: stringValue(metrics.geometry_point_mask_status, "E31.metrics.geometry_point_mask_status"),
},
limitations: strings(item.limitations, "E31.limitations"),
access: exactString(item.access, "read-only", "E31.access"),
};
}
function parseE32(value: unknown): E32LaboratoryResult {
const item = record(value, "E32");
const metrics = record(item.metrics, "E32.metrics");
diagnosticAuthority(item.authority, "E32.authority");
return {
resultId: contentId(item.result_id, "e32-track-geometry", "E32.result_id"),
createdAtUtc: optionalString(item.created_at_utc, "E32.created_at_utc"),
sourceSessionId: stringValue(item.source_session_id, "E32.source_session_id"),
status: exactString(
item.status,
"accepted-diagnostic-track-geometry-replay",
"E32.status",
),
profileId: stringValue(item.profile_id, "E32.profile_id"),
producerSha256: sha256(item.producer_sha256, "E32.producer_sha256"),
e31ResultId: contentId(item.e31_result_id, "e31-source-qualification", "E32.e31_result_id"),
metrics: {
framesTotal: integerValue(metrics.frames_total, "E32.metrics.frames_total"),
framesSourceAvailable: integerValue(metrics.frames_source_available, "E32.metrics.frames_source_available"),
semanticPublished: integerValue(metrics.semantic_published, "E32.metrics.semantic_published"),
semanticMasked: integerValue(metrics.semantic_masked, "E32.metrics.semantic_masked"),
geometryPublished: integerValue(metrics.geometry_published, "E32.metrics.geometry_published"),
observationsArbitrated: integerValue(metrics.observations_arbitrated, "E32.metrics.observations_arbitrated"),
overlappingClaimsRemoved: integerValue(metrics.overlapping_claims_removed, "E32.metrics.overlapping_claims_removed"),
qualifiedPointsPublished: integerValue(metrics.qualified_points_published, "E32.metrics.qualified_points_published"),
qualifiedPointsWithheld: integerValue(metrics.qualified_points_withheld, "E32.metrics.qualified_points_withheld"),
frameProcessingP95Ms: numberValue(metrics.frame_processing_p95_ms, "E32.metrics.frame_processing_p95_ms"),
buildElapsedMs: numberValue(metrics.build_elapsed_ms, "E32.metrics.build_elapsed_ms"),
},
access: exactString(item.access, "read-only", "E32.access"),
};
}
function parseE33(value: unknown): E33LaboratoryResult {
const item = record(value, "E33");
const worker = record(item.worker, "E33.worker");
const metrics = record(item.metrics, "E33.metrics");
diagnosticAuthority(item.authority, "E33.authority");
return {
resultId: contentId(item.result_id, "e33-worker-shadow", "E33.result_id"),
createdAtUtc: optionalString(item.created_at_utc, "E33.created_at_utc"),
sourceSessionId: stringValue(item.source_session_id, "E33.source_session_id"),
status: exactString(
item.status,
"accepted-recorded-source-paced-shadow",
"E33.status",
),
e32ResultId: contentId(item.e32_result_id, "e32-track-geometry", "E33.e32_result_id"),
pipelineId: stringValue(item.pipeline_id, "E33.pipeline_id"),
mode: stringValue(item.mode, "E33.mode"),
worker: {
node: stringValue(worker.node, "E33.worker.node"),
containerImage: stringValue(worker.container_image, "E33.worker.container_image"),
python: stringValue(worker.python, "E33.worker.python"),
numpy: stringValue(worker.numpy, "E33.worker.numpy"),
},
metrics: {
sourceFrames: integerValue(metrics.source_frames, "E33.metrics.source_frames"),
deliveredFrames: integerValue(metrics.delivered_frames, "E33.metrics.delivered_frames"),
inputSuperseded: integerValue(metrics.input_superseded, "E33.metrics.input_superseded"),
resultSuperseded: integerValue(metrics.result_superseded, "E33.metrics.result_superseded"),
effectiveDeliveryFps: numberValue(metrics.effective_delivery_fps, "E33.metrics.effective_delivery_fps"),
deadlineMissFraction: numberValue(metrics.deadline_miss_fraction, "E33.metrics.deadline_miss_fraction"),
processingP95Ms: numberValue(metrics.processing_p95_ms, "E33.metrics.processing_p95_ms"),
releaseLagP95Ms: numberValue(metrics.release_lag_p95_ms, "E33.metrics.release_lag_p95_ms"),
resultAgeP95Ms: numberValue(metrics.result_age_p95_ms, "E33.metrics.result_age_p95_ms"),
processRssP95Mib: numberValue(metrics.process_rss_p95_mib, "E33.metrics.process_rss_p95_mib"),
gpuUtilizationP95Percent: numberValue(metrics.gpu_utilization_p95_percent, "E33.metrics.gpu_utilization_p95_percent"),
gpuVisible: booleanValue(metrics.gpu_visible, "E33.metrics.gpu_visible"),
workQueueCapacity: integerValue(metrics.work_queue_capacity, "E33.metrics.work_queue_capacity"),
resultQueueCapacity: integerValue(metrics.result_queue_capacity, "E33.metrics.result_queue_capacity"),
wallToIdealRatio: numberValue(metrics.wall_to_ideal_ratio, "E33.metrics.wall_to_ideal_ratio"),
},
access: exactString(item.access, "read-only", "E33.access"),
};
}
async function fetchOne<T>(
path: string,
parser: (value: unknown) => T,
fetcher: LaboratoryFetch,
signal?: AbortSignal,
): Promise<T | null> {
const response = await fetcher(path, {
method: "GET",
headers: { Accept: "application/json" },
signal,
});
if (!response.ok) {
throw new AdvancedLaboratoryContractError(`Каталог LAB недоступен: HTTP ${response.status}.`);
}
return parseCatalog(await response.json(), parser);
}
export async function fetchAdvancedLaboratoryResults({
fetcher = fetch,
signal,
}: {
fetcher?: LaboratoryFetch;
signal?: AbortSignal;
} = {}): Promise<AdvancedLaboratoryResults> {
const [e31, e32, e33] = await Promise.all([
fetchOne("/api/v1/laboratory/e31/results?limit=1", parseE31, fetcher, signal),
fetchOne("/api/v1/laboratory/e32/results?limit=1", parseE32, fetcher, signal),
fetchOne("/api/v1/laboratory/e33/results?limit=1", parseE33, fetcher, signal),
]);
return { e31, e32, e33 };
}
@@ -0,0 +1,108 @@
import type { ReactNode } from "react";
import { StatusBadge } from "@nodedc/ui-react";
import {
LaboratoryEvidence,
LaboratorySummary,
LaboratoryWorkTemplate,
} from "../../components/laboratory/LaboratoryPresentation";
import type { E31LaboratoryResult } from "../../core/laboratory/advancedResults";
import { formatNumber } from "../../presentation";
export function E31Result({
rigLabel,
result,
evidence,
}: {
rigLabel: string;
result: E31LaboratoryResult;
evidence: ReactNode;
}) {
const metrics = result.metrics;
return (
<LaboratoryWorkTemplate
summary={(
<LaboratorySummary
title="LAB E31 · квалификация source binding"
description="Проверена привязка camera, LiDAR и pose к неизменяемой записи RAVNOVES00. Профиль принят только для этого источника: время основано на host-arrival, а не на аппаратном firing time."
status="Допущено к E32"
statusTone="success"
facts={[
{ label: "Конфигурация", value: `${rigLabel} · camera + LiDAR + pose` },
{ label: "Источник", value: result.sourceSessionId },
{
label: "Привязано",
value: `${formatNumber(metrics.availableBindingCount, 0)} / ${formatNumber(metrics.frameCount, 0)} кадров`,
},
{ label: "Контур", value: "Source-scoped · read-only" },
]}
method={{
completeness: "complete",
executionClass: "deterministic",
pipelineId: result.profileId,
components: [
{
kind: "source",
name: result.sourceSessionId,
version: "immutable RAVNOVES00 replay",
role: "camera, LiDAR and pose evidence",
identitySha256: null,
},
{
kind: "algorithm",
name: "Source-time and calibration qualification",
version: result.profileId,
role: "timing, offset sensitivity and self-mask checks",
identitySha256: result.producerSha256,
},
],
}}
/>
)}
evidence={(
<LaboratoryEvidence
eyebrow="ИСХОДНОЕ ДОКАЗАТЕЛЬСТВО"
title="Запись, на которой квалифицирована привязка"
kind="recorded-replay"
resizable
>
{evidence}
</LaboratoryEvidence>
)}
result={(
<section className="laboratory-result-summary">
<header>
<div>
<span className="section-eyebrow">РЕЗУЛЬТАТ И ВЫВОД</span>
<h2>Привязка воспроизводима в границах этого источника</h2>
</div>
<StatusBadge tone="success">Source profile принят</StatusBadge>
</header>
<div className="laboratory-result-metrics">
<div>
<span>Camera LiDAR p95</span>
<strong>{metrics.lidarCameraP95Ms.toLocaleString("ru-RU", { maximumFractionDigits: 2 })} мс</strong>
<small>host-arrival binding</small>
</div>
<div>
<span>Pose point p95</span>
<strong>{metrics.posePointP95Ms.toLocaleString("ru-RU", { maximumFractionDigits: 2 })} мс</strong>
<small>по доступным кадрам</small>
</div>
<div>
<span>Поддержка соответствий</span>
<strong>{(metrics.supportedFraction * 100).toLocaleString("ru-RU", { maximumFractionDigits: 1 })}%</strong>
<small>{formatNumber(metrics.correspondenceCount, 0)} соответствий</small>
</div>
<div>
<span>Self-mask</span>
<strong>{formatNumber(metrics.semanticSelfSampleCount, 0)} образцов</strong>
<small>{formatNumber(metrics.semanticSelfCollateralCount, 0)} collateral</small>
</div>
</div>
<p>Результат диагностический: он не переносится на другой монтаж сенсоров и не выдаёт командных полномочий.</p>
</section>
)}
/>
);
}
@@ -0,0 +1,105 @@
import type { ReactNode } from "react";
import { StatusBadge } from "@nodedc/ui-react";
import {
LaboratoryEvidence,
LaboratorySummary,
LaboratoryWorkTemplate,
} from "../../components/laboratory/LaboratoryPresentation";
import type { E32LaboratoryResult } from "../../core/laboratory/advancedResults";
import { formatNumber } from "../../presentation";
export function E32Result({
rigLabel,
result,
evidence,
}: {
rigLabel: string;
result: E32LaboratoryResult;
evidence: ReactNode;
}) {
const metrics = result.metrics;
return (
<LaboratoryWorkTemplate
summary={(
<LaboratorySummary
title="LAB E32 · TrackGeometry v1 replay"
description="Полная запись E29 пересчитана в детерминированный покадровый TrackGeometry. Перекрывающиеся LiDAR-точки получили единственного владельца, а диапазоны без квалифицированного источника не опубликованы."
status="Replay принят"
statusTone="success"
facts={[
{ label: "Конфигурация", value: `${rigLabel} · TrackGeometry v1` },
{ label: "Источник", value: result.sourceSessionId },
{ label: "Кадры", value: formatNumber(metrics.framesTotal, 0) },
{ label: "Контур", value: "Diagnostic replay · read-only" },
]}
method={{
completeness: "complete",
executionClass: "deterministic",
pipelineId: result.profileId,
components: [
{
kind: "source",
name: result.e31ResultId,
version: "accepted E31 source profile",
role: "qualified timing and calibration binding",
identitySha256: result.e31ResultId.split("-").at(-1) ?? null,
},
{
kind: "algorithm",
name: "Exact E29 → TrackGeometry",
version: result.profileId,
role: "point ownership, masks and deterministic storage",
identitySha256: result.producerSha256,
},
],
}}
/>
)}
evidence={(
<LaboratoryEvidence
eyebrow="ИСХОДНОЕ ДОКАЗАТЕЛЬСТВО"
title="Полная запись, пересчитанная в TrackGeometry"
kind="recorded-replay"
resizable
>
{evidence}
</LaboratoryEvidence>
)}
result={(
<section className="laboratory-result-summary">
<header>
<div>
<span className="section-eyebrow">РЕЗУЛЬТАТ И ВЫВОД</span>
<h2>TrackGeometry построен без повторной настройки порогов</h2>
</div>
<StatusBadge tone="success">Детерминированный replay</StatusBadge>
</header>
<div className="laboratory-result-metrics">
<div>
<span>Опубликовано точек</span>
<strong>{formatNumber(metrics.qualifiedPointsPublished, 0)}</strong>
<small>{formatNumber(metrics.qualifiedPointsWithheld, 0)} withheld</small>
</div>
<div>
<span>Арбитраж наблюдений</span>
<strong>{formatNumber(metrics.observationsArbitrated, 0)}</strong>
<small>{formatNumber(metrics.overlappingClaimsRemoved, 0)} overlap снято</small>
</div>
<div>
<span>Semantic</span>
<strong>{formatNumber(metrics.semanticPublished, 0)}</strong>
<small>{formatNumber(metrics.semanticMasked, 0)} self-mask</small>
</div>
<div>
<span>Frame processing p95</span>
<strong>{metrics.frameProcessingP95Ms.toLocaleString("ru-RU", { maximumFractionDigits: 3 })} мс</strong>
<small>{(metrics.buildElapsedMs / 1000).toLocaleString("ru-RU", { maximumFractionDigits: 2 })} с build</small>
</div>
</div>
<p>Отсутствие LiDAR-точек по-прежнему не трактуется как свободное пространство; результат не является навигационным ground truth.</p>
</section>
)}
/>
);
}
@@ -0,0 +1,107 @@
import type { ReactNode } from "react";
import { StatusBadge } from "@nodedc/ui-react";
import {
LaboratoryEvidence,
LaboratorySummary,
LaboratoryWorkTemplate,
} from "../../components/laboratory/LaboratoryPresentation";
import type { E33LaboratoryResult } from "../../core/laboratory/advancedResults";
import { formatNumber } from "../../presentation";
export function E33Result({
rigLabel,
result,
evidence,
}: {
rigLabel: string;
result: E33LaboratoryResult;
evidence: ReactNode;
}) {
const metrics = result.metrics;
return (
<LaboratoryWorkTemplate
summary={(
<LaboratorySummary
title="LAB E33 · worker shadow 1×"
description="Полная запись TrackGeometry выполнена отдельным bounded worker в темпе исходника 1×. Проверены очереди, доставка каждого кадра, задержка результата и ресурсы без подключения командного канала."
status="Worker gate пройден"
statusTone="success"
facts={[
{ label: "Конфигурация", value: `${rigLabel} · worker shadow` },
{ label: "Worker", value: result.worker.node },
{ label: "Доставка", value: `${formatNumber(metrics.deliveredFrames, 0)} / ${formatNumber(metrics.sourceFrames, 0)} кадров` },
{ label: "Контур", value: "Recorded-source-paced · 1×" },
]}
method={{
completeness: "complete",
executionClass: "deterministic",
pipelineId: result.pipelineId,
components: [
{
kind: "source",
name: result.e32ResultId,
version: "accepted TrackGeometry replay",
role: "immutable frame stream",
identitySha256: result.e32ResultId.split("-").at(-1) ?? null,
},
{
kind: "runtime",
name: result.worker.node,
version: `${result.worker.python} · NumPy ${result.worker.numpy}`,
role: "bounded worker, work/result queues 2/2",
identitySha256: null,
},
],
}}
/>
)}
evidence={(
<LaboratoryEvidence
eyebrow="ИСХОДНОЕ ДОКАЗАТЕЛЬСТВО"
title="Запись, доставленная worker без потерь"
kind="recorded-replay"
resizable
>
{evidence}
</LaboratoryEvidence>
)}
result={(
<section className="laboratory-result-summary">
<header>
<div>
<span className="section-eyebrow">РЕЗУЛЬТАТ И ВЫВОД</span>
<h2>Полный replay выдержан в темпе источника</h2>
</div>
<StatusBadge tone="success">
{formatNumber(metrics.deliveredFrames, 0)} / {formatNumber(metrics.sourceFrames, 0)}
</StatusBadge>
</header>
<div className="laboratory-result-metrics">
<div>
<span>Эффективная частота</span>
<strong>{metrics.effectiveDeliveryFps.toLocaleString("ru-RU", { maximumFractionDigits: 3 })} FPS</strong>
<small>скорость источника 1×</small>
</div>
<div>
<span>Result age p95</span>
<strong>{metrics.resultAgeP95Ms.toLocaleString("ru-RU", { maximumFractionDigits: 3 })} мс</strong>
<small>{(metrics.deadlineMissFraction * 100).toLocaleString("ru-RU", { maximumFractionDigits: 2 })}% deadline miss</small>
</div>
<div>
<span>Processing p95</span>
<strong>{metrics.processingP95Ms.toLocaleString("ru-RU", { maximumFractionDigits: 3 })} мс</strong>
<small>{metrics.releaseLagP95Ms.toLocaleString("ru-RU", { maximumFractionDigits: 3 })} мс release lag</small>
</div>
<div>
<span>Ресурсы p95</span>
<strong>{metrics.processRssP95Mib.toLocaleString("ru-RU", { maximumFractionDigits: 1 })} MiB</strong>
<small>GPU {metrics.gpuUtilizationP95Percent.toLocaleString("ru-RU", { maximumFractionDigits: 1 })}%</small>
</div>
</div>
<p>Очереди остались bounded, пропусков нет. Результат подтверждает только worker shadow и не даёт навигационных или safety-полномочий.</p>
</section>
)}
/>
);
}
@@ -27,6 +27,12 @@ import {
fetchE30ReviewCatalog,
type E30ReviewResult,
} from "../../core/laboratory/e30Review";
import {
fetchAdvancedLaboratoryResults,
type E31LaboratoryResult,
type E32LaboratoryResult,
type E33LaboratoryResult,
} from "../../core/laboratory/advancedResults";
import {
fetchLidarLocalSurfaces,
type LidarLocalSurfaceModel,
@@ -35,6 +41,10 @@ import { formatNumber } from "../../presentation";
import { E30ReviewWorkspace } from "../E30ReviewWorkspace";
import { LidarQualityWorkspace } from "../LidarQualityWorkspace";
import type { WorkspaceRendererProps } from "../contracts";
import { E31Result } from "./E31Result";
import { E32Result } from "./E32Result";
import { E33Result } from "./E33Result";
import { RecordedReplayEvidence } from "./RecordedReplayEvidence";
type LaboratoryWorkspaceProps = WorkspaceRendererProps & {
SpatialView: ComponentType<WorkspaceRendererProps>;
@@ -45,6 +55,9 @@ type LaboratoryWorkId =
| "e28-local-surface"
| "e29-camera-geometry"
| "e30-evidence-review"
| "e31-source-binding"
| "e32-track-geometry"
| "e33-worker-shadow"
| `session:${string}`;
function digestFromContentId(value: string | null | undefined): string | null {
@@ -535,6 +548,9 @@ export function LaboratoryArchiveWorkspace(props: LaboratoryWorkspaceProps) {
const [e28Model, setE28Model] = useState<LidarLocalSurfaceModel | null>(null);
const [e29Result, setE29Result] = useState<E29EvidenceResult | null>(null);
const [e30Result, setE30Result] = useState<E30ReviewResult | null>(null);
const [e31Result, setE31Result] = useState<E31LaboratoryResult | null>(null);
const [e32Result, setE32Result] = useState<E32LaboratoryResult | null>(null);
const [e33Result, setE33Result] = useState<E33LaboratoryResult | null>(null);
const [evidenceLoading, setEvidenceLoading] = useState(true);
const [evidenceError, setEvidenceError] = useState<string | null>(null);
const sessions = useObservationSessions({
@@ -566,18 +582,24 @@ export function LaboratoryArchiveWorkspace(props: LaboratoryWorkspaceProps) {
fetchLidarLocalSurfaces({ signal: controller.signal }),
fetchE29EvidenceCatalog({ signal: controller.signal }),
fetchE30ReviewCatalog({ signal: controller.signal }),
]).then(([e28, e29, e30]) => {
fetchAdvancedLaboratoryResults({ signal: controller.signal }),
]).then(([e28, e29, e30, advanced]) => {
if (controller.signal.aborted) return;
const nextE28 = e28.status === "fulfilled" ? e28.value.items[0] ?? null : null;
const nextE29 = e29.status === "fulfilled" ? e29.value.items[0] ?? null : null;
const nextE30 = e30.status === "fulfilled" ? e30.value.items[0] ?? null : null;
const nextAdvanced = advanced.status === "fulfilled" ? advanced.value : null;
setE28Model(nextE28);
setE29Result(nextE29);
setE30Result(nextE30);
setE31Result(nextAdvanced?.e31 ?? null);
setE32Result(nextAdvanced?.e32 ?? null);
setE33Result(nextAdvanced?.e33 ?? null);
const failures = [
e28.status === "rejected" ? "E28" : null,
e29.status === "rejected" ? "E29" : null,
e30.status === "rejected" ? "E30" : null,
advanced.status === "rejected" ? "E31E33" : null,
].filter(Boolean);
setEvidenceError(
failures.length
@@ -623,8 +645,34 @@ export function LaboratoryArchiveWorkspace(props: LaboratoryWorkspaceProps) {
label: "LAB E30 · evidence review A2",
});
}
if (e31Result && sourceSessions.has(e31Result.sourceSessionId)) {
items.push({
id: "e31-source-binding",
label: "LAB E31 · source binding",
});
}
if (e32Result && sourceSessions.has(e32Result.sourceSessionId)) {
items.push({
id: "e32-track-geometry",
label: "LAB E32 · TrackGeometry v1",
});
}
if (e33Result && sourceSessions.has(e33Result.sourceSessionId)) {
items.push({
id: "e33-worker-shadow",
label: "LAB E33 · worker shadow 1×",
});
}
return items;
}, [e28Model, e29Result, e30Result, sourceSessions]);
}, [
e28Model,
e29Result,
e30Result,
e31Result,
e32Result,
e33Result,
sourceSessions,
]);
const profiles = useMemo(() => {
const items: LaboratoryOption<LaboratoryProfileId>[] = [];
if (sensorWorks.length) {
@@ -660,6 +708,15 @@ export function LaboratoryArchiveWorkspace(props: LaboratoryWorkspaceProps) {
const e30SourceSession = e30Result
? sourceSessions.get(e30Result.sourceSessionId) ?? null
: null;
const e31SourceSession = e31Result
? sourceSessions.get(e31Result.sourceSessionId) ?? null
: null;
const e32SourceSession = e32Result
? sourceSessions.get(e32Result.sourceSessionId) ?? null
: null;
const e33SourceSession = e33Result
? sourceSessions.get(e33Result.sourceSessionId) ?? null
: null;
useEffect(() => {
if (
@@ -721,6 +778,17 @@ export function LaboratoryArchiveWorkspace(props: LaboratoryWorkspaceProps) {
}
if (next === "e30-evidence-review" && e30SourceSession) {
void sessions.replay(e30SourceSession.id);
return;
}
const advancedSession = next === "e31-source-binding"
? e31SourceSession
: next === "e32-track-geometry"
? e32SourceSession
: next === "e33-worker-shadow"
? e33SourceSession
: null;
if (advancedSession) {
void sessions.replay(advancedSession.id);
}
};
@@ -862,6 +930,45 @@ export function LaboratoryArchiveWorkspace(props: LaboratoryWorkspaceProps) {
result={e30Result}
sourceSession={e30SourceSession}
/>
) : workId === "e31-source-binding" && e31Result && e31SourceSession ? (
<E31Result
rigLabel={rigLabel}
result={e31Result}
evidence={(
<RecordedReplayEvidence
props={props}
sourceSession={e31SourceSession}
loading={sessions.replayingSessionId === e31SourceSession.id}
error={sessions.failedSessionId === e31SourceSession.id ? sessions.error : null}
/>
)}
/>
) : workId === "e32-track-geometry" && e32Result && e32SourceSession ? (
<E32Result
rigLabel={rigLabel}
result={e32Result}
evidence={(
<RecordedReplayEvidence
props={props}
sourceSession={e32SourceSession}
loading={sessions.replayingSessionId === e32SourceSession.id}
error={sessions.failedSessionId === e32SourceSession.id ? sessions.error : null}
/>
)}
/>
) : workId === "e33-worker-shadow" && e33Result && e33SourceSession ? (
<E33Result
rigLabel={rigLabel}
result={e33Result}
evidence={(
<RecordedReplayEvidence
props={props}
sourceSession={e33SourceSession}
loading={sessions.replayingSessionId === e33SourceSession.id}
error={sessions.failedSessionId === e33SourceSession.id ? sessions.error : null}
/>
)}
/>
) : selectedSession ? (
<PublishedLaboratoryResult
props={props}
@@ -0,0 +1,36 @@
import type { ComponentType } from "react";
import { Icon } from "@nodedc/ui-react";
import type { ObservationSessionSummary } from "../../core/observation/sessionArchive";
import type { WorkspaceRendererProps } from "../contracts";
type ReplayEvidenceProps = WorkspaceRendererProps & {
SpatialView: ComponentType<WorkspaceRendererProps>;
};
export function RecordedReplayEvidence({
props,
sourceSession,
loading,
error,
}: {
props: ReplayEvidenceProps;
sourceSession: ObservationSessionSummary;
loading: boolean;
error: string | null;
}) {
if (props.recordedReplay?.sessionId === sourceSession.id) {
return <props.SpatialView {...props} />;
}
return (
<div className="laboratory-result-pending" role="status">
{loading ? <span className="busy-indicator" aria-hidden="true" /> : <Icon name="database" size={20} />}
<strong>{loading ? "Проверяем и открываем запись" : "Исходная запись не открыта"}</strong>
<p>
{error ?? (loading
? "Viewer появится после серверной проверки неизменяемого RRD."
: "Выберите работу повторно, чтобы открыть связанный источник.")}
</p>
</div>
);
}