Files
cleveragents-core/features/plan_execution_context_coverage_boost.feature
CoreRasurae 8548644819 fix(cli): wire SubplanExecutionService in _get_plan_executor() to enable child plan execution
Wire subplan_service from the DI container into _get_plan_executor() so
PlanExecutor can spawn child plans during the Execute phase.  When
SubplanService is available but SubplanExecutionService is not explicitly
injected, _execute_subplans() now lazily creates a SubplanExecutionService
on-the-fly using the parent plan's subplan_config and the new
_execute_child_plan callback.

- _get_plan_executor(): retrieve subplan_service from container, pass to
  PlanExecutor constructor
- _execute_subplans(): lazily build SubplanExecutionService when only
  SubplanService is wired (Forgejo #10268)
- _execute_child_plan(): new PlanExecutor method that runs a child plan's
  strategize + execute phases, registered as executor_fn callback

ISSUES CLOSED: #10268
2026-05-19 19:28:35 +01:00

69 lines
3.7 KiB
Gherkin

@coverage @context
Feature: PlanExecutionContext coverage boost
As a developer
I want complete coverage of PlanExecutionContext and RuntimeExecuteActor
So that all uncovered lines in plan_execution_context.py are exercised
Scenario: PlanExecutionContext rejects empty plan_id
Given a pec fresh context
When I pec construct PlanExecutionContext with empty plan_id
Then a pec ValidationError should be raised with "plan_id must not be empty"
Scenario: PlanExecutionContext properties return configured values
Given a pec PlanExecutionContext with all optional fields set
Then pec the automation_profile property should return the configured value
And pec the plan_env property should return the configured value
And pec the project_env property should return the configured value
And pec the project_resources property should return the configured dict
And pec the resource_bindings property should return the configured dict
And pec the changeset_store property should return the configured store
And pec the active_changeset_ids property should return a list
Scenario: record_change raises PlanError when no changeset is active
Given a pec PlanExecutionContext with a valid plan_id
When I pec call record_change without starting a changeset
Then a pec PlanError should be raised about no active changeset
Scenario: get_changeset returns None for unknown changeset
Given a pec PlanExecutionContext with a valid plan_id
When I pec call get_changeset with a nonexistent changeset_id
Then pec the result should be None
Scenario: summarize returns metadata for execution context
Given a pec PlanExecutionContext with a valid plan_id
When I pec call summarize on the execution context
Then pec the summary should contain plan_id and decision_root_id
And pec the summary should contain counts for resources and bindings
Scenario: RuntimeExecuteActor rejects None tool_runner
Given a pec valid PlanExecutionContext
When I pec construct RuntimeExecuteActor with None tool_runner
Then a pec ValidationError should be raised with "tool_runner must not be None"
Scenario: RuntimeExecuteActor rejects None execution_context
Given a pec mock ToolRunner
When I pec construct RuntimeExecuteActor with None execution_context
Then a pec ValidationError should be raised with "execution_context must not be None"
Scenario: RuntimeExecuteActor properties return configured values
Given a pec RuntimeExecuteActor with valid tool_runner and execution_context
Then pec the tool_runner property should return the configured ToolRunner
And pec the execution_context property should return the configured PlanExecutionContext
Scenario: RuntimeExecuteActor execute with stream callback produces events
Given a pec RuntimeExecuteActor with valid tool_runner and execution_context with sandbox_root
And a pec stream event collector
When I pec execute with decisions and stream callback
Then pec the stream events should include "runtime_execute_started"
And pec the stream events should include "runtime_execute_complete"
Scenario: RuntimeExecuteActor execute without stream callback still works
Given a pec RuntimeExecuteActor with valid tool_runner and execution_context
When I pec execute with decisions and no stream callback
Then pec the result should be a RuntimeExecuteResult with a valid changeset_id
Scenario: RuntimeExecuteActor execute with sandbox_root populates sandbox_refs
Given a pec RuntimeExecuteActor with valid tool_runner and execution_context with sandbox_root
When I pec execute with decisions and no stream callback
Then pec the result sandbox_refs should include the sandbox_root