Feature: Application Container Dependency Injection Coverage
  As a developer
  I want to ensure the application container properly manages service dependencies
  So that all container methods and singleton patterns are thoroughly tested

  @phase1
  Scenario: Container settings method returns valid application settings
    Given I have initialized an application container
    When I request the application settings from the container
    Then the container should return valid settings object

  @phase1
  Scenario: Container project service method creates and returns service instance
    Given I have initialized an application container
    When I request a project service from the container
    Then the container should return a valid project service instance

  @phase1
  Scenario: Container context service method creates and returns service instance
    Given I have initialized an application container
    When I request a context service from the container
    Then the container should return a valid context service instance

  @phase1
  Scenario: Container plan service method creates and returns service instance
    Given I have initialized an application container
    When I request a plan service from the container
    Then the container should return a valid plan service instance

  @phase1
  Scenario: Get container function creates singleton on first call
    Given no global container exists
    When I access the global container for the first time
    Then a new container instance should be created and cached
    And subsequent accesses should return the same instance

  @phase1
  Scenario: Reset container function clears singleton for testing
    Given a global container exists
    When I reset the global container
    Then the global container should be cleared
    And the next access should create a new instance

  @phase1
  Scenario: Mock AI provider loads when testing env flag is enabled
    Given I enable the mock AI provider environment flag
    And I ensure the features directory path is not already on sys path
    When I request the AI provider from the container helpers
    Then the mock AI provider should be returned and features path added

  @phase1
  Scenario: Mock AI provider flag overrides configured providers
    Given I enable the mock AI provider environment flag
    And I set the "OPENAI_API_KEY" environment variable to "sk-live-test"
    And I ensure the features directory path is not already on sys path
    When I request the AI provider from the container helpers
    Then the mock AI provider should be returned and features path added

  @phase1
  Scenario: Mock AI provider import failure gracefully falls back
    Given I enable the mock AI provider environment flag
    And I simulate a failure when importing the mock AI provider
    When I request the AI provider from the container helpers
    Then the mock AI provider should not be returned due to import failure


  @phase1
  Scenario: Override providers uses object provider for database url
    Given no global container exists
    When I override the database url provider with "sqlite:///:memory:"
    Then the overridden database url should be used by the container
    And I reset the container overrides to avoid test leakage
