Files
workinf_Blender_Wasm/my-tools/prepare_wbv2_nonmesh_workflow.py
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
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>
2026-11-10 11:18:01 +08:00

73 lines
5.1 KiB
Python

#!/usr/bin/env python3
"""Prepare bounded non-mesh workflows with fresh native Main readback."""
import hashlib
import json
import pathlib
import subprocess
from wbv2_execution_phase import implementation_only
ROOT = pathlib.Path(__file__).resolve().parents[1]
JOB = "WEBUI-NONMESH-ADVANCED"
PREPARATION_INPUTS = [
"web/tests/e2e/nonmesh-advanced-ui-production.spec.ts",
"web/tests/fixtures/nonmesh-advanced-main-snapshots.py",
"tests/files/web/nonmesh_scene.blend",
]
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)
test_path, reader, fixture = PREPARATION_INPUTS
sources = ["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",
"blender-5.2.0/source/blender/web_engine/web_engine_blend_reader.cpp",
"blender-5.2.0/source/blender/blenkernel/intern/curve.cc"]
changed = [test_path, reader, "my-tools/prepare_wbv2_nonmesh_workflow.py", "web/app/src/app/App.tsx",
"blender-5.2.0/source/blender/web_engine/web_engine_api.cpp"]
dependencies = sorted(set(sources + 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", fixture,
"web/tests/fixtures/native-ui-workflow.ts", "web/protocol/web-engine.ts", "web/protocol/scene-ir.ts",
"web/protocol/nonmesh-geometry-commands.ts", "web/protocol/nonmesh-binary.ts",
"web/app/src/workers/web-engine.worker.ts", "web/app/src/engine-client/WebEngineClient.ts",
"web/app/vite.config.ts", "web/tsconfig.json", "web/package.json", "web/playwright.config.ts",
]))
missing = [path for path in dependencies if not (ROOT / path).is_file()]
if missing:
raise RuntimeError(f"Missing dependencies: {missing}")
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", test_path.removeprefix("web/")], "cwd": "web", "kinds": ["lint"], "timeoutSeconds": 90, "continueOnFailure": True},
]
kinds = ["positive", "negative", "undo_redo", "save_reopen", "determinism"]
commands = {"handle": "setCurveHandle", "splines": "setCurveSplines", "surface": "setSurfaceTopology", "delete": "deleteNonMeshData"}
cases = []
for route in ["panel", *commands]:
identifier = f"chromium-{route}"
checks.append({"id": identifier, "argv": ["env", "WEB_TEST_PORT=5379", "node", "node_modules/@playwright/test/cli.js", "test", "--config", "playwright.config.ts", test_path.removeprefix("web/"), "--grep", f"nonmesh {route} ", "--workers=1", "--max-failures=1"], "cwd": "web", "kinds": ["chromium", *(kinds if route in commands else [])], "dependsOn": ["wasm-source-build", "web-build", "authoring-lint"], "timeoutSeconds": 75, "continueOnFailure": True})
if route in commands:
cases.extend({"id": f"nonmesh-{route}-{kind}", "kind": kind, "checkId": identifier,
"receipt": f"unallocated/{route}-{kind}.json", "unitIds": [f"web-command:{commands[route]}"]} for kind in kinds)
units = [f"web-command:{command}" for command in commands.values()]
result = {"status": "ready", "summary": "Non-mesh panel edits use native geometry and retain the active data owner",
"workflow": "Edit Bezier handles, replace Curve splines, toggle Surface topology and delete non-mesh data; validate each route through desktop Main readback, rejection, history, persistence and replay",
"sourceUnits": units, "routeIds": units, "sourceReferences": sources, "changedFiles": changed,
"dependencies": dependencies, "artifacts": ["build_web_blender6/bin/web_engine.wasm", "build_web_blender6/bin/web_engine.js", "build_blender_native/bin/blender"],
"checks": checks, "cases": cases}
document = {"schemaVersion": 1, "task": context["task"], "job": JOB,
"parentSha256": hashlib.sha256((ROOT / context["sourceDocuments"]["parentManifest"]).read_bytes()).hexdigest(),
"acceptance": "pending independent local validation", "result": result}
target = ROOT / "my-tools/local-workflows" / f"{JOB}.json"
temporary = target.with_suffix(".json.tmp")
temporary.write_text(json.dumps(document, indent=2) + "\n")
temporary.replace(target)
print(json.dumps({"job": JOB, "state": "prepared", "checks": len(checks), "cases": len(cases)}))
if __name__ == "__main__":
main()