Remove YAML support - S-expressions only
- Recipe service now only handles S-expressions - Removed yaml import and all YAML parsing code - Plans are just node outputs - cached by content hash - Run service looks up plans from cache, falls back to legacy dir Code is data. Everything is S-expressions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -481,14 +481,36 @@ class RunService:
|
||||
return True, None
|
||||
|
||||
async def get_run_plan(self, run_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get execution plan for a run."""
|
||||
# Prefer S-expression plan
|
||||
"""Get execution plan for a run.
|
||||
|
||||
Plans are just node outputs - cached by content hash like everything else.
|
||||
"""
|
||||
# Get run to find plan_cache_id
|
||||
run = await self.get_run(run_id)
|
||||
if not run:
|
||||
return None
|
||||
|
||||
plan_cache_id = run.get("plan_cache_id")
|
||||
if plan_cache_id:
|
||||
# Get plan from cache by content hash
|
||||
plan_path = self.cache.get_by_content_hash(plan_cache_id)
|
||||
if plan_path and plan_path.exists():
|
||||
with open(plan_path) as f:
|
||||
content = f.read()
|
||||
# Detect format
|
||||
if content.strip().startswith("("):
|
||||
return {"sexp": content, "format": "sexp"}
|
||||
else:
|
||||
plan = json.loads(content)
|
||||
plan["format"] = "json"
|
||||
return plan
|
||||
|
||||
# Fall back to legacy plans directory
|
||||
sexp_path = self.cache_dir / "plans" / f"{run_id}.sexp"
|
||||
if sexp_path.exists():
|
||||
with open(sexp_path) as f:
|
||||
return {"sexp": f.read(), "format": "sexp"}
|
||||
|
||||
# Fall back to JSON for legacy plans
|
||||
json_path = self.cache_dir / "plans" / f"{run_id}.json"
|
||||
if json_path.exists():
|
||||
with open(json_path) as f:
|
||||
@@ -500,10 +522,9 @@ class RunService:
|
||||
|
||||
async def get_run_plan_sexp(self, run_id: str) -> Optional[str]:
|
||||
"""Get execution plan as S-expression string."""
|
||||
sexp_path = self.cache_dir / "plans" / f"{run_id}.sexp"
|
||||
if sexp_path.exists():
|
||||
with open(sexp_path) as f:
|
||||
return f.read()
|
||||
plan = await self.get_run_plan(run_id)
|
||||
if plan and plan.get("format") == "sexp":
|
||||
return plan.get("sexp")
|
||||
return None
|
||||
|
||||
async def get_run_artifacts(self, run_id: str) -> List[Dict[str, Any]]:
|
||||
|
||||
Reference in New Issue
Block a user