#!/usr/bin/env python3 import hashlib import json import pathlib import subprocess from wbv2_execution_phase import implementation_only ROOT = pathlib.Path(__file__).resolve().parents[1] JOB = "METABALL-ELEMENTS-AUTHORING" def main(): context = json.loads(subprocess.check_output(["node", "tools/web/print-task-context.mjs"], cwd=ROOT, text=True)) if not implementation_only(ROOT): subprocess.run(["node", "tools/web/check-task-context.mjs"], cwd=ROOT, check=True, stdout=subprocess.DEVNULL) parent = ROOT / context["sourceDocuments"]["parentManifest"] source_refs = [ "blender-5.2.0/source/blender/blenkernel/intern/mball.cc", "blender-5.2.0/source/blender/web_engine/web_engine_api.cpp", "blender-5.2.0/source/blender/web_engine/web_engine_main_state.cpp", ] changed = ["web/tests/e2e/wbv2-metaball-elements-production.spec.ts", "my-tools/prepare_wbv2_metaball_workflow.py"] deps = sorted(set(source_refs + changed + [ ".emscripten-web", "build_web_blender6/CMakeCache.txt", "my-tools/build_local_webengine.py", "tools/web/incremental-web-build.mjs", "tools/web/sync-web-engine-runtime.mjs", "web/tests/fixtures/native-ui-workflow.ts", "tests/files/web/nonmesh_scene.blend", "web/app/src/app/App.tsx", "web/app/src/workers/web-engine.worker.ts", "web/protocol/web-engine.ts", "web/tsconfig.json", "web/package.json", "web/playwright.config.ts", ])) missing = [path for path in deps if not (ROOT / path).is_file()] if missing: raise RuntimeError("Missing dependency: " + ", ".join(missing)) kinds = ["positive", "negative", "undo_redo", "save_reopen", "determinism"] checks = [ {"id": "wasm-source-build", "argv": ["python3", "my-tools/build_local_webengine.py"], "cwd": ".", "kinds": ["source_build"], "timeoutSeconds": 1200, "continueOnFailure": True}, {"id": "web-build", "argv": ["node", "tools/web/incremental-web-build.mjs"], "cwd": ".", "kinds": ["typecheck"], "dependsOn": ["wasm-source-build"], "timeoutSeconds": 300, "continueOnFailure": True}, {"id": "authoring-lint", "argv": ["node", "node_modules/eslint/bin/eslint.js", "app/src/app/App.tsx"], "cwd": "web", "kinds": ["lint"], "timeoutSeconds": 60, "continueOnFailure": True}, {"id": "chromium-authoring", "argv": ["env", "WEB_TEST_PORT=5372", "node", "node_modules/@playwright/test/cli.js", "test", "--config", "playwright.config.ts", "tests/e2e/wbv2-metaball-elements-production.spec.ts", "--workers=1", "--max-failures=1"], "cwd": "web", "kinds": ["chromium", *kinds], "dependsOn": ["wasm-source-build", "web-build"], "timeoutSeconds": 120, "continueOnFailure": True}, ] result = {"status": "ready", "summary": "Metaball element edits persist in native Main", "workflow": "Edit active Metaball element position and radius, reject malformed values, and verify undo/redo/save/reopen/determinism", "sourceUnits": ["web-command:setMetaballElements"], "routeIds": ["web-command:setMetaballElements"], "sourceReferences": source_refs, "changedFiles": changed, "dependencies": deps, "artifacts": ["build_blender_native/bin/blender", "build_web_blender6/bin/web_engine.wasm", "build_web_blender6/bin/web_engine.js"], "checks": checks, "cases": [{"id": f"metaball-elements-{kind}", "kind": kind, "checkId": "chromium-authoring", "receipt": f"unallocated/{kind}.json", "unitIds": ["web-command:setMetaballElements"]} for kind in kinds]} doc = {"schemaVersion": 1, "task": context["task"], "job": JOB, "parentSha256": hashlib.sha256(parent.read_bytes()).hexdigest(), "acceptance": "pending independent local validation", "result": result} backlog_path = ROOT / "tests/golden/WBV2/web-product-backlog.json" backlog = json.loads(backlog_path.read_text()) parent_job = next(job for job in backlog["tasks"] if job["id"] == "CURVE-SURFACE-COVERAGE") if not any(job["id"] == JOB for job in backlog["tasks"]): backlog["tasks"].append({ "id": JOB, "parentJob": parent_job["id"], "module": parent_job["module"], "title": "Verify Metaball element editing in native Main", "status": "pending", "commands": ["setMetaballElements"], "ownedPaths": parent_job["ownedPaths"], "implementation": result["workflow"], "resultPath": f"tests/golden/WBV2/product-migration/{JOB}-result.json", }) backlog_path.write_text(json.dumps(backlog, indent=2, ensure_ascii=False) + "\n") path = ROOT / "my-tools/local-workflows" / f"{JOB}.json" path.write_text(json.dumps(doc, indent=2) + "\n") print(json.dumps({"job": JOB, "state": "prepared", "contract": str(path.relative_to(ROOT))})) if __name__ == "__main__": main()