@sandbox-create-for-plan
Feature: _create_sandbox_for_plan creates git worktree or flat sandbox (#7888)
  Verifies that _create_sandbox_for_plan returns a git worktree sandbox
  for git-checkout resources and falls back to a flat directory when no
  git resource is found.

  @mock_only
  Scenario: Single git-checkout resource creates a worktree sandbox for scfp
    Given a temp git project for scfp
    And a mocked plan service linking the git project for scfp
    When I call _create_sandbox_for_plan for scfp
    Then the sandbox root should be a directory for scfp
    And the sandbox object should not be None for scfp
    And the sandbox root should differ from the project path for scfp

  @mock_only
  Scenario: No linked resources falls back to flat sandbox for scfp
    Given a mocked plan service with no linked resources for scfp
    When I call _create_sandbox_for_plan for scfp
    Then the sandbox root should be a directory for scfp
    And the sandbox object should be None for scfp

  @mock_only
  Scenario: _cleanup_sandbox_for_plan skips when cleanup_stale returns False for scfp
    Given a temp git project without a worktree for scfp
    And a mocked plan service linking the git project for scfp
    When I call _cleanup_sandbox_for_plan with no stale branch for scfp
    Then the cleanup call should complete without error for scfp
