@@ -116,6 +116,11 @@ def run_graph(
116116 recipe : str = typer .Option (..., "--recipe" , help = "Recipe name" ),
117117 config : Optional [Path ] = typer .Option (None , "--config" ),
118118 resume_run : Optional [str ] = typer .Option (None , "--resume" , help = "Resume run_id" ),
119+ strict_validate : bool = typer .Option (
120+ False ,
121+ "--strict-validate/--no-strict-validate" ,
122+ help = "Validate each step against resolved handler schema before execution" ,
123+ ),
119124):
120125 cfg = load_config (config )
121126 root = repo_root ()
@@ -135,6 +140,27 @@ def run_graph(
135140 cp = Checkpointer (
136141 root / "orchestrator" / ".orchestrator" / "checkpoints" / "cp.sqlite"
137142 )
143+ # Optional strict validation using the handler registry
144+ if strict_validate :
145+ from .engine .registry import HandlerRegistry
146+
147+ reg = HandlerRegistry ()
148+ ok = True
149+ for i , step in enumerate (recipe_data .get ("steps" , []), start = 1 ):
150+ try :
151+ h , args = reg .route_compat (step )
152+ handler = reg .resolve (h )
153+ if not handler :
154+ typer .secho (f"step { i } : handler { h } not found" , fg = typer .colors .RED )
155+ ok = False
156+ continue
157+ reg .validate_args (handler , args )
158+ except Exception as e :
159+ typer .secho (f"step { i } : { e } " , fg = typer .colors .RED )
160+ ok = False
161+ if not ok :
162+ raise typer .Exit (1 )
163+
138164 g = compile_recipe_to_graph (recipe_data )
139165 with MCPRuntime (odoo_cmd = odoo_cmd , tm_cmd = tm_cmd , repo_root = root ) as mcp :
140166 execg = GraphExecutor (cfg , logger , root , mcp , cp )
0 commit comments