Feature: Project execution environment priority
  As a user
  I need to set --execution-env-priority on project context set
  So that I can control whether the project-level environment overrides or defers

  # ── Domain model ─────────────────────────────────────────────────

  Scenario: ContextConfig accepts execution_env_priority field
    Given I create a ContextConfig with execution_env_priority "fallback"
    Then the context config execution_env_priority should be "fallback"

  Scenario: ContextConfig accepts override priority
    Given I create a ContextConfig with execution_env_priority "override"
    Then the context config execution_env_priority should be "override"

  Scenario: ContextConfig execution_env_priority defaults to None
    Given I create a default ContextConfig
    Then the context config execution_env_priority should be None

  # ── ExecutionEnvPriority enum ────────────────────────────────────

  Scenario: ExecutionEnvPriority enum has fallback and override
    Then the ExecutionEnvPriority enum should have "fallback"
    And the ExecutionEnvPriority enum should have "override"

  # ── CLI project context set validation ───────────────────────────

  Scenario: project context set rejects invalid execution-env-priority
    Given I have a test project "local/test-eep"
    When I call project context set with execution-env-priority "invalid"
    Then a CLI error should be raised for invalid priority

  Scenario: project context set accepts fallback priority
    Given I have a test project "local/test-eep-fb"
    When I call project context set with execution-env-priority "fallback"
    Then the project priority should be persisted as "fallback"

  Scenario: project context set accepts override priority
    Given I have a test project "local/test-eep-ov"
    When I call project context set with execution-env-priority "override"
    Then the project priority should be persisted as "override"

  # ── Persistence round-trip ───────────────────────────────────────

  Scenario: execution_env_priority persists alongside execution_environment
    Given I have a test project "local/test-eep-both"
    When I set execution-environment "container" and priority "override"
    Then the persisted blob should have execution_environment "container"
    And the persisted blob should have execution_env_priority "override"

  Scenario: Setting priority does not clear execution_environment
    Given I have a test project "local/test-eep-preserve"
    When I set execution-environment "container" first
    And I set execution-env-priority "override" second
    Then the persisted blob should still have execution_environment "container"
    And the persisted blob should have execution_env_priority "override"

  # ── Priority propagation to plan ─────────────────────────────────

  Scenario: Project-level priority propagates to plan when no plan-level override
    Given I have a test project "local/test-eep-prop"
    When I set execution-environment "container" and priority "override"
    Then the persisted blob should have execution_env_priority "override"
