#!/usr/bin/env python3 """Authorize the next source-backed Blender module batch. Each successor is a bounded capability batch. The queue advances only after a single shared Blender Main/WASM/Worker/Chromium chain produces an aggregate receipt for every selected source unit. """ from __future__ import annotations import argparse import hashlib import json import re import subprocess from datetime import datetime, timezone from pathlib import Path from wbv2_runtime import CONTROL_ROOT, INDEX, QUEUE, ROOT, read_json, terminal_pointer PREFERRED_BATCHES = [ { "moduleId": "MODIFIER_READER_BATCH", "title": "verify modifier reader batch", "owner": "MODIFIER", "identifiers": ["MOD_datatransfer", "MOD_dynamicpaint", "MOD_explode", "MOD_fluid"], "rna": ["DataTransferModifier", "DynamicPaintModifier", "ExplodeModifier", "FluidModifier", "FluidDomainSettings"], "fixture": "tests/files/web/modifier_reader_batch_scene.blend", "test": "web/tests/e2e/wbv2-modifier-reader-batch-production.spec.ts", "production": "tests/golden/{task}/modifier-reader-batch-production.json", "types": ["DATA_TRANSFER", "DYNAMIC_PAINT", "EXPLODE", "FLUID"], }, { "moduleId": "MODIFIER_READER_BATCH_TWO", "title": "verify modifier reader batch two", "owner": "MODIFIER", "identifiers": ["MOD_laplaciandeform", "MOD_laplaciansmooth", "MOD_mask", "MOD_shrinkwrap"], "rna": ["LaplacianDeformModifier", "LaplacianSmoothModifier", "MaskModifier", "ShrinkwrapModifier"], "fixture": "tests/files/web/modifier_reader_batch_two_scene.blend", "test": "web/tests/e2e/wbv2-modifier-reader-batch-two-production.spec.ts", "production": "tests/golden/{task}/modifier-reader-batch-production.json", "types": ["LAPLACIANDEFORM", "LAPLACIANSMOOTH", "MASK", "SHRINKWRAP"], }, { "moduleId": "MODIFIER_READER_BATCH_THREE", "title": "verify modifier reader batch three", "owner": "MODIFIER", "identifiers": ["MOD_remesh", "MOD_skin", "MOD_weighted_normal", "MOD_warp"], "rna": ["RemeshModifier", "SkinModifier", "WeightedNormalModifier", "WarpModifier"], "fixture": "tests/files/web/modifier_reader_batch_three_scene.blend", "test": "web/tests/e2e/wbv2-modifier-reader-batch-two-production.spec.ts", "production": "tests/golden/{task}/modifier-reader-batch-production.json", "types": ["REMESH", "SKIN", "WEIGHTED_NORMAL", "WARP"], }, { "moduleId": "MODIFIER_READER_BATCH_FOUR", "title": "verify modifier reader batch four", "owner": "MODIFIER", "identifiers": ["MOD_uvproject", "MOD_uvwarp", "MOD_normal_edit", "MOD_volume_to_mesh"], "rna": ["UVProjectModifier", "UVWarpModifier", "NormalEditModifier", "VolumeToMeshModifier"], "fixture": "tests/files/web/modifier_reader_batch_four_scene.blend", "test": "web/tests/e2e/wbv2-modifier-reader-batch-two-production.spec.ts", "production": "tests/golden/{task}/modifier-reader-batch-production.json", "types": ["UV_PROJECT", "UV_WARP", "NORMAL_EDIT", "VOLUME_TO_MESH"], }, { "moduleId": "MODIFIER_READER_BATCH_FIVE", "title": "verify modifier reader batch five", "owner": "MODIFIER", "identifiers": ["MOD_meshcache", "MOD_meshsequencecache", "MOD_multires", "MOD_ocean"], "rna": ["MeshCacheModifier", "MeshSequenceCacheModifier", "MultiresModifier", "OceanModifier"], "fixture": "tests/files/web/modifier_reader_batch_five_scene.blend", "test": "web/tests/e2e/wbv2-modifier-reader-batch-two-production.spec.ts", "production": "tests/golden/{task}/modifier-reader-batch-production.json", "types": ["MESH_CACHE", "MESH_SEQUENCE_CACHE", "MULTIRES", "OCEAN"], }, { "moduleId": "GREASE_PENCIL_MODIFIER_READER_BATCH", "title": "verify Grease Pencil modifier reader batch", "owner": "DRAWING", "identifiers": [ "MOD_grease_pencil_armature", "MOD_grease_pencil_array", "MOD_grease_pencil_build", "MOD_grease_pencil_color", "MOD_grease_pencil_dash", "MOD_grease_pencil_envelope", "MOD_grease_pencil_hook", "MOD_grease_pencil_lattice", "MOD_grease_pencil_length", "MOD_grease_pencil_mirror", "MOD_grease_pencil_multiply", "MOD_grease_pencil_noise", "MOD_grease_pencil_offset", "MOD_grease_pencil_opacity", "MOD_grease_pencil_outline", "MOD_grease_pencil_shrinkwrap", "MOD_grease_pencil_simplify", "MOD_grease_pencil_smooth", "MOD_grease_pencil_subdiv", "MOD_grease_pencil_texture", "MOD_grease_pencil_thickness", "MOD_grease_pencil_time", "MOD_grease_pencil_tint", "MOD_grease_pencil_weight_angle", "MOD_grease_pencil_weight_proximity", ], "rna": [ "GreasePencilArmatureModifier", "GreasePencilArrayModifier", "GreasePencilBuildModifier", "GreasePencilColorModifier", "GreasePencilEnvelopeModifier", "GreasePencilHookModifier", "GreasePencilLatticeModifier", "GreasePencilLengthModifier", "GreasePencilMirrorModifier", "GreasePencilMultiplyModifier", "GreasePencilNoiseModifier", "GreasePencilOffsetModifier", "GreasePencilOpacityModifier", "GreasePencilOutlineModifier", "GreasePencilShrinkwrapModifier", "GreasePencilSimplifyModifier", "GreasePencilSmoothModifier", "GreasePencilSubdivModifier", "GreasePencilTextureModifier", "GreasePencilTimeModifier", "GreasePencilTintModifier", "GreasePencilWeightAngleModifier", "GreasePencilWeightProximityModifier", ], "fixture": "tests/files/web/modifier_grease_pencil_scene.blend", "test": "web/tests/e2e/wbv2-modifier-reader-batch-two-production.spec.ts", "production": "tests/golden/{task}/modifier-reader-batch-production.json", "types": [ "GREASE_PENCIL_ARMATURE", "GREASE_PENCIL_ARRAY", "GREASE_PENCIL_BUILD", "GREASE_PENCIL_COLOR", "GREASE_PENCIL_DASH", "GREASE_PENCIL_ENVELOPE", "GREASE_PENCIL_HOOK", "GREASE_PENCIL_LATTICE", "GREASE_PENCIL_LENGTH", "GREASE_PENCIL_MIRROR", "GREASE_PENCIL_MULTIPLY", "GREASE_PENCIL_NOISE", "GREASE_PENCIL_OFFSET", "GREASE_PENCIL_OPACITY", "GREASE_PENCIL_OUTLINE", "GREASE_PENCIL_SHRINKWRAP", "GREASE_PENCIL_SIMPLIFY", "GREASE_PENCIL_SMOOTH", "GREASE_PENCIL_SUBDIV", "GREASE_PENCIL_TEXTURE", "GREASE_PENCIL_THICKNESS", "GREASE_PENCIL_TIME", "GREASE_PENCIL_TINT", "GREASE_PENCIL_VERTEX_WEIGHT_ANGLE", "GREASE_PENCIL_VERTEX_WEIGHT_PROXIMITY", ], }, ] def sha(path: Path) -> str: return hashlib.sha256(path.read_bytes()).hexdigest() def write_json(path: Path, value: object) -> None: path.parent.mkdir(parents=True, exist_ok=True) path.write_text(json.dumps(value, ensure_ascii=False, indent=2) + "\n", encoding="utf-8") def write_text(path: Path, value: str) -> None: path.parent.mkdir(parents=True, exist_ok=True) path.write_text(value, encoding="utf-8") def rel(path: Path) -> str: return path.relative_to(ROOT).as_posix() def run_node(*args: str) -> None: result = subprocess.run(["node", *args], cwd=ROOT, text=True, capture_output=True, check=False) output = result.stdout or result.stderr if output: print(output, end="" if output.endswith("\n") else "\n") if result.returncode: raise SystemExit(result.returncode) def current_task() -> str: match = re.search(r"\| 当前任务 \| `(WBV2-P(\d+)-(\d{3}))` \|", QUEUE.read_text(encoding="utf-8")) if not match: raise SystemExit("queue pointer is not a WBV2 task") return match.group(1) def queue_parent() -> str: match = re.search(r"\| parent manifest \| `([^`]+)` \|", QUEUE.read_text(encoding="utf-8"), re.IGNORECASE) if not match: raise SystemExit("queue parent manifest is missing") return match.group(1) def snapshot(text: str, task: str, parent: str, next_task: str) -> str: tick = "`" substitutions = [ (r"\| Current task when this file was written \| `[^`]+` \|", f"| Current task when this file was written | {tick}{task}{tick} |"), (r"\| Current task state \| `[^`]+` \|", f"| Current task state | {tick}in_progress{tick} |"), (r"\| Parent manifest \| `[^`]+` \|", f"| Parent manifest | {tick}tests/golden/{parent}/manifest.json{tick} |"), (r"\| Current task card \| `[^`]+` \|", f"| Current task card | {tick}docs/tasks/{task}.md{tick} |"), (r"\| Current task-context nextTask \| `[^`]+` \|", f"| Current task-context nextTask | {tick}{next_task}{tick} |"), (r"\| Focused command \| `[^`]+` \|", f"| Focused command | {tick}node tools/web/run-wbv2-module-task.mjs --task {task} --write{tick} |"), ] for pattern, replacement in substitutions: text = re.sub(pattern, replacement, text, count=1) return text def make_card(task: str, parent: str, status: str, batch: dict, entrypoint: str) -> str: if task.endswith("-000"): return f"""# {task}: authorize module batch - task: {task} - parent: {parent} - status: {status} - gap: capability:{batch['moduleId']} - ownerFamily: {batch['owner']} - targetImplementationClass: QUEUE_ONLY - Implementation entrypoint: `{entrypoint}` ## 目标 授权一个共享 Blender Main/WASM/Chromium 功能批次:{batch['moduleId']},共 {len(batch['identifiers']) + len(batch['rna'])} 个源码/RNA 单元。 ## 输入与范围 - Blender source: `blender-5.2.0/source/blender` - Fixture/test: `{batch['fixture']}`, `{batch['test']}` ## 验收 - prior evidence and dynamic inventory remain hash-bound and immutable - one shared function chain validates the complete selected batch - missing source, unsupported data, hash drift or false completion remains blocked - `node tools/web/check-task-context.mjs --task {task} --write` ## 交付与回滚 - Manifest: `tests/golden/{task}/manifest.json` - Status: `docs/status/{task}.md` - Rollback: restore {parent} as queue parent. """ if len(batch["identifiers"]) + len(batch["rna"]) > 16: return f"""# {task}: {batch['title']} - task: {task} - parent: {parent} - status: {status} - gap: capability:{batch['moduleId']} - ownerFamily: {batch['owner']} - targetImplementationClass: LOCAL_EXACT - Implementation entrypoint: `{entrypoint}` ## 目标 使用一个共享 Blender Main/WASM/Worker/Chromium 链验证 {len(batch['identifiers'])} 个 modifier source 与 {len(batch['rna'])} 个 RNA unit,形成一个聚合 receipt。 ## 输入与范围 - Blender source family: `blender-5.2.0/source/blender` - Fixture: `{batch['fixture']}` - Chromium test: `{batch['test']}` - Unit selection: `{len(batch['identifiers']) + len(batch['rna'])} units`(完整列表只在 module plan/manifest) ## 验收 - one shared function chain covers every selected unit exactly once - malformed input, unsupported data and hash drift fail closed without Main mutation - save/reopen, deterministic second read and Chromium evidence are exact - `node tools/web/check-task-context.mjs --task {task} --write` ## 失败边界 - partial batch success never advances or claims omitted units - existing source/receipt hashes are reused; historical inventory remains read-only ## 交付与回滚 - Aggregate receipt: `tests/golden/{task}/module-receipt.json` - Production evidence: `tests/golden/{task}/modifier-reader-batch-production.json` - Manifest: `tests/golden/{task}/manifest.json` - Rollback: restore {parent} as queue parent. """ names = ", ".join(batch["identifiers"]) units = ", ".join(f"`modifier-source:{name}`" for name in batch["identifiers"]) rna_units = ", ".join(f"`rna-struct:{name}`" for name in batch["rna"]) return f"""# {task}: {batch['title']} - task: {task} - parent: {parent} - status: {status} - gap: capability:{batch['moduleId']} - ownerFamily: {batch['owner']} - targetImplementationClass: LOCAL_EXACT - Implementation entrypoint: `{entrypoint}` ## 目标 以一个共享 Blender Main reader、WASM build、Worker 路由和 Chromium receipt 批量验证 {names} 的真实 modifier/RNA 元数据。 ## 输入与范围 - Blender modifier sources: `blender-5.2.0/source/blender/modifiers/intern/` - RNA source: `blender-5.2.0/source/blender/makesrna/intern/rna_modifier.cc` - Native reader: `blender-5.2.0/source/blender/web_engine/web_engine_blend_reader.cpp` - Fixture: `{batch['fixture']}` - Chromium test: `{batch['test']}` - Selected modifier units: {units} - Selected RNA units: {rna_units} ## 验收 - one shared Main/WASM/Worker/Chromium chain observes every selected type - malformed input is rejected without Main mutation - save/reopen and deterministic second read are exact - only Chromium is used; JS simulation and per-API duplicate workers are forbidden - each selected source unit receives an explicit hash-bound coverage binding - `node tools/web/check-task-context.mjs --task {task} --write` ## 失败边界 - any missing source, unsupported type, hash drift, malformed data or non-exact recovery keeps the batch `in_progress`/`blocked` - partial batch success never claims the omitted family; historical inventory remains read-only ## 交付与回滚 - Receipt: `tests/golden/{task}/module-receipt.json` - Aggregate production evidence: `tests/golden/{task}/modifier-reader-batch-production.json` - Manifest: `tests/golden/{task}/manifest.json` - Status: `docs/status/{task}.md` - Rollback: restore {parent} as queue parent without rewriting prior evidence. """ def select_batch(inventory: dict) -> dict: units = {unit.get("identifier"): unit for unit in inventory.get("units", []) if isinstance(unit, dict) and unit.get("coverageStatus") != "VERIFIED"} for candidate in PREFERRED_BATCHES: selected = [units.get(name) for name in candidate["identifiers"] + candidate["rna"]] if all(selected): return {**candidate, "units": selected} raise SystemExit("no configured unresolved Blender source batch remains") def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--write", action="store_true") args = parser.parse_args() current = current_task() parent_path = queue_parent() current_manifest_path = ROOT / "tests/golden" / current / "manifest.json" current_manifest = read_json(current_manifest_path) index = read_json(INDEX) plan_path = ROOT / index["source"]["path"] plan = json.loads(plan_path.read_text(encoding="utf-8")) terminal = current_manifest.get("status") == "done" and current_manifest.get("nextTask") is None and index.get("activeTask") is None if not terminal and not current_manifest.get("nextTask"): raise SystemExit(f"current task is not terminal: {current}") phase = max(int(item["id"].split("-")[1][1:]) for item in plan["tasks"]) + 1 root_task, module_task = f"WBV2-P{phase}-000", f"WBV2-P{phase}-001" inventory = read_json(CONTROL_ROOT / "dynamic-inventory.json") batch = select_batch(inventory) if not args.write: print(json.dumps({"status": "ready", "rootTask": root_task, "nextTask": module_task, "moduleId": batch["moduleId"], "batchSize": len(batch["units"]), "sourceUnits": [unit["id"] for unit in batch["units"]]}, ensure_ascii=False)) return 0 current_status = ROOT / "docs/status" / f"{current}.md" if current_status.is_file(): status_text = re.sub(r"- nextTask: `[^`]+`", f"- nextTask: `{root_task}`", current_status.read_text(encoding="utf-8")) write_text(current_status, status_text) current_manifest["nextTask"] = root_task if isinstance(current_manifest.get("artifacts"), dict) and isinstance(current_manifest["artifacts"].get("status"), dict): current_manifest["artifacts"]["status"]["sha256"] = sha(current_status) write_json(current_manifest_path, current_manifest) source_paths = [unit["locations"][0]["path"] for unit in batch["units"]] source_paths += ["blender-5.2.0/source/blender/web_engine/web_engine_blend_reader.cpp", batch["test"], batch["fixture"], "web/app/src/vendor/blender/web_engine.wasm"] commands = [ "source tools/web/emscripten-env.sh && cmake --build build_web_blender6 --target web_engine -- -j8 && cp build_web_blender6/bin/web_engine.wasm web/app/src/vendor/blender/web_engine.wasm && cp build_web_blender6/bin/web_engine.wasm web/app/public/vendor/blender/web_engine.wasm", "npm --prefix web run typecheck", "npm --prefix web run build", f"WBV2_BATCH_TASK={module_task} WBV2_BATCH_FIXTURE={batch['fixture']} WBV2_BATCH_TYPES='{json.dumps(batch['types'], separators=(',', ':'))}' WBV2_BATCH_UNITS='{json.dumps([unit['id'] for unit in batch['units']], separators=(',', ':'))}' WEB_TEST_PORT=5371 npm --prefix web run test:e2e -- --workers=1 tests/e2e/{Path(batch['test']).name}", ] root_record = {"id": root_task, "phase": str(phase), "title": "authorize_modifier_reader_batch", "kind": "enabling", "owner": "PROGRAM", "dependsOn": [current], "parityId": None, "implementationClass": "QUEUE_ONLY", "parallelGroup": f"module-root-{phase}", "gate": "MODULE", "card": f"docs/tasks/{root_task}.md", "behavior": "Authorize one shared source-backed modifier reader batch.", "outputs": ["successor authorization", "module plan", "manifest", "status"], "acceptance": ["prior evidence remains hash-bound", "batch source mapping is explicit", "inventory remains source-derived"], "commands": ["node tools/web/check-execution-control-plane.mjs"], "status": "done", "ready": False, "queueMutationAllowed": True} module_record = {"id": module_task, "phase": str(phase), "title": batch["title"], "kind": "module", "owner": batch["owner"], "dependsOn": [root_task], "parityId": batch["moduleId"], "implementationClass": "LOCAL_EXACT", "parallelGroup": f"module-{batch['moduleId'].lower()}", "gate": "MODULE", "card": f"docs/tasks/{module_task}.md", "behavior": f"Verify the {batch['moduleId']} batch through Blender Main, WASM and Chromium recovery.", "outputs": ["aggregate module receipt", "coverage bindings", "manifest", "status"], "acceptance": ["source and protocol hashes are bound", "every selected Main reader type is proven", "negative no-mutation and recovery are proven", "Chromium and save/reopen evidence are exact"], "status": "in_progress", "ready": True, "queueMutationAllowed": True, "module": {"moduleId": batch["moduleId"], "sourceBacked": True, "capabilities": [f"CAP-{batch['moduleId']}-READER", f"CAP-{batch['moduleId']}-RECOVERY", f"CAP-{batch['moduleId']}-FAIL-CLOSED"], "sourcePaths": source_paths, "reuseReceipts": [{"manifest": "tests/golden/WBV2-P1107-000/manifest.json", "report": "tests/golden/WBV2-P1107-000/module-receipt.json"}], "positive": [f"{name} type is read from Blender Main" for name in batch["identifiers"]] + ["shared RNA metadata is preserved", "save/reopen preserves the batch metadata"], "negative": ["malformed blend is rejected without Main mutation", "unsupported batch data fails closed", "non-finite metadata is not synthesized"], "recovery": ["save/reopen", "worker termination", "deterministic second read"], "commands": commands, "fullFamilyParity": False, "evidencePaths": [batch["production"].format(task=module_task)], "coverageBindings": [unit["id"] for unit in batch["units"]]}} root_out = CONTROL_ROOT.parent / root_task root_plan_path = root_out / "module-execution-plan.json" root_plan = {**plan, "planId": f"BLENDER_WEB_MODULE_EXECUTION_P{phase}", "status": "ACTIVE_MODULE_QUEUE", "tasks": [*plan["tasks"], root_record, module_record], "modules": [*plan.get("modules", []), {"id": batch["moduleId"], "task": module_task, "owner": batch["owner"], "sourceBacked": True, "capabilities": module_record["module"]["capabilities"], "sourcePaths": source_paths, "reuseReceipts": module_record["module"]["reuseReceipts"], "fullFamilyParity": False}]} write_json(root_plan_path, root_plan) root_card_path, module_card_path = ROOT / "docs/tasks" / f"{root_task}.md", ROOT / "docs/tasks" / f"{module_task}.md" write_text(root_card_path, make_card(root_task, current, "done", batch, f"python3 my-tools/authorize_next_wbv2_task.py --write")) write_text(module_card_path, make_card(module_task, root_task, "in_progress", batch, f"node tools/web/run-wbv2-module-task.mjs --task {module_task} --write")) root_report_path, root_status_path, root_manifest_path = root_out / "successor-authorization-report.json", ROOT / "docs/status" / f"{root_task}.md", root_out / "manifest.json" write_json(root_report_path, {"schemaVersion": 1, "task": root_task, "operation": "AUTHORIZE_SOURCE_BACKED_MODULE_BATCH", "taskClass": "QUEUE_ENABLEMENT", "status": "PASS", "parent": {"task": current, "manifest": rel(current_manifest_path), "manifestSha256": sha(current_manifest_path)}, "module": {"moduleId": batch["moduleId"], "task": module_task, "batchSize": len(batch["units"]), "sourceUnits": [unit["id"] for unit in batch["units"]], "sourceBacked": True}, "inventory": {"unitCount": inventory["summary"]["unitCount"], "verifiedUnits": inventory["coverage"]["verifiedUnits"], "unverifiedUnits": inventory["coverage"]["unverifiedUnits"], "sourceTreeSha256": inventory["authority"]["sourceTreeSha256"], "boundUnitDelta": 0}, "nextTask": module_task}) write_text(root_status_path, f"# {root_task} status\n\n- task: `{root_task}`; parent: `{current}`; status: `done`\n- taskClass: `QUEUE_ENABLEMENT`; no modifier-family parity completion claimed\n- source-backed batch authorized: `{batch['moduleId']}` ({len(batch['units'])} units)\n- dynamic inventory: `{inventory['summary']['unitCount']}` units; verified `{inventory['coverage']['verifiedUnits']}`; unverified `{inventory['coverage']['unverifiedUnits']}`; bound delta `0`\n- nextTask: `{module_task}`\n") write_json(root_manifest_path, {"schemaVersion": 1, "task": root_task, "parentTask": current, "operation": "AUTHORIZE_SOURCE_BACKED_MODULE_BATCH", "status": "done", "enablingTask": True, "parityStateChange": False, "runtime": "MODULE_EXECUTION_QUEUE_BRIDGE", "artifacts": {"parentManifest": {"path": rel(current_manifest_path), "sha256": sha(current_manifest_path)}, "plan": {"path": rel(root_plan_path), "sha256": sha(root_plan_path)}, "report": {"path": rel(root_report_path), "sha256": sha(root_report_path)}, "status": {"path": rel(root_status_path), "sha256": sha(root_status_path)}}, "assertions": {"sourceBackedSuccessor": True, "moduleId": batch["moduleId"], "batchSize": len(batch["units"]), "inventoryTotal": 6900, "effectiveCompleted": 290, "effectivePending": 6609, "dynamicUnitCount": inventory["summary"]["unitCount"], "dynamicVerifiedUnits": inventory["coverage"]["verifiedUnits"], "dynamicUnverifiedUnits": inventory["coverage"]["unverifiedUnits"], "boundUnitDelta": 0, "fullHistoricalReproduction": False}, "nextTask": module_task}) run_node("tools/web/generate-v2-task-index.mjs", "--plan-path", rel(root_plan_path)) queue_text = QUEUE.read_text(encoding="utf-8") queue_text = re.sub(r"\| 当前任务 \| `[^`]+` \|", f"| 当前任务 | `{module_task}` |", queue_text, count=1) queue_text = re.sub(r"\| parent manifest \| `[^`]+` \|", f"| parent manifest | `tests/golden/{root_task}/manifest.json` |", queue_text, count=1, flags=re.IGNORECASE) queue_text = re.sub(r"\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|", f"| 任务卡 | [`tasks/{module_task}.md`](tasks/{module_task}.md) |", queue_text, count=1) write_text(QUEUE, queue_text) next_path = ROOT / "nextTask.md" if next_path.is_file(): write_text(next_path, snapshot(next_path.read_text(encoding="utf-8"), module_task, root_task, "NONE")) # Do not rerun the legacy hard-coded reconciliation here: it would discard # newer explicit bindings produced by completed module batches. The active # module's binder owns the incremental inventory update. # The root is a completed queue-enable record. Preparing its context again # wastes budget and can fail solely because the parent manifest grew; only # the active implementation batch needs a packet. run_node("tools/web/check-task-context.mjs", "--task", module_task, "--write") print(f"wbv2-successor-authorized root={root_task} next={module_task} module={batch['moduleId']} batchSize={len(batch['units'])} inventoryDelta=0") return 0 if __name__ == "__main__": raise SystemExit(main())