Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
90 lines
4.3 KiB
TypeScript
90 lines
4.3 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { test, expect } from "@playwright/test";
|
|
import { observeNative } from "../fixtures/native-ui-workflow";
|
|
|
|
const root = path.resolve(import.meta.dirname, "../../..");
|
|
|
|
test("which cleanup construction actually mutates Main during reset", async ({ page }) => {
|
|
test.setTimeout(300_000);
|
|
await observeNative(page);
|
|
await page.goto("/");
|
|
await page.getByTestId("blend-file-input").setInputFiles(path.join(root, "blender-5.2.0/tests/files/sequence_editing/effects/fx_comp.blend"));
|
|
await expect.poll(async () => page.locator("main.blender-app").evaluate((n) => (n as HTMLElement).dataset.projectId), { timeout: 60000 }).toBe("fx_comp");
|
|
await expect(page.getByTestId("engine-status")).toContainText("SceneIR", { timeout: 60000 });
|
|
const out = await page.evaluate(async () => {
|
|
const worker = (window as any).__nativeWorkflowEngine as Worker;
|
|
const send = (command: any) => new Promise<any>((resolve, reject) => {
|
|
const requestId = `cl-${crypto.randomUUID()}`;
|
|
const receive = (event: MessageEvent) => {
|
|
if (event.data?.requestId !== requestId || event.data?.kind !== 'result') return;
|
|
worker.removeEventListener('message', receive);
|
|
if (event.data.ok) resolve(event.data.result); else reject(Object.assign(new Error(`${event.data.error?.code}: ${event.data.error?.message}`), { detail: event.data.error }));
|
|
};
|
|
worker.addEventListener('message', receive); worker.postMessage({ requestId, command });
|
|
});
|
|
const sceneNames = async () => send({ type: 'snapshot' }).then((r: any) => (r?.snapshot?.scenes ?? []).map((s: any) => s.name), () => 'n/a');
|
|
const run = async (label: string, source: string) => {
|
|
const exec = await send({ type: 'jsonCommand', cmd: 'pythonExec', params: { source, filename: `${label}.py`, console: false } })
|
|
.then((r: any) => ({ state: r?.json?.state, output: String(r?.json?.output ?? '').slice(-300) }), (e: Error) => ({ error: e.message }));
|
|
const reset = await send({ type: 'jsonCommand', cmd: 'pythonReset', params: {} })
|
|
.then((r: any) => JSON.stringify(r?.json ?? r).slice(0, 200), (e: Error) => `ERR ${e.message}`);
|
|
const names = await sceneNames();
|
|
return { label, exec, reset, names };
|
|
};
|
|
const results = [];
|
|
results.push(await run('driver_del', [
|
|
'import bpy',
|
|
'class CleanupEdit:',
|
|
' def __del__(self):',
|
|
' print("FINALIZER_RAN")',
|
|
' try:',
|
|
' bpy.context.scene.name = "CleanupEditScene"',
|
|
' except Exception as exc:',
|
|
' print("FINALIZER_EDIT_FAILED", repr(exc))',
|
|
"bpy.app.driver_namespace['_cleanup_edit'] = CleanupEdit()",
|
|
'print("PLACED")',
|
|
'',
|
|
].join('\n')));
|
|
results.push(await run('rna_type_del', [
|
|
'import bpy',
|
|
'from bpy.props import IntProperty',
|
|
'class CleanupType(bpy.types.Operator):',
|
|
' bl_idname = "probe.cleanup_type"',
|
|
' bl_label = "cleanup"',
|
|
' bl_options = {"REGISTER"}',
|
|
' value: IntProperty()',
|
|
' def execute(self, context):',
|
|
' return {"FINISHED"}',
|
|
' def __del__(self):',
|
|
' print("TYPE_FINALIZER_RAN")',
|
|
' try:',
|
|
' bpy.context.scene.name = "CleanupTypeScene"',
|
|
' except Exception as exc:',
|
|
' print("TYPE_EDIT_FAILED", repr(exc))',
|
|
'if not hasattr(bpy.types, "CleanupType"):',
|
|
' bpy.utils.register_class(CleanupType)',
|
|
"bpy.app.driver_namespace['_cleanup_type'] = CleanupType()",
|
|
'print("TYPE_PLACED")',
|
|
'',
|
|
].join('\n')));
|
|
results.push(await run('handler_del', [
|
|
'import bpy',
|
|
'class CleanupHandler:',
|
|
' def __call__(self, scene, *args):',
|
|
' pass',
|
|
' def __del__(self):',
|
|
' print("HANDLER_FINALIZER_RAN")',
|
|
' try:',
|
|
' bpy.context.scene.name = "CleanupHandlerScene"',
|
|
' except Exception as exc:',
|
|
' print("HANDLER_EDIT_FAILED", repr(exc))',
|
|
"bpy.app.handlers.depsgraph_update_post.append(CleanupHandler())",
|
|
'print("HANDLER_PLACED")',
|
|
'',
|
|
].join('\n')));
|
|
return results;
|
|
});
|
|
fs.writeFileSync("/tmp/cleanup-construct.json", JSON.stringify(out, null, 2));
|
|
});
|