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:
102
web/tests/e2e/clip-engine-read-production.spec.ts
Normal file
102
web/tests/e2e/clip-engine-read-production.spec.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
import crypto from "node:crypto";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
const root = path.resolve(import.meta.dirname, "../../..");
|
||||
const blendPath = path.join(root, "blender-5.2.0/tests/files/tracking/tripod-motion.blend");
|
||||
const footagePath = path.join(root, "blender-5.2.0/tests/files/tracking/footage/tripod-motion.avi");
|
||||
const blend = fs.readFileSync(blendPath);
|
||||
const footage = fs.readFileSync(footagePath);
|
||||
const blendSha256 = crypto.createHash("sha256").update(blend).digest("hex");
|
||||
const footageSha256 = crypto.createHash("sha256").update(footage).digest("hex");
|
||||
|
||||
test("MOD-CLIP-01 reads MovieClip tracking data and decodes footage in Chromium", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const result = await page.evaluate(async (input) => {
|
||||
const { WebEngineClient } = await import("/src/engine-client/WebEngineClient.ts");
|
||||
const bytes = (base64: string) => Uint8Array.from(atob(base64), (character) => character.charCodeAt(0)).buffer;
|
||||
const makeResources = () => [{ path: "footage/tripod-motion.avi", buffer: bytes(input.footageBase64) }];
|
||||
const summarize = (project: any) => {
|
||||
const clips = project?.clips ?? [];
|
||||
const clip = clips[0];
|
||||
if (!clip) return null;
|
||||
const tracks = (clip.tracks ?? []) as Array<{ markers: unknown[] }>;
|
||||
return {
|
||||
clipId: clip.id as string,
|
||||
clipName: clip.name as string,
|
||||
sourcePath: clip.sourcePath as string | undefined,
|
||||
sourceStatus: clip.sourceStatus as string,
|
||||
sourceSha256: clip.sourceSha256 as string | undefined,
|
||||
width: clip.width as number,
|
||||
height: clip.height as number,
|
||||
frameStart: clip.frameStart as number,
|
||||
frameEnd: clip.frameEnd as number,
|
||||
fpsNumerator: clip.fpsNumerator as number | undefined,
|
||||
fpsDenominator: clip.fpsDenominator as number | undefined,
|
||||
trackCount: tracks.length,
|
||||
markerCount: tracks.reduce((count, track) => count + track.markers.length, 0),
|
||||
planeTrackCount: (clip.planeTracks ?? []).length,
|
||||
bindingCount: (project?.bindings ?? []).length,
|
||||
};
|
||||
};
|
||||
const client = new WebEngineClient({ nativeFiles: false, timeoutMs: 180_000 });
|
||||
try {
|
||||
const opened = await client.openBlend(bytes(input.blendBase64), undefined, undefined, [], [], makeResources());
|
||||
const clip = summarize(opened.snapshot.trackingMasks);
|
||||
if (!clip) throw new Error("trackingMasks.clips is empty");
|
||||
const decoded = await client.movieClipFrame(clip.clipId, clip.frameStart);
|
||||
const pixelBytes = atob(decoded.pixelsBase64).length;
|
||||
const saved = await client.saveBlend();
|
||||
const second = await client.openBlend(saved.slice(0), undefined, undefined, [], [], makeResources());
|
||||
const reopened: ReturnType<typeof summarize> = summarize(second.snapshot.trackingMasks);
|
||||
/* The missing-source case needs a module that never saw the footage;
|
||||
* staged files persist inside one engine across opens. */
|
||||
const missingClient = new WebEngineClient({ nativeFiles: false, timeoutMs: 180_000 });
|
||||
let missing: ReturnType<typeof summarize> = null;
|
||||
try {
|
||||
const third = await missingClient.openBlend(bytes(input.blendBase64));
|
||||
missing = summarize(third.snapshot.trackingMasks);
|
||||
}
|
||||
finally { missingClient.terminate(); }
|
||||
return { opened: clip, decoded: { width: decoded.width, height: decoded.height, pixelBytes }, reopened, missing, blendSha256: input.blendSha256, footageSha256: input.footageSha256 };
|
||||
}
|
||||
finally { client.terminate(); }
|
||||
}, { blendBase64: blend.toString("base64"), footageBase64: footage.toString("base64"), blendSha256, footageSha256 });
|
||||
|
||||
fs.mkdirSync(path.join(root, "tests/golden/MOD-CLIP-01"), { recursive: true });
|
||||
fs.writeFileSync(path.join(root, "tests/golden/MOD-CLIP-01/clip-engine-read-production.json"), `${JSON.stringify({
|
||||
schemaVersion: 1,
|
||||
task: "MOD-CLIP-01",
|
||||
operation: "MOVIECLIP_ENGINE_READ_CHROMIUM",
|
||||
browser: "chromium",
|
||||
acceptance: "NOT_CLAIMED",
|
||||
queueMutation: false,
|
||||
fixture: { blend: blendPath, blendSha256, footage: footagePath, footageSha256 },
|
||||
...result,
|
||||
}, null, 2)}\n`);
|
||||
|
||||
expect(result.blendSha256).toBe(blendSha256);
|
||||
expect(result.footageSha256).toBe(footageSha256);
|
||||
expect(result.opened?.clipId.startsWith("movieclip:")).toBe(true);
|
||||
expect(result.opened?.sourcePath).toBe("//footage/tripod-motion.avi");
|
||||
expect(result.opened?.sourceStatus).toBe("AVAILABLE");
|
||||
expect(result.opened?.sourceSha256).toBe(footageSha256);
|
||||
expect(result.opened?.width).toBeGreaterThan(0);
|
||||
expect(result.opened?.height).toBeGreaterThan(0);
|
||||
expect(result.opened?.fpsNumerator).toBeGreaterThan(0);
|
||||
expect(result.opened?.fpsDenominator).toBeGreaterThan(0);
|
||||
expect(result.opened?.trackCount).toBeGreaterThan(0);
|
||||
expect(result.opened?.markerCount).toBeGreaterThan(0);
|
||||
expect(result.opened?.bindingCount).toBeGreaterThan(0);
|
||||
expect(result.decoded.width).toBe(result.opened?.width);
|
||||
expect(result.decoded.height).toBe(result.opened?.height);
|
||||
expect(result.decoded.pixelBytes).toBe(result.decoded.width * result.decoded.height * 4);
|
||||
expect(result.reopened?.clipId).toBe(result.opened?.clipId);
|
||||
expect(result.reopened?.sourceSha256).toBe(footageSha256);
|
||||
expect(result.reopened?.trackCount).toBe(result.opened?.trackCount);
|
||||
expect(result.reopened?.markerCount).toBe(result.opened?.markerCount);
|
||||
expect(result.missing?.clipId).toBe(result.opened?.clipId);
|
||||
expect(result.missing?.sourceStatus).toBe("MISSING");
|
||||
expect(result.missing?.sourceSha256).toBeUndefined();
|
||||
});
|
||||
1246
web/tests/e2e/clip-headed-production.spec.ts
Normal file
1246
web/tests/e2e/clip-headed-production.spec.ts
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user