From 996c6b16aff4e1f99bf6194eda8ca60434a8cf11 Mon Sep 17 00:00:00 2001 From: HAL 9000 Date: Sat, 9 May 2026 04:47:18 +0000 Subject: [PATCH] fix(ci): address lint violations and unit test updates for plan tree envelope (#9313) --- features/steps/plan_explain_steps.py | 7 ++++++- src/cleveragents/cli/commands/plan.py | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/features/steps/plan_explain_steps.py b/features/steps/plan_explain_steps.py index 52f66681a..a7d8c6c19 100644 --- a/features/steps/plan_explain_steps.py +++ b/features/steps/plan_explain_steps.py @@ -402,7 +402,12 @@ def step_roots_no_children(context: Context) -> None: @then("the json tree output should be valid json") def step_tree_json_valid(context: Context) -> None: parsed = json.loads(context.pe_tree_json) - assert isinstance(parsed, list), "Expected a JSON array" + assert isinstance(parsed, dict), ( + f"Expected JSON envelope (dict), got {type(parsed).__name__}" + ) + _ENVELOPE_KEYS = {"command", "status", "exit_code", "data", "timing", "messages"} + missing = _ENVELOPE_KEYS - set(parsed.keys()) + assert not missing, f"Envelope missing required fields: {missing}" @then('the json tree output should contain "{text}"') diff --git a/src/cleveragents/cli/commands/plan.py b/src/cleveragents/cli/commands/plan.py index a91c9950b..430a41abb 100644 --- a/src/cleveragents/cli/commands/plan.py +++ b/src/cleveragents/cli/commands/plan.py @@ -4154,9 +4154,7 @@ def tree_decisions_cmd( if fmt in (OutputFormat.JSON, OutputFormat.YAML): console.print( - format_output( - tree_data, fmt, command="plan tree", status="ok", exit_code=0 - ) + format_output(tree_data, fmt, command="plan tree", status="ok", exit_code=0) ) elif fmt == OutputFormat.TABLE: # Flatten for table view