优化engine
This commit is contained in:
@@ -105,15 +105,13 @@ def validate_cdsl(cdsl: dict[str, Any], engine: Any) -> None:
|
||||
if not fid or fid in feature_ids:
|
||||
raise ValueError("Feature ids must be unique")
|
||||
feature_ids.add(fid)
|
||||
if feature.get("execution_status") not in (None, "supported"):
|
||||
raise ValueError(f"Feature {fid} is deferred and cannot be rebuilt by the current engine")
|
||||
if str(feature.get("sketch_id") or "") not in sketch_ids:
|
||||
raise ValueError(f"Feature {fid} refers to a missing sketch")
|
||||
atomic_id = str(feature.get("atomic_id") or "")
|
||||
if not atomic_id:
|
||||
raise ValueError(f"Feature {fid} has no atomic_id")
|
||||
contract = atomic_contracts.get(atomic_id)
|
||||
if atomic_id not in supported_atomic_ids or not isinstance(contract, dict):
|
||||
if feature.get("execution_status") == "deferred":
|
||||
raise ValueError(f"Feature {fid} is deferred and cannot be rebuilt by the current engine")
|
||||
raise ValueError(
|
||||
f"Unsupported CDSL atomic_id: {atomic_id}. Supported: {', '.join(supported_atomic_ids)}"
|
||||
)
|
||||
@@ -145,9 +143,15 @@ def validate_cdsl(cdsl: dict[str, Any], engine: Any) -> None:
|
||||
elif profile_type not in engine.SHAPE_GENERATORS:
|
||||
raise ValueError(f"Unsupported CDSL profile: {profile_type}")
|
||||
try:
|
||||
engine.compile_cdsl(copy.deepcopy(cdsl))
|
||||
analysis = engine.analyze_cdsl(copy.deepcopy(cdsl))
|
||||
except Exception as error:
|
||||
raise ValueError(f"CDSL engine compile preflight failed: {error}") from error
|
||||
raise ValueError(f"CDSL engine runtime preflight failed: {error}") from error
|
||||
if not analysis.runtime_eligible:
|
||||
first = next((result for result in analysis.feature_results if not result.executable), None)
|
||||
if first is None:
|
||||
raise ValueError(f"CDSL engine runtime preflight failed: {analysis.document_blockers[0].code}")
|
||||
blockers = ", ".join(blocker.code for blocker in first.blockers)
|
||||
raise ValueError(f"CDSL engine runtime preflight failed: feature {first.feature_id}: {blockers}")
|
||||
|
||||
|
||||
def _parameter_id(path: list[str]) -> str:
|
||||
@@ -355,7 +359,10 @@ def build_revision(
|
||||
write_json(parameters_path, contract)
|
||||
|
||||
try:
|
||||
engine_result = engine.run_rebuild(cdsl_copy, step_path)
|
||||
# Product revisions are semantic CDSL artifacts. Do not route them
|
||||
# through the legacy rebuild entry point, which is allowed to use
|
||||
# compiler_context/translator compatibility fallbacks.
|
||||
engine_result = engine.run_cdsl_only(cdsl_copy, step_path)
|
||||
if engine_result.get("engine") != "cdsl_only" or not step_path.is_file() or step_path.stat().st_size == 0:
|
||||
raise RuntimeError("Engine did not produce a CDSL-only STEP artifact")
|
||||
preview = step_to_glb(step_path, glb_path)
|
||||
|
||||
Reference in New Issue
Block a user