Стабилизация синхронного LAB-воспроизведения

This commit is contained in:
DCCONSTRUCTIONS
2026-08-23 18:56:06 +03:00
parent a3fc13ad63
commit 51bb1369eb
12 changed files with 1042 additions and 336 deletions
@@ -4,18 +4,30 @@ import { test } from "node:test";
const component = (name) => new URL(`../src/components/laboratory/${name}`, import.meta.url);
test("semantic evidence mask is decoded, cached, cancelled and object-contained client-side", async () => {
test("semantic evidence mask is GPU-colored, bounded, cancelled and object-contained client-side", async () => {
const source = await readFile(component("RecordedEvidenceSemanticMaskOverlay.tsx"), "utf8");
assert.match(source, /decodedMaskCache/);
assert.match(source, /pendingMaskCache/);
assert.match(source, /MASK_CACHE_LIMIT = 20/);
assert.match(source, /MASK_PREFETCH_LIMIT = 12/);
assert.match(source, /prefetchSrcs\?: readonly string\[\]/);
assert.match(source, /\.slice\(0, MASK_PREFETCH_LIMIT\)/);
assert.match(source, /AbortController/);
assert.match(source, /createSemanticMaskRenderer/);
assert.match(source, /getContext\("webgl"/);
assert.match(source, /preserveDrawingBuffer: true/);
assert.match(source, /vec2\(v_uv\.x, 1\.0 - v_uv\.y\)/);
assert.match(source, /UNPACK_FLIP_Y_WEBGL, 0/);
assert.match(source, /gl\.isContextLost\(\)/);
assert.match(source, /webglcontextlost/);
assert.match(source, /setRendererMode\("2d"\)/);
assert.match(source, /gl\.texImage2D/);
assert.match(source, /u_palette/);
assert.match(source, /getImageData/);
assert.match(source, /8-bit grayscale class-id PNG/);
assert.match(source, /ResizeObserver/);
assert.match(source, /Math\.min\(width \/ imageWidth, height \/ imageHeight\)/);
assert.match(source, /Math\.min\(width \/ mask\.width, height \/ mask\.height\)/);
assert.match(source, /decoded\.key !== expectedKey/);
assert.match(source, /mask\?\.key === expectedKey/);
assert.match(source, /необъявленный class ID/);
assert.match(source, /recorded-evidence-semantic-mask-overlay__error/);
assert.match(source, /role="alert"/);
});
@@ -43,27 +55,40 @@ test("metric evidence keeps missing semantic assignments as context and exposes
assert.match(source, /recordedEvidenceSemanticCssColor/);
});
test("semantic point alignment is enforced only when M4 exposes the exact spatial increment", async () => {
test("semantic point alignment follows the last qualified spatial increment", async () => {
const source = await readFile(
new URL("../src/workspaces/laboratory/M4ReplayThreatVisual.tsx", import.meta.url),
"utf8",
);
assert.match(source, /semantic && frame\?\.spatialAvailable && semanticFrame/);
assert.match(source, /\|\| !frame\.spatialAvailable\s*\|\| !semanticFrame/);
assert.match(source, /semanticFrame\.sourcePointCount !== frame\.pointCloudSourceCount/);
assert.match(source, /frame\?\.spatialAvailable && semanticFrame/);
assert.match(source, /lastSpatialSemanticFrameRef/);
assert.match(source, /\|\| !spatialFrame\s*\|\| !spatialSemanticFrame/);
assert.match(source, /spatialSemanticFrame\.sourcePointCount !== spatialFrame\.pointCloudSourceCount/);
});
test("M4 mounts semantic mask overlays only for the active VIDEO or CAMERA layer", async () => {
test("M4 keeps independent semantic controls in media and spatial panes", async () => {
const source = await readFile(
new URL("../src/workspaces/laboratory/M4ReplayThreatVisual.tsx", import.meta.url),
"utf8",
);
assert.match(
source,
/semanticOverlay=\{mode === "video" \? semanticOverlay : undefined\}/,
);
assert.match(
source,
/semanticOverlay=\{mode === "camera" \? semanticOverlay : undefined\}/,
);
assert.match(source, /showMediaSemantic/);
assert.match(source, /showSpatialSemantic/);
assert.match(source, /semantic && showMediaSemantic && frame/);
assert.match(source, /Array\.from\(\{ length: 12 \}, \(_, index\) => index \+ 1\)/);
assert.match(source, /\|\| !showSpatialSemantic/);
assert.match(source, /aria-label="Слои камеры и видео"/);
assert.match(source, /aria-label="Слои 3D и плана"/);
assert.match(source, /data-pane-mode="media"/);
assert.match(source, /data-pane-mode="spatial"/);
assert.match(source, /modeControlsVisible=\{!splitView\}/);
assert.match(source, /semanticOverlay=\{mediaMode === "video" \? semanticOverlay : undefined\}/);
});
test("laboratory fullscreen preserves the mounted evidence subtree", async () => {
const source = await readFile(component("LaboratoryEvidenceViewer.tsx"), "utf8");
assert.match(source, /useLayoutEffect/);
assert.match(source, /viewer\.showModal\(\)/);
assert.match(source, /viewer\.show\(\)/);
assert.match(source, /<dialog/);
assert.doesNotMatch(source, /createPortal/);
});