Feature: Application Container coverage boost round 2
  Exercise helper functions in container.py whose bodies remain uncovered:
    - _build_repo_indexing_service (lines 201-206)
    - _build_resource_registry_service (line 213-218)
    - _build_namespaced_project_repo (lines 221-230)
    - _resolve_auto_reindex (lines 269-278)
    - _build_analyzer_registry (lines 283-287)
    - _build_resource_file_watcher (lines 290-298)
    - _build_session_service (lines 316-357)

  Background:
    Given a clean container state for r2 coverage tests

  # -----------------------------------------------------------------
  # _build_repo_indexing_service  (lines 201-206)
  # -----------------------------------------------------------------

  Scenario: Build repo indexing service creates engine and sessionmaker
    When r2cov- I build a repo indexing service with an in-memory database
    Then r2cov- the result should be a RepoIndexingService instance
    And r2cov- the service should have a session factory

  # -----------------------------------------------------------------
  # _build_resource_registry_service  (lines 213-218)
  # -----------------------------------------------------------------

  Scenario: Build resource registry service creates engine and sessionmaker
    When r2cov- I build a resource registry service with an in-memory database
    Then r2cov- the result should be a ResourceRegistryService instance

  # -----------------------------------------------------------------
  # _build_namespaced_project_repo  (lines 221-230)
  # -----------------------------------------------------------------

  Scenario: Build namespaced project repository creates engine and sessionmaker
    When r2cov- I build a namespaced project repo with an in-memory database
    Then r2cov- the result should be a NamespacedProjectRepository instance

  # -----------------------------------------------------------------
  # _resolve_auto_reindex  (lines 269-278)
  # -----------------------------------------------------------------

  Scenario: Resolve auto-reindex returns True when config value is truthy
    Given r2cov- ConfigService resolve returns a truthy value for auto-reindex
    When r2cov- I call _resolve_auto_reindex
    Then r2cov- the result should be True

  Scenario: Resolve auto-reindex returns True when config value is None
    Given r2cov- ConfigService resolve returns None for auto-reindex
    When r2cov- I call _resolve_auto_reindex
    Then r2cov- the result should be True

  Scenario: Resolve auto-reindex returns False when config value is falsy
    Given r2cov- ConfigService resolve returns a falsy value for auto-reindex
    When r2cov- I call _resolve_auto_reindex
    Then r2cov- the result should be False

  Scenario: Resolve auto-reindex returns True when ConfigService raises an exception
    Given r2cov- ConfigService raises an exception during resolve
    When r2cov- I call _resolve_auto_reindex
    Then r2cov- the result should be True

  # -----------------------------------------------------------------
  # _build_analyzer_registry  (lines 283-287)
  # -----------------------------------------------------------------

  Scenario: Build analyzer registry creates registry with PythonAnalyzer
    When r2cov- I build an analyzer registry
    Then r2cov- the result should be an AnalyzerRegistry instance
    And r2cov- the registry should have a PythonAnalyzer for .py files

  # -----------------------------------------------------------------
  # _build_resource_file_watcher  (lines 290-298)
  # -----------------------------------------------------------------

  Scenario: Build resource file watcher with mock event bus
    Given r2cov- a mock event bus for the file watcher
    And r2cov- ConfigService resolve returns a truthy value for auto-reindex
    When r2cov- I build a resource file watcher with the mock event bus
    Then r2cov- the result should be a ResourceFileWatcher instance
    And r2cov- the watcher should have auto_reindex enabled

  Scenario: Build resource file watcher when auto-reindex config raises
    Given r2cov- a mock event bus for the file watcher
    And r2cov- ConfigService raises an exception during resolve
    When r2cov- I build a resource file watcher with the mock event bus
    Then r2cov- the result should be a ResourceFileWatcher instance
    And r2cov- the watcher should have auto_reindex enabled

  # -----------------------------------------------------------------
  # _build_session_service  (lines 316-357)
  # -----------------------------------------------------------------

  Scenario: Build session service with in-memory database and no event bus
    When r2cov- I build a session service with an in-memory database and no event bus
    Then r2cov- the result should be a PersistentSessionService instance

  Scenario: Build session service with in-memory database and mock event bus
    Given r2cov- a mock event bus for the session service
    When r2cov- I build a session service with an in-memory database and the mock event bus
    Then r2cov- the result should be a PersistentSessionService instance
