feat(lab): publish E40 perception product gate

This commit is contained in:
DCCONSTRUCTIONS
2026-07-29 01:52:56 +03:00
parent bfd95c7fee
commit 783aa444ac
10 changed files with 898 additions and 33 deletions
@@ -526,6 +526,107 @@ function e39() {
};
}
function e40DevelopmentProtocol({
accuracy,
correct,
incorrect,
}) {
return {
items: 340,
fold_sizes: {
0: 68,
1: 68,
2: 68,
3: 68,
4: 68,
},
passed: true,
dimensions: {
presence: e39DevelopmentDimension({ accuracy, correct, incorrect }),
geometry_association: e39DevelopmentDimension({
accuracy,
correct,
incorrect,
}),
freshness: e39DevelopmentDimension({
accuracy: 0.967647,
correct: 329,
incorrect: 11,
}),
},
};
}
function e40() {
return {
result_id: `e40-perception-product-gate-${"a".repeat(64)}`,
created_at_utc: "2026-07-28T08:30:00Z",
source_session_id: "20260720T065719Z_viewer_live",
source_display_name: "RAVNOVES00",
status: "measured-leakage-resistant-product-gate",
profile_id: "e40-ravnoves00-leakage-resistant-product-gate/v1",
worker_node: "DESKTOP-OPJ8J04",
quality_gate_passed: true,
development_cross_validation: {
strategy: "dual-leakage-resistant-development-five-fold",
seed: "e40-development-cv-v1",
folds: 5,
items: 340,
validation_labels_used: false,
passed: true,
protocols: {
"contiguous-source-time-five-fold": e40DevelopmentProtocol({
accuracy: 0.908824,
correct: 309,
incorrect: 31,
}),
"whole-track-or-scene-window-five-fold": e40DevelopmentProtocol({
accuracy: 0.920588,
correct: 313,
incorrect: 27,
}),
},
},
metrics: {
development_items: 340,
validation_items: 146,
terminal_outcomes: 146,
accounting_fraction: 1,
false_free_claims: 0,
high_severity_failures: 0,
dimensions: {
presence: e38Dimension({
accuracy: 0.90411,
correct: 132,
incorrect: 14,
passed: true,
}),
geometry_association: e38Dimension({
accuracy: 0.90411,
correct: 132,
incorrect: 14,
passed: true,
}),
freshness: e38Dimension({
accuracy: 0.958904,
correct: 140,
incorrect: 6,
passed: true,
}),
},
},
blocking_checks: [],
method: {
summary: "conservative policy plus camera-only softmax",
selection: "dual grouped development cross-validation",
dimension_projection: "presence plus immutable stratum",
},
limitations: ["RAVNOVES00 source scoped"],
authority,
access: "read-only",
};
}
before(async () => {
server = await createServer({
appType: "custom",
@@ -542,9 +643,11 @@ after(async () => {
await server?.close();
});
test("decodes E31–E39 from separate read-only catalogs", async () => {
test("decodes E31–E40 from separate read-only catalogs", async () => {
const requests = [];
const items = [e31(), e32(), e33(), e34(), e35(), e37(), e38(), e39()];
const items = [
e31(), e32(), e33(), e34(), e35(), e37(), e38(), e39(), e40(),
];
const decoded = await fetchAdvancedLaboratoryResults({
fetcher: async (input, init) => {
requests.push({ input: String(input), method: init?.method });
@@ -578,6 +681,15 @@ test("decodes E31–E39 from separate read-only catalogs", async () => {
assert.equal(decoded.e39.metrics.dimensions.presence.accuracy, 0.849315);
assert.equal(decoded.e39.metrics.highSeverityFailures, 8);
assert.equal(decoded.e39.qualityGatePassed, false);
assert.equal(
decoded.e40.developmentCrossValidation.protocols
.wholeTrackOrSceneWindow.dimensions.presence.accuracy,
0.920588,
);
assert.equal(decoded.e40.developmentCrossValidation.validationLabelsUsed, false);
assert.equal(decoded.e40.metrics.dimensions.presence.accuracy, 0.90411);
assert.equal(decoded.e40.metrics.highSeverityFailures, 0);
assert.equal(decoded.e40.qualityGatePassed, true);
assert.deepEqual(requests, [
{ input: "/api/v1/laboratory/e31/results?limit=1", method: "GET" },
{ input: "/api/v1/laboratory/e32/results?limit=1", method: "GET" },
@@ -587,9 +699,36 @@ test("decodes E31–E39 from separate read-only catalogs", async () => {
{ input: "/api/v1/laboratory/e37/results?limit=1", method: "GET" },
{ input: "/api/v1/laboratory/e38/results?limit=1", method: "GET" },
{ input: "/api/v1/laboratory/e39/results?limit=1", method: "GET" },
{ input: "/api/v1/laboratory/e40/results?limit=1", method: "GET" },
]);
});
test("keeps valid LAB catalogs available when one transport endpoint fails", async () => {
const decoded = await fetchAdvancedLaboratoryResults({
fetcher: async (input) => {
const path = String(input);
if (path.includes("/e31/")) {
return new Response("", { status: 503 });
}
const item = path.includes("/e32/") ? e32()
: path.includes("/e33/") ? e33()
: path.includes("/e34/") ? e34()
: path.includes("/e35/") ? e35()
: path.includes("/e37/") ? e37()
: path.includes("/e38/") ? e38()
: path.includes("/e39/") ? e39() : e40();
return new Response(JSON.stringify(catalog(item)), {
status: 200,
headers: { "Content-Type": "application/json" },
});
},
});
assert.equal(decoded.e31, null);
assert.equal(decoded.e32.metrics.qualifiedPointsPublished, 2119302);
assert.equal(decoded.e40.qualityGatePassed, true);
});
test("rejects authority escalation in an accepted-looking result", async () => {
const forged = {
...e31(),
@@ -604,7 +743,8 @@ test("rejects authority escalation in an accepted-looking result", async () => {
: String(input).includes("/e34/") ? e34()
: String(input).includes("/e35/") ? e35()
: String(input).includes("/e37/") ? e37()
: String(input).includes("/e38/") ? e38() : e39(),
: String(input).includes("/e38/") ? e38()
: String(input).includes("/e39/") ? e39() : e40(),
)), { status: 200 }),
}),
AdvancedLaboratoryContractError,
@@ -110,6 +110,8 @@ test("central composition files cannot silently become monoliths again", async (
["App.tsx", 1_250],
["workspaces/Workspaces.tsx", 1_200],
["workspaces/laboratory/LaboratoryArchiveWorkspace.tsx", 1_000],
["core/laboratory/advancedResults.ts", 1_000],
["core/laboratory/e40ProductGate.ts", 500],
["styles/workspaces.css", 4_350],
["styles/laboratory.css", 900],
["styles/laboratory-reporting.css", 100],
@@ -38,6 +38,10 @@ const e39ResultUrl = new URL(
"../src/workspaces/laboratory/E39Result.tsx",
import.meta.url,
);
const e40ResultUrl = new URL(
"../src/workspaces/laboratory/E40Result.tsx",
import.meta.url,
);
const e35StylesUrl = new URL(
"../src/styles/e35-degradation-recovery.css",
import.meta.url,
@@ -261,6 +265,28 @@ test("E39 reports refinement and the CV-to-validation gap through the canonical
assert.match(advancedSource, /<E39Result/);
});
test("E40 reports dual grouped qualification and the sealed product gate through the canonical LAB anatomy", async () => {
const [e40Source, advancedSource] = await Promise.all([
readFile(e40ResultUrl, "utf8"),
readFile(advancedLaboratoryResultUrl, "utf8"),
]);
assert.match(e40Source, /<LaboratoryWorkTemplate/);
assert.match(e40Source, /<LaboratoryEvidence/);
assert.match(e40Source, /<LaboratoryResultSummary/);
assert.match(e40Source, /frame index, session time, review ordinal, track ID/);
assert.match(e40Source, /validation labels при выборе и обучении не использовались/);
assert.match(e40Source, /Whole track \/ scene CV/);
assert.match(e40Source, /[Ss]ource-scoped perception gate/);
assert.match(e40Source, /не подбирая профиль по validation/);
assert.doesNotMatch(
e40Source,
/className="laboratory-(?:summary|result-summary|result-metrics|result-conclusion)"/,
);
assert.match(advancedSource, /id: "e40-perception-product-gate"/);
assert.match(advancedSource, /<E40Result/);
});
test("the primary point-cloud viewer restores from fullscreen on Escape", async () => {
const workspacesSource = await readFile(workspacesUrl, "utf8");