From a6dd470623060234d6ee8636a84a7b57828207a8 Mon Sep 17 00:00:00 2001 From: gilesb Date: Sun, 11 Jan 2026 20:21:24 +0000 Subject: [PATCH] Fix recipe steps display and DAG visualization - Check multiple locations for nodes: dag.nodes, recipe.nodes, pipeline, steps - Add dagre layout libraries for cytoscape DAG visualization - Fix inputs parsing when stored as JSON string in Redis Co-Authored-By: Claude Opus 4.5 --- app/routers/recipes.py | 10 +++++++++- app/services/run_service.py | 6 ++++++ app/templates/recipes/detail.html | 2 ++ app/templates/runs/detail.html | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/routers/recipes.py b/app/routers/recipes.py index 1ba844f..a0ad98e 100644 --- a/app/routers/recipes.py +++ b/app/routers/recipes.py @@ -155,10 +155,18 @@ async def get_recipe( "output": "#f59e0b", } - # Get nodes from dag - can be list or dict + # Get nodes from dag - can be list or dict, can be under "dag" or directly on recipe dag = recipe.get("dag", {}) nodes = dag.get("nodes", []) + # Also check for nodes directly on recipe (alternative formats) + if not nodes: + nodes = recipe.get("nodes", []) + if not nodes: + nodes = recipe.get("pipeline", []) + if not nodes: + nodes = recipe.get("steps", []) + # Convert list of nodes to steps format if isinstance(nodes, list): for node in nodes: diff --git a/app/services/run_service.py b/app/services/run_service.py index 9b514e7..63892d5 100644 --- a/app/services/run_service.py +++ b/app/services/run_service.py @@ -114,6 +114,12 @@ class RunService: task_actor_id = parsed.get("actor_id") task_recipe = parsed.get("recipe") task_inputs = parsed.get("inputs") + # Ensure inputs is a list (might be JSON string) + if isinstance(task_inputs, str): + try: + task_inputs = json.loads(task_inputs) + except json.JSONDecodeError: + task_inputs = None task_output_name = parsed.get("output_name") task_created_at = parsed.get("created_at") except json.JSONDecodeError: diff --git a/app/templates/recipes/detail.html b/app/templates/recipes/detail.html index 23255c8..c52b161 100644 --- a/app/templates/recipes/detail.html +++ b/app/templates/recipes/detail.html @@ -5,6 +5,8 @@ {% block head %} {{ super() }} + + {% endblock %} {% block content %} diff --git a/app/templates/runs/detail.html b/app/templates/runs/detail.html index f080606..99998e2 100644 --- a/app/templates/runs/detail.html +++ b/app/templates/runs/detail.html @@ -5,6 +5,8 @@ {% block head %} {{ super() }} + + {% endblock %} {% block content %}