Files
workinf_Blender_Wasm/my-tools/prepare_wbv2_armature_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

75 lines
5.2 KiB
Python

#!/usr/bin/env python3
"""Prepare independent native bone, hierarchy and constraint workflow checks."""
import hashlib
import json
import pathlib
import subprocess
from wbv2_execution_phase import implementation_only
ROOT = pathlib.Path(__file__).resolve().parents[1]
JOB = "ARMATURE-EDITOR-COVERAGE"
PREPARATION_INPUTS = [
"web/tests/e2e/armature-editor-coverage-ui-production.spec.ts",
"web/tests/fixtures/armature-authoring-main-snapshots.py",
"tests/files/web/pose_constraint_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_main_state.h",
"blender-5.2.0/source/blender/blenkernel/intern/armature.cc",
"blender-5.2.0/source/blender/blenkernel/BKE_armature.hh"]
changed = [test_path, reader, "my-tools/prepare_wbv2_armature_workflow.py", "web/app/src/app/App.tsx",
"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"]
deps = 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/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 deps 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 = {"edit": "armatureEditOperations", "roll": "setBoneRoll", "symmetry": "setBoneSymmetry",
"parent": "setBoneParenting", "constraint": "setPoseConstraint"}
cases = []
for route in ["panel", *commands]:
identifier = f"chromium-{route}"
checks.append({"id": identifier, "argv": ["env", "WEB_TEST_PORT=5378", "node", "node_modules/@playwright/test/cli.js", "test", "--config", "playwright.config.ts", test_path.removeprefix("web/"), "--grep", f"armature {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"armature-{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": "Selected-bone authoring with shared native transaction recovery",
"workflow": "Edit bones, roll, mirror state, parenting and targeted pose constraints; retain the selected armature and verify each route through desktop Main readback, rejection, history, persistence and replay",
"sourceUnits": units, "routeIds": units, "sourceReferences": sources, "changedFiles": changed,
"dependencies": deps, "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()