Feature: Decomposition respects max_child_depth limit
  As a plan orchestrator
  I want the decomposition service to enforce plan.max-child-depth
  So that child plans cannot nest deeper than the configured limit

  Background:
    Given a decomposition service

  Scenario: Decomposition stops recursing when max_child_depth limit is reached
    Given a project with 500 files across 8 directory levels
    When I decompose with max_child_depth 2 and max_depth 10
    Then the decomposition result should have max_depth_reached <= 2
    And the decomposition warning log should contain "max-child-depth limit"

  Scenario: Decomposition with default max_child_depth allows standard depth
    Given a project with 2000 files across 5 directory levels
    When I decompose with default max_child_depth
    Then the decomposition result should have max_depth_reached >= 1
    And the decomposition result should have max_depth_reached <= 5

  Scenario: max_child_depth guard triggers before max_depth when more restrictive
    Given a project with 500 files across 8 directory levels
    When I decompose with max_child_depth 1 and max_depth 10
    Then the decomposition result should have max_depth_reached <= 1
    And the decomposition warning log should contain "max-child-depth limit"

  Scenario: max_depth can be more restrictive than max_child_depth
    Given a project with 500 files across 8 directory levels
    When I decompose with max_child_depth 10 and max_depth 2
    Then the decomposition result should have max_depth_reached <= 2

  Scenario: Default config includes max_child_depth with expected value
    Given default decomposition config
    Then max_child_depth should be 5

  Scenario: Invalid max_child_depth value is rejected
    When I create a config with max_child_depth 0
    Then a decomposition ValueError should be raised
