fix(web): recover native geometry batches after fixture crashes
This commit is contained in:
@@ -434,7 +434,7 @@ def native_geometry_batch(inventory: dict) -> dict | None:
|
||||
and unit.get("coverageStatus") != "VERIFIED"
|
||||
and unit.get("kind") == "node"
|
||||
and isinstance(unit.get("identifier"), str)
|
||||
and unit["identifier"].startswith("GeometryNode")
|
||||
and (unit["identifier"].startswith("GeometryNode") or unit["identifier"].startswith("FunctionNode"))
|
||||
]
|
||||
if not candidates:
|
||||
return None
|
||||
@@ -461,6 +461,29 @@ def native_geometry_batch(inventory: dict) -> dict | None:
|
||||
}
|
||||
|
||||
|
||||
def prepare_native_fixture(batch: dict, task: str, contract: dict) -> dict:
|
||||
"""Generate a native fixture, shrinking only when Blender rejects a mix."""
|
||||
if not (batch.get("nativeCompositorFixture") or batch.get("nativeGeometryFixture")):
|
||||
return contract
|
||||
while True:
|
||||
try:
|
||||
if batch.get("nativeCompositorFixture"):
|
||||
ensure_native_compositor_fixture(batch, contract)
|
||||
else:
|
||||
ensure_native_geometry_fixture(batch, contract)
|
||||
return contract
|
||||
except SystemExit:
|
||||
units = list(batch.get("units", []))
|
||||
if len(units) <= 1:
|
||||
raise
|
||||
units = units[: max(1, len(units) // 2)]
|
||||
batch["units"] = units
|
||||
batch["identifiers"] = [unit["identifier"] for unit in units]
|
||||
batch["types"] = [unit["identifier"] for unit in units]
|
||||
batch.pop("fixture", None)
|
||||
contract = batch_contract(task, batch)
|
||||
|
||||
|
||||
def recover_blocked_native_batch(current: str, index: dict, plan: dict, inventory: dict) -> bool:
|
||||
"""Shrink one failed auto-native batch to the last proven fixture shape.
|
||||
|
||||
@@ -856,12 +879,13 @@ def main() -> int:
|
||||
digest = contract["batchId"].rsplit(":", 1)[-1]
|
||||
batch["fixture"] = f"tests/files/web/generated/wbv2-compositor-{digest}.blend"
|
||||
if args.write:
|
||||
ensure_native_compositor_fixture(batch, contract)
|
||||
contract = prepare_native_fixture(batch, module_task, contract)
|
||||
if batch.get("nativeGeometryFixture"):
|
||||
digest = contract["batchId"].rsplit(":", 1)[-1]
|
||||
batch["fixture"] = f"tests/files/web/generated/wbv2-geometry-{digest}.blend"
|
||||
if args.write:
|
||||
ensure_native_geometry_fixture(batch, contract)
|
||||
contract = prepare_native_fixture(batch, module_task, contract)
|
||||
batch["batchId"] = contract["batchId"]
|
||||
write_planner_status({
|
||||
"status": "ready",
|
||||
"reason": "source_backed_batch_selected",
|
||||
|
||||
Reference in New Issue
Block a user