feat(lab): publish E39 refinement result

This commit is contained in:
DCCONSTRUCTIONS
2026-07-28 10:06:57 +03:00
parent 6e5124bd9c
commit 1f20e0d7d9
9 changed files with 770 additions and 9 deletions
@@ -179,6 +179,48 @@ export interface E38PerceptionBaselineResult {
access: "read-only";
}
export interface E39DevelopmentDimensionMetric {
correct: number;
incorrect: number;
total: number;
accuracy: number;
target: number;
passed: boolean;
}
export interface E39PerceptionRefinementResult {
resultId: string;
createdAtUtc: string | null;
sourceSessionId: string;
sourceDisplayName: string;
status: "measured-r1-source-scoped-refinement";
profileId: string;
workerNode: string;
qualityGatePassed: boolean;
developmentCrossValidation: {
strategy: string;
seed: string;
folds: number;
items: number;
validationLabelsUsed: false;
passed: boolean;
dimensions: {
presence: E39DevelopmentDimensionMetric;
geometryAssociation: E39DevelopmentDimensionMetric;
freshness: E39DevelopmentDimensionMetric;
};
};
metrics: E38PerceptionBaselineResult["metrics"];
blockingChecks: readonly string[];
method: {
summary: string;
selection: string;
dimensionProjection: string;
};
limitations: readonly string[];
access: "read-only";
}
export interface AdvancedLaboratoryResults {
e31: E31LaboratoryResult | null;
e32: E32LaboratoryResult | null;
@@ -187,6 +229,7 @@ export interface AdvancedLaboratoryResults {
e35: E35DegradationRecoveryResult | null;
e37: E37AcceptanceContractResult | null;
e38: E38PerceptionBaselineResult | null;
e39: E39PerceptionRefinementResult | null;
}
export class AdvancedLaboratoryContractError extends Error {
@@ -248,6 +291,13 @@ function trueValue(value: unknown, label: string): true {
return true;
}
function falseValue(value: unknown, label: string): false {
if (value !== false) {
throw new AdvancedLaboratoryContractError(`${label}: ожидалось false.`);
}
return false;
}
function finiteNumber(value: unknown, label: string): number {
if (typeof value !== "number" || !Number.isFinite(value)) {
throw new AdvancedLaboratoryContractError(`${label}: ожидалось число.`);
@@ -728,6 +778,155 @@ function parseE38(value: unknown): E38PerceptionBaselineResult {
};
}
function parseE39DevelopmentDimension(
value: unknown,
label: string,
): E39DevelopmentDimensionMetric {
const source = record(value, label);
return {
correct: integerValue(source.correct, `${label}.correct`),
incorrect: integerValue(source.incorrect, `${label}.incorrect`),
total: integerValue(source.total, `${label}.total`),
accuracy: numberValue(source.accuracy, `${label}.accuracy`),
target: numberValue(source.target, `${label}.target`),
passed: booleanValue(source.passed, `${label}.passed`),
};
}
function parseE39(value: unknown): E39PerceptionRefinementResult {
const item = record(value, "E39");
const metrics = record(item.metrics, "E39.metrics");
const dimensions = record(metrics.dimensions, "E39.metrics.dimensions");
const developmentCrossValidation = record(
item.development_cross_validation,
"E39.development_cross_validation",
);
const developmentDimensions = record(
developmentCrossValidation.dimensions,
"E39.development_cross_validation.dimensions",
);
const method = record(item.method, "E39.method");
diagnosticAuthority(item.authority, "E39.authority");
return {
resultId: contentId(
item.result_id,
"e39-perception-refinement",
"E39.result_id",
),
createdAtUtc: optionalString(item.created_at_utc, "E39.created_at_utc"),
sourceSessionId: stringValue(
item.source_session_id,
"E39.source_session_id",
),
sourceDisplayName: stringValue(
item.source_display_name,
"E39.source_display_name",
),
status: exactString(
item.status,
"measured-r1-source-scoped-refinement",
"E39.status",
),
profileId: stringValue(item.profile_id, "E39.profile_id"),
workerNode: stringValue(item.worker_node, "E39.worker_node"),
qualityGatePassed: booleanValue(
item.quality_gate_passed,
"E39.quality_gate_passed",
),
developmentCrossValidation: {
strategy: stringValue(
developmentCrossValidation.strategy,
"E39.development_cross_validation.strategy",
),
seed: stringValue(
developmentCrossValidation.seed,
"E39.development_cross_validation.seed",
),
folds: integerValue(
developmentCrossValidation.folds,
"E39.development_cross_validation.folds",
),
items: integerValue(
developmentCrossValidation.items,
"E39.development_cross_validation.items",
),
validationLabelsUsed: falseValue(
developmentCrossValidation.validation_labels_used,
"E39.development_cross_validation.validation_labels_used",
),
passed: booleanValue(
developmentCrossValidation.passed,
"E39.development_cross_validation.passed",
),
dimensions: {
presence: parseE39DevelopmentDimension(
developmentDimensions.presence,
"E39.development_cross_validation.dimensions.presence",
),
geometryAssociation: parseE39DevelopmentDimension(
developmentDimensions.geometry_association,
"E39.development_cross_validation.dimensions.geometry_association",
),
freshness: parseE39DevelopmentDimension(
developmentDimensions.freshness,
"E39.development_cross_validation.dimensions.freshness",
),
},
},
metrics: {
developmentItems: integerValue(
metrics.development_items,
"E39.metrics.development_items",
),
validationItems: integerValue(
metrics.validation_items,
"E39.metrics.validation_items",
),
terminalOutcomes: integerValue(
metrics.terminal_outcomes,
"E39.metrics.terminal_outcomes",
),
accountingFraction: numberValue(
metrics.accounting_fraction,
"E39.metrics.accounting_fraction",
),
falseFreeClaims: integerValue(
metrics.false_free_claims,
"E39.metrics.false_free_claims",
),
highSeverityFailures: integerValue(
metrics.high_severity_failures,
"E39.metrics.high_severity_failures",
),
dimensions: {
presence: parseE38Dimension(
dimensions.presence,
"E39.metrics.dimensions.presence",
),
geometryAssociation: parseE38Dimension(
dimensions.geometry_association,
"E39.metrics.dimensions.geometry_association",
),
freshness: parseE38Dimension(
dimensions.freshness,
"E39.metrics.dimensions.freshness",
),
},
},
blockingChecks: strings(item.blocking_checks, "E39.blocking_checks"),
method: {
summary: stringValue(method.summary, "E39.method.summary"),
selection: stringValue(method.selection, "E39.method.selection"),
dimensionProjection: stringValue(
method.dimension_projection,
"E39.method.dimension_projection",
),
},
limitations: strings(item.limitations, "E39.limitations"),
access: exactString(item.access, "read-only", "E39.access"),
};
}
async function fetchOne<T>(
path: string,
parser: (value: unknown) => T,
@@ -752,7 +951,7 @@ export async function fetchAdvancedLaboratoryResults({
fetcher?: LaboratoryFetch;
signal?: AbortSignal;
} = {}): Promise<AdvancedLaboratoryResults> {
const [e31, e32, e33, e34, e35, e37, e38] = await Promise.all([
const [e31, e32, e33, e34, e35, e37, e38, e39] = 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),
@@ -760,8 +959,9 @@ export async function fetchAdvancedLaboratoryResults({
fetchE35DegradationRecoveryResult({ fetcher, signal }),
fetchOne("/api/v1/laboratory/e37/results?limit=1", parseE37, fetcher, signal),
fetchOne("/api/v1/laboratory/e38/results?limit=1", parseE38, fetcher, signal),
fetchOne("/api/v1/laboratory/e39/results?limit=1", parseE39, fetcher, signal),
]);
return { e31, e32, e33, e34, e35, e37, e38 };
return { e31, e32, e33, e34, e35, e37, e38, e39 };
}
import {
fetchE34TemporalLayerResult,
@@ -11,6 +11,7 @@ import { E34Result } from "./E34Result";
import { E35Result } from "./E35Result";
import { E37Result } from "./E37Result";
import { E38Result } from "./E38Result";
import { E39Result } from "./E39Result";
import { RecordedReplayEvidence } from "./RecordedReplayEvidence";
export type AdvancedLaboratoryWorkId =
@@ -20,7 +21,8 @@ export type AdvancedLaboratoryWorkId =
| "e34-temporal-layer"
| "e35-degradation-recovery"
| "e37-ravnoves-acceptance"
| "e38-perception-baseline";
| "e38-perception-baseline"
| "e39-perception-refinement";
type LaboratoryWorkspaceProps = WorkspaceRendererProps & {
SpatialView: ComponentType<WorkspaceRendererProps>;
@@ -37,6 +39,7 @@ export function isAdvancedLaboratoryWorkId(
|| value === "e35-degradation-recovery"
|| value === "e37-ravnoves-acceptance"
|| value === "e38-perception-baseline"
|| value === "e39-perception-refinement"
);
}
@@ -87,6 +90,12 @@ export function advancedLaboratoryWorkOptions(
label: "LAB E38 · perception quality R1",
});
}
if (results.e39) {
options.push({
id: "e39-perception-refinement",
label: "LAB E39 · perception refinement R1",
});
}
return options;
}
@@ -124,6 +133,9 @@ export function AdvancedLaboratoryResult({
failedSessionId: string | null;
replayError: string | null;
}) {
if (workId === "e39-perception-refinement" && results.e39) {
return <E39Result rigLabel={rigLabel} result={results.e39} />;
}
if (workId === "e38-perception-baseline" && results.e38) {
return <E38Result rigLabel={rigLabel} result={results.e38} />;
}
@@ -0,0 +1,176 @@
import {
LaboratoryEvidence,
LaboratoryResultSummary,
LaboratorySummary,
LaboratoryWorkTemplate,
} from "../../components/laboratory/LaboratoryPresentation";
import type {
E39PerceptionRefinementResult,
} from "../../core/laboratory/advancedResults";
import { formatNumber } from "../../presentation";
function percent(value: number): string {
return `${(value * 100).toLocaleString("ru-RU", {
maximumFractionDigits: 1,
})}%`;
}
export function E39Result({
rigLabel,
result,
}: {
rigLabel: string;
result: E39PerceptionRefinementResult;
}) {
const metrics = result.metrics;
const dimensions = metrics.dimensions;
const development = result.developmentCrossValidation.dimensions;
const gateLabel = result.qualityGatePassed
? "R1 gate пройден"
: "R1 gate не пройден";
return (
<LaboratoryWorkTemplate
summary={(
<LaboratorySummary
title="LAB E39 · refinement качества R1"
description="Поверх baseline E38 проверена более богатая source-scoped модель camera + LiDAR. Метод был выбран только по development-кейсам, исполнен на Worker 006 и один раз оценён на неизменяемом validation E37."
status={gateLabel}
statusTone={result.qualityGatePassed ? "success" : "warning"}
facts={[
{
label: "Конфигурация",
value: `${rigLabel} · ${result.sourceDisplayName}`,
},
{
label: "Development",
value: `${formatNumber(metrics.developmentItems, 0)} · 5-fold CV`,
},
{
label: "Validation",
value: `${formatNumber(metrics.validationItems, 0)} · sealed`,
},
{
label: "Исполнение",
value: `Worker 006 · ${result.workerNode}`,
},
]}
brief={{
question: "Закроет ли точная совокупность camera-crop, LiDAR-формы и проекционных признаков разрыв E38 до 90% без обучения на validation?",
approach: "Для каждого case сформированы 262 детерминированных признака. Robust-scaled 3-NN и правила dimension projection были зафиксированы после пятифолдовой проверки только на 340 development-кейсах; validation labels при выборе не использовались.",
principalResult: `Development CV показал presence ${percent(development.presence.accuracy)} и geometry ${percent(development.geometryAssociation.accuracy)}, но sealed validation — по ${percent(dimensions.presence.accuracy)}. Freshness удержан выше порога: ${percent(dimensions.freshness.accuracy)}.`,
limitation: "Модель включает координаты исходного кадра и относится только к RAVNOVES00. Разрыв CV → validation показывает переоценку устойчивости; перенос на другой маршрут, риг или растительную среду не доказан.",
}}
method={{
completeness: "complete",
executionClass: "deterministic",
pipelineId: result.profileId,
components: [
{
kind: "source",
name: "E37 frozen acceptance contract",
version: `${formatNumber(metrics.developmentItems, 0)} development + ${formatNumber(metrics.validationItems, 0)} sealed validation`,
role: "неизменяемый denominator и раздельные reference-метрики",
identitySha256: null,
},
{
kind: "algorithm",
name: "Robust-scaled 3-neighbour refinement",
version: "262 camera + LiDAR features · deterministic 5-fold CV",
role: "source-scoped presence classification без validation-label fit",
identitySha256: null,
},
{
kind: "tool",
name: "Package-bound feature projection",
version: "exact camera crops + LiDAR projection statistics",
role: "воспроизводимый вход Worker без скрытого доступа к исходным данным",
identitySha256: null,
},
{
kind: "runtime",
name: "Worker 006",
version: result.workerNode,
role: "ограниченное исполнение immutable package без командных полномочий",
identitySha256: null,
},
],
}}
/>
)}
evidence={(
<LaboratoryEvidence
eyebrow="DEVELOPMENT → SEALED VALIDATION"
title="Проверка устойчивости refinement"
kind="diagnostic-model"
>
<div className="laboratory-result-metrics">
<div>
<span>Development presence</span>
<strong>{percent(development.presence.accuracy)}</strong>
<small>
{`${formatNumber(development.presence.correct, 0)} / ${formatNumber(development.presence.total, 0)} · 5-fold CV`}
</small>
</div>
<div>
<span>Validation presence</span>
<strong>{percent(dimensions.presence.accuracy)}</strong>
<small>
{`${formatNumber(dimensions.presence.correct, 0)} / ${formatNumber(dimensions.presence.total, 0)} · цель 90%`}
</small>
</div>
<div>
<span>Validation geometry</span>
<strong>{percent(dimensions.geometryAssociation.accuracy)}</strong>
<small>
{`${formatNumber(dimensions.geometryAssociation.correct, 0)} / ${formatNumber(dimensions.geometryAssociation.total, 0)} · цель 90%`}
</small>
</div>
<div>
<span>Validation freshness</span>
<strong>{percent(dimensions.freshness.accuracy)}</strong>
<small>
{`${formatNumber(dimensions.freshness.correct, 0)} / ${formatNumber(dimensions.freshness.total, 0)} · цель 90%`}
</small>
</div>
</div>
</LaboratoryEvidence>
)}
result={(
<LaboratoryResultSummary
title={result.qualityGatePassed
? "Refinement достиг всех source-scoped целей R1"
: "Refinement улучшил baseline, но не закрыл R1"}
status={gateLabel}
statusTone={result.qualityGatePassed ? "success" : "warning"}
metrics={[
{
label: "Presence",
value: percent(dimensions.presence.accuracy),
hint: `${formatNumber(dimensions.presence.incorrect, 0)} ошибок · E38: 82,2%`,
},
{
label: "Geometry association",
value: percent(dimensions.geometryAssociation.accuracy),
hint: `${formatNumber(dimensions.geometryAssociation.incorrect, 0)} ошибок · E38: 81,5%`,
},
{
label: "Freshness",
value: percent(dimensions.freshness.accuracy),
hint: `${formatNumber(dimensions.freshness.incorrect, 0)} ошибок · порог пройден`,
},
{
label: "High severity",
value: formatNumber(metrics.highSeverityFailures, 0),
hint: `E38: 14 · учёт ${percent(metrics.accountingFraction)} · false free ${formatNumber(metrics.falseFreeClaims, 0)}`,
},
]}
conclusion={{
proved: `По сравнению с E38 presence вырос с 82,2% до ${percent(dimensions.presence.accuracy)}, geometry — с 81,5% до ${percent(dimensions.geometryAssociation.accuracy)}, high-severity ошибки сократились с 14 до ${formatNumber(metrics.highSeverityFailures, 0)}. Учёт остался 100%, false-free claims — 0.`,
notProved: `Порог 90% не достигнут по presence и geometry; development CV переоценил sealed validation примерно на 5,4 п.п. Результат не даёт полномочий навигации, команд или safety.`,
decision: "Зафиксировать E39 как измеренное улучшение, но не принимать R1. Следующую итерацию строить на более устойчивом development-only разбиении и более содержательном представлении объекта, не подбирая параметры по sealed validation.",
}}
/>
)}
/>
);
}
@@ -71,6 +71,7 @@ const EMPTY_ADVANCED_RESULTS: AdvancedLaboratoryResults = {
e35: null,
e37: null,
e38: null,
e39: null,
};
function laboratoryWorkOrdinal(value: string): number {