Feature: Plan domain model coverage boost
  Exercise uncovered code paths in src/cleveragents/domain/models/core/plan.py
  that were identified with hits=0 in build/coverage.xml.

  # ---------------------------------------------------------------
  # Line 792: can_transition_to_next_phase returns True for ACTION
  # ---------------------------------------------------------------

  Scenario: ACTION phase plan can always transition to next phase
    Given a coverage-boost plan in the ACTION phase
    When I check whether the coverage-boost plan can transition to the next phase
    Then the coverage-boost transition check should return True

  # ---------------------------------------------------------------
  # Lines 867, 870: get_project_scope returns scope matched by alias
  # ---------------------------------------------------------------

  Scenario: get_project_scope resolves a scope by alias
    Given a coverage-boost plan with multi-project metadata containing aliased scopes
    When I look up the coverage-boost project scope by alias "api"
    Then the coverage-boost resolved scope project name should be "local/api-service"

  Scenario: get_project_scope resolves a scope by project name
    Given a coverage-boost plan with multi-project metadata containing aliased scopes
    When I look up the coverage-boost project scope by name "local/web-app"
    Then the coverage-boost resolved scope project name should be "local/web-app"

  Scenario: get_project_scope returns None when no match found
    Given a coverage-boost plan with multi-project metadata containing aliased scopes
    When I look up the coverage-boost project scope by name "local/nonexistent"
    Then the coverage-boost resolved scope should be None

  Scenario: get_project_scope returns None when multi-project metadata is absent
    Given a coverage-boost plan without multi-project metadata
    When I look up the coverage-boost project scope by name "local/anything"
    Then the coverage-boost resolved scope should be None

  # ---------------------------------------------------------------
  # Lines 893, 895: can_revert_to returns False for terminal states
  # ---------------------------------------------------------------

  Scenario: APPLIED plan cannot revert to any phase
    Given a coverage-boost plan in APPLY phase with APPLIED state
    When I check whether the coverage-boost plan can revert to STRATEGIZE
    Then the coverage-boost reversion check should return False

  Scenario: CANCELLED plan cannot revert to any phase
    Given a coverage-boost plan in APPLY phase with CANCELLED state
    When I check whether the coverage-boost plan can revert to STRATEGIZE
    Then the coverage-boost reversion check should return False

  Scenario: Plan that exhausted MAX_REVERSIONS cannot revert
    Given a coverage-boost plan that has used all allowed reversions
    When I check whether the coverage-boost plan can revert to STRATEGIZE
    Then the coverage-boost reversion check should return False

  Scenario: Plan below MAX_REVERSIONS with valid transition can revert
    Given a coverage-boost plan in EXECUTE phase with ERRORED state and zero reversions
    When I check whether the coverage-boost plan can revert to STRATEGIZE
    Then the coverage-boost reversion check should return True

  # ---------------------------------------------------------------
  # Lines 970-980: as_cli_dict includes scope alias, read_only, changeset_summary
  # ---------------------------------------------------------------

  Scenario: as_cli_dict includes multi-project scope alias and read_only
    Given a coverage-boost plan with multi-project scopes having alias and read-only flags
    When I generate the coverage-boost CLI dict
    Then the coverage-boost CLI dict multi_project scope should contain alias "api"
    And the coverage-boost CLI dict multi_project scope should contain read_only True

  Scenario: as_cli_dict includes multi-project changeset summary
    Given a coverage-boost plan with a multi-project scope that has a changeset summary
    When I generate the coverage-boost CLI dict
    Then the coverage-boost CLI dict multi_project scope should contain changeset details

  # ---------------------------------------------------------------
  # Lines 985-991: as_cli_dict includes cross_project_dependencies
  # ---------------------------------------------------------------

  Scenario: as_cli_dict includes cross-project dependencies
    Given a coverage-boost plan with cross-project dependencies in metadata
    When I generate the coverage-boost CLI dict
    Then the coverage-boost CLI dict multi_project should contain cross_project_dependencies

  # ---------------------------------------------------------------
  # Lines 995, 997: as_cli_dict includes last_completed_step and last_checkpoint_id
  # ---------------------------------------------------------------

  Scenario: as_cli_dict includes resume metadata when step completed
    Given a coverage-boost plan with last_completed_step 2 and a checkpoint ID
    When I generate the coverage-boost CLI dict
    Then the coverage-boost CLI dict should contain last_completed_step 2
    And the coverage-boost CLI dict should contain last_checkpoint_id
