Files
cleveragents-core/features/plan_execution_hierarchical_4phase.feature
T
CoreRasurae b98c99d93e
CI / push-validation (pull_request) Successful in 20s
CI / build (pull_request) Successful in 32s
CI / lint (pull_request) Successful in 37s
CI / helm (pull_request) Successful in 41s
CI / quality (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m7s
CI / security (pull_request) Successful in 1m25s
CI / unit_tests (pull_request) Successful in 6m37s
CI / docker (pull_request) Successful in 1m34s
CI / integration_tests (pull_request) Failing after 18m31s
CI / coverage (pull_request) Successful in 11m2s
CI / status-check (pull_request) Failing after 3s
test(integration): add BDD scenarios for full hierarchical plan 4-phase lifecycle execution
Adds BDD integration tests (Forgejo #10270) verifying that child plans
independently complete all four lifecycle phases: Strategize, Decompose,
Execute, and Validate.

Scenarios covered:
- Happy path: 2-level parent-child hierarchy with full phase execution
- Checkpoint: on_subplan_spawn checkpoint creation verification
- Max-child-depth: decomposition respects depth limits
- Aggregation: parent plan aggregates child results
- Failure handling: parent captures child plan failures
- Nested: 3-level grandchild hierarchy cascading

Uses real (non-mocked) service implementations in in-memory mode.

ISSUES CLOSED: #10270
2026-05-28 00:05:08 -04:00

86 lines
4.9 KiB
Gherkin

@subplan @plan_executor @integration @phase4 @tdd_issue @tdd_issue_10270
Feature: Plan hierarchy 4-phase lifecycle execution
As a system executing hierarchical plans
I want child plans to independently complete all 4 phases Strategize, Decompose, Execute, Validate
So that hierarchical decomposition produces fully executed, verifiable, and aggregated results
Background:
Given a plan lifecycle service with in-memory storage
And a DecisionService for recording spawn decisions
And a SubplanService backed by the DecisionService
# ------------------------------------------------------------------
# Happy path — 2-level hierarchy (Forgejo #10270)
# ------------------------------------------------------------------
Scenario: Parent plan with 2-level hierarchy executes all phases for parent and children
Given a parent plan "parent-happy" in Strategize phase with a spawn decision recorded
When I create two child plans for "parent-happy" and pre-register them in the lifecycle
And I strategize and execute the parent plan "parent-happy"
Then the parent plan Strategize phase should be complete
And the parent plan Execute phase should be complete
And each child plan should have completed Strategize phase
And each child plan should have completed Execute phase
And the parent plan should have 1 subplan statuses
And all child subplan statuses should indicate success
# ------------------------------------------------------------------
# Checkpoint triggers — on_subplan_spawn (Forgejo #10270)
# ------------------------------------------------------------------
Scenario: on_subplan_spawn checkpoint is created before first child execution
Given a parent plan "parent-checkpoint" in Strategize phase with a spawn decision recorded
And I create one child plan for "parent-checkpoint" and pre-register it in the lifecycle
And a CheckpointService is configured for the parent plan "parent-checkpoint"
When I strategize and execute the parent plan "parent-checkpoint"
Then at least one on_subplan_spawn checkpoint should have been created
# ------------------------------------------------------------------
# Max-child-depth enforcement (Forgejo #10270)
# ------------------------------------------------------------------
Scenario: Decomposition respects max-child-depth during execution
Given a decomposition service with max-child-depth 1
And a project with 100 files across 5 directory levels
When I decompose the project files with stored config
Then the decomposition result should have max_depth_reached <= 1
Scenario: Decomposition with default max-child-depth allows moderate nesting
Given a decomposition service with default config
And a project with 200 files across 5 directory levels
When I decompose the project files with stored config
Then the decomposition result should have max_depth_reached >= 1
# ------------------------------------------------------------------
# Child success aggregation (Forgejo #10270)
# ------------------------------------------------------------------
Scenario: Parent plan aggregates child subplan results after execution
Given a parent plan "parent-aggregate" in Strategize phase with two spawn decisions recorded
When I create two child plans for "parent-aggregate" and pre-register them in the lifecycle
And I strategize and execute the parent plan "parent-aggregate"
Then the parent plan should have subplan statuses with execution results
And the parent plan error_details should not contain failed_subplan_ids
# ------------------------------------------------------------------
# Child failure handling (Forgejo #10270)
# ------------------------------------------------------------------
Scenario: Parent plan captures child plan failure in error_details
Given a parent plan "parent-fail" in Strategize phase with a spawn decision recorded without action registration
When I strategize and execute the parent plan "parent-fail"
Then the parent plan error_details should have failed subplan ids
# ------------------------------------------------------------------
# Nested execution — 3-level hierarchy (Forgejo #10270)
# ------------------------------------------------------------------
Scenario: Grandchild plan in 3-level hierarchy executes and cascades results
Given a parent plan "parent-nested" in Strategize phase with a spawn decision recorded
And I create child plan "child-nested" for "parent-nested" with its own spawn decision recorded
And I create a grandchild plan for "child-nested" and pre-register it in the lifecycle
When I strategize and execute the parent plan "parent-nested"
Then the parent plan should have 1 subplan statuses
And the child plan should complete both Strategize and Execute phases
And the grandchild plan should complete both Strategize and Execute phases