feat(web): complete the Clip subsystem and pass the headed acceptance suite
- Reader: real blend block bases win over synthesized interior array addresses, fixing post-detect track truncation (19 exported vs 60 in Main). - Track color reads DNA float[3] with an alpha pad; bpy writes 3 components because RNA PROP_COLOR_GAMMA has no alpha. - Clamp track weight and weight_stab to the RNA 0..1 factor range. - Read the scene frame range from scenes[0].renderSettings. - Mask status phases poll with a stall-tolerant loop instead of expect.poll, which fails the whole run when one DOM query stalls during engine persist. - Continuation and module coverage record the 24/24 PASS receipt (tests/golden/CLIP-HEADED-20261204-052513); acceptance stays NOT_CLAIMED. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
|
||||
const marker: TrackingMarkerIR = { frame: 1, position: [0.5, 0.5], patternMin: [-0.1, -0.1], patternMax: [0.1, 0.1], searchMin: [-0.2, -0.2], searchMax: [0.2, 0.2], keyframe: true, muted: false, selected: true };
|
||||
const point: MaskPointIR = { id: "point:1", co: [0.2, 0.3], handleLeft: [0.1, 0.3], handleRight: [0.3, 0.3], handleType: "ALIGNED", feather: 0.1, selected: true };
|
||||
const base = { schemaVersion: 1, revision: 4, clips: [{ id: "clip:1", name: "Shot", sourcePath: "media/shot.mp4", sourceSha256: "a".repeat(64), width: 1920, height: 1080, frameStart: 1, frameEnd: 100, fpsNumerator: 24, fpsDenominator: 1, tracks: [{ id: "track:1", name: "Track", selected: false, locked: false, markers: [marker] }], planeTracks: [] }], masks: [{ id: "mask:1", name: "Mask", layers: [{ id: "layer:1", name: "Layer", visible: true, locked: false, opacity: 1, splines: [{ id: "spline:1", cyclic: false, fill: true, points: [point, { ...point, id: "point:2", co: [0.7, 0.8] }] }] }] }], bindings: [{ id: "binding:1", target: "COMPOSITOR", ownerId: "node:1", clipId: "clip:1", maskId: "mask:1" }] };
|
||||
const base = { schemaVersion: 1, revision: 4, clips: [{ id: "clip:1", name: "Shot", sourcePath: "media/shot.mp4", sourceStatus: "AVAILABLE", sourceSha256: "a".repeat(64), width: 1920, height: 1080, frameStart: 1, frameEnd: 100, fpsNumerator: 24, fpsDenominator: 1, tracks: [{ id: "track:1", name: "Track", selected: false, locked: false, markers: [marker] }], planeTracks: [] }], masks: [{ id: "mask:1", name: "Mask", layers: [{ id: "layer:1", name: "Layer", visible: true, locked: false, opacity: 1, splines: [{ id: "spline:1", cyclic: false, fill: true, points: [point, { ...point, id: "point:2", co: [0.7, 0.8] }] }] }] }], bindings: [{ id: "binding:1", target: "COMPOSITOR", ownerId: "node:1", clipId: "clip:1", maskId: "mask:1" }] };
|
||||
|
||||
self.onmessage = () => {
|
||||
const result: Record<string, unknown> = {};
|
||||
|
||||
@@ -3532,8 +3532,8 @@ function callUnifiedJson<T>(cmd: string, params: Record<string, unknown> = {}, t
|
||||
}
|
||||
|
||||
type WebEngineRouteJsonCommand = WebEngineJsonCommand | "gpuInvoke" | "importScene" | "exportScene" | "submitServerOperatorJob" | "cancelServerOperatorJob" | "readServerOperatorResult";
|
||||
const READ_ONLY_JSON_COMMANDS: ReadonlySet<WebEngineRouteJsonCommand> = new Set(["viewportCamera", "viewportFromCamera", "viewportObjectAxis","ndofDecode", "ndofNavigate", "history", "snapshot", "delta", "depsgraph", "memoryStats", "listBlenderOperators", "listBlenderMacros", "listFeatureRoutes", "exportScene", "compositorEvaluate", "listRNADataBlocks", "readRNAProperties", "listRNACollections", "readRNAPropertySchema", "readRNACollection", "submitServerOperatorJob", "cancelServerOperatorJob", "readServerOperatorResult"]);
|
||||
const STATEFUL_JSON_COMMANDS: ReadonlySet<WebEngineRouteJsonCommand> = new Set(["gpuInvoke", "timelineFrame", "pythonExec", "pythonReset", "historyJump", "applyCommand", "undo", "redo", "invokeBlenderOperator", "invokeBlenderMacro", "invokeFeatureRoute", "importScene", "assetMark", "assetCatalog", "libraryLink", "libraryOverride", "libraryReload", "setRNAProperty", "setRNAArrayProperty", "setRNAEnumProperty"]);
|
||||
const READ_ONLY_JSON_COMMANDS: ReadonlySet<WebEngineRouteJsonCommand> = new Set(["viewportCamera", "viewportFromCamera", "viewportObjectAxis","ndofDecode", "ndofNavigate", "history", "snapshot", "delta", "depsgraph", "memoryStats", "listBlenderOperators", "listBlenderMacros", "listFeatureRoutes", "exportScene", "compositorEvaluate", "clipFrame", "clipGraphSamples", "listRNADataBlocks", "readRNAProperties", "listRNACollections", "readRNAPropertySchema", "readRNACollection", "submitServerOperatorJob", "cancelServerOperatorJob", "readServerOperatorResult"]);
|
||||
const STATEFUL_JSON_COMMANDS: ReadonlySet<WebEngineRouteJsonCommand> = new Set(["gpuInvoke", "timelineFrame", "pythonExec", "pythonReset", "historyJump", "applyCommand", "undo", "redo", "invokeBlenderOperator", "invokeBlenderMacro", "invokeFeatureRoute", "importScene", "assetMark", "assetCatalog", "libraryLink", "libraryOverride", "libraryReload", "setRNAProperty", "setRNAArrayProperty", "setRNAEnumProperty", "createPlaneTrack", "rebuildClipProxies", "trackMarkers", "solveCamera", "clipTrackingEdit", "detectFeatures", "clipSolveEdit", "planeTrackEdit", "clipManage"]);
|
||||
|
||||
function validateRNAParams(command: WebEngineRouteJsonCommand, value: unknown): void {
|
||||
if (typeof value !== "object" || value === null || Array.isArray(value)) throw report("INVALID_ARGUMENT", `${command} requires an object params payload`, true);
|
||||
@@ -4075,6 +4075,33 @@ async function handleRequest(event: MessageEvent<WebEngineRequest>): Promise<voi
|
||||
fs.writeFile(path, new Uint8Array(library.buffer));
|
||||
resource.liveStagingFiles = stagedLibraries.length;
|
||||
}
|
||||
const projectResources = request.command.resources ?? [];
|
||||
if (!Array.isArray(projectResources) || projectResources.length > 256) throw report("INVALID_ARGUMENT", "Choose at most 256 project resources");
|
||||
let projectResourceBytes = 0;
|
||||
for (const item of projectResources) {
|
||||
const path = typeof item.path === "string" ? item.path : "";
|
||||
const parts = path.split("/");
|
||||
if (!path || path.length > 1024 || path.startsWith("/") || parts.length > 16 ||
|
||||
parts.some(part => !part || part === "." || part === ".." || /[\\:\u0000-\u001f]/.test(part)) || // eslint-disable-line no-control-regex -- Native paths must reject ASCII controls.
|
||||
!(item.buffer instanceof ArrayBuffer) || item.buffer.byteLength === 0) {
|
||||
throw report("INVALID_ARGUMENT", "Each project resource needs a relative native path and bytes");
|
||||
}
|
||||
projectResourceBytes += item.buffer.byteLength;
|
||||
if (projectResourceBytes > 256 * 1024 * 1024) throw report("INVALID_ARGUMENT", "Project resources exceed 256 MiB");
|
||||
const resourceFS = candidateModule.FS;
|
||||
if (!resourceFS) throw report("CAPABILITY_MISSING", "Project filesystem is unavailable");
|
||||
const nativePath = "/browser/" + path;
|
||||
const parent = nativePath.slice(0, nativePath.lastIndexOf("/"));
|
||||
resourceFS.mkdirTree(parent);
|
||||
if (resourceFS.readdir(parent).includes(parts[parts.length - 1]!)) {
|
||||
const stat = resourceFS.lstat(nativePath);
|
||||
if (!resourceFS.isFile(stat.mode)) throw report("INVALID_ARGUMENT", `Project resource is not a regular file: ${path}`);
|
||||
const existing = resourceFS.readFile(nativePath), incoming = new Uint8Array(item.buffer);
|
||||
if (existing.length === incoming.length && existing.every((value, index) => value === incoming[index])) continue;
|
||||
throw report("INVALID_ARGUMENT", `Project resource would replace an existing file: ${path}`);
|
||||
}
|
||||
resourceFS.writeFile(nativePath, new Uint8Array(item.buffer));
|
||||
}
|
||||
candidateHandle = candidateModule._web_engine_create();
|
||||
if (candidateHandle <= 0) throw report("WASM_INIT_FAILED", "WebEngine isolated open handle creation failed");
|
||||
resource.liveNativeHandles = 1;
|
||||
|
||||
Reference in New Issue
Block a user