@tdd_issue @tdd_issue_823 @mock_only
Feature: TDD Issue #823 — subplan spawn creates metadata but does not orchestrate child plan execution
  As a developer
  I want to verify that SubplanService.spawn() creates real child Plan
  domain objects and triggers their lifecycle progression
  So that the bug is captured and will be caught by a regression test

  SubplanService.spawn() currently creates SubplanStatus records and
  SpawnMetadata but does NOT create actual child Plan domain objects,
  trigger the strategize phase on child plans, set up inter-plan
  communication, merge results, or handle child plan failures.  These
  tests assert the expected behaviour and will FAIL until the bug is
  fixed.  The @tdd_expected_fail tag inverts the result so CI passes.

  @tdd_issue @tdd_issue_4289
  Scenario: Spawn result contains child Plan domain objects
    Given a parent plan configured for subplan spawning
    And valid spawn entries for the parent plan
    When I spawn subplans via SubplanService
    Then the spawn result should contain child Plan domain objects
    And each child Plan should have parent_plan_id set to the parent

  @tdd_issue @tdd_issue_4289
  Scenario: Child plans enter the strategize phase after spawn
    Given a parent plan configured for subplan spawning
    And valid spawn entries for the parent plan
    When I spawn subplans via SubplanService
    Then each child plan should be in the strategize phase
    And each child plan processing state should be queued

  @tdd_issue @tdd_issue_4289
  Scenario: Parent plan tracks child plan lifecycle status
    Given a parent plan configured for subplan spawning
    And valid spawn entries for the parent plan
    When I spawn subplans via SubplanService
    Then the parent plan subplan_statuses should reflect child lifecycle
    And the spawn result total_spawned should match child plan count
