forked from HAL9000/cleveragents-core
64 lines
2.9 KiB
Gherkin
64 lines
2.9 KiB
Gherkin
Feature: PlanExecutor Coverage Boost
|
|
Additional scenarios that exercise previously uncovered code paths
|
|
in plan_executor.py, targeting lines 328-335, 384, 422, 458,
|
|
598-599, 612, and 619.
|
|
|
|
Background:
|
|
Given the plan executor module is imported
|
|
|
|
# --- _try_emit_metric success path (lines 328-330) ---
|
|
|
|
Scenario: _try_emit_metric emits a metric when emitter is configured
|
|
Given a PlanExecutor with a mock metrics emitter
|
|
When I trigger metric emission with a valid key and value
|
|
Then the metrics emitter should have received exactly one entry
|
|
|
|
# --- _try_emit_metric exception path (lines 331-335) ---
|
|
|
|
Scenario: _try_emit_metric silently handles emission failure
|
|
Given a PlanExecutor with a failing metrics emitter
|
|
When I trigger metric emission that causes an exception
|
|
Then no exception should propagate from metric emission
|
|
|
|
# --- _try_create_checkpoint returns None when sandbox is None (line 384) ---
|
|
|
|
Scenario: _try_create_checkpoint returns None when no sandbox is resolvable
|
|
Given a PlanExecutor with a checkpoint manager but no sandbox source
|
|
When I attempt to create a plan executor checkpoint
|
|
Then the checkpoint result should be None
|
|
|
|
# --- _try_rollback_to_last_checkpoint returns False when sandbox is None (line 422) ---
|
|
|
|
Scenario: _try_rollback_to_last_checkpoint returns False when no sandbox is resolvable
|
|
Given a PlanExecutor with a checkpoint manager but no sandbox source
|
|
When I attempt to rollback to the last checkpoint
|
|
Then the rollback result should be False
|
|
|
|
# --- _resolve_sandbox_for_checkpoint via execution_context (line 458) ---
|
|
|
|
Scenario: _resolve_sandbox_for_checkpoint returns sandbox from execution context
|
|
Given a PlanExecutor with an execution context that has a sandbox manager
|
|
When I resolve a sandbox for checkpointing
|
|
Then the resolved sandbox should come from the execution context
|
|
|
|
# --- _enforce_guardrails raises PlanError on step limit (lines 598-599) ---
|
|
|
|
Scenario: _enforce_guardrails raises PlanError when step limit is already reached
|
|
Given a PlanExecutor with a guardrail service that blocks step limit
|
|
When I enforce guardrails for a plan
|
|
Then a PlanError about step limit should be raised
|
|
|
|
# --- _enforce_guardrails_per_step returns when guardrails is None (line 612) ---
|
|
|
|
Scenario: _enforce_guardrails_per_step returns early when guardrails is None
|
|
Given a PlanExecutor with a guardrail service that returns no guardrails
|
|
When I enforce per-step guardrails
|
|
Then no exception should be raised from per-step enforcement
|
|
|
|
# --- _enforce_guardrails_per_step raises PlanError on wall-clock (line 619) ---
|
|
|
|
Scenario: _enforce_guardrails_per_step raises PlanError when wall-clock exceeded
|
|
Given a PlanExecutor with a guardrail service that blocks wall-clock per step
|
|
When I enforce per-step guardrails expecting wall-clock error
|
|
Then a PlanError about wall-clock limit should be raised from per-step
|