Feature: ServiceRetryWiring coverage improvements
  Scenarios targeting uncovered lines in service_retry_wiring.py to
  increase code coverage beyond the current 93.9%.

  Background:
    Given the service retry wiring module is imported

  # Line 149, 220: _apply_settings_defaults with only_services for new services
  # added by config overrides
  Scenario: Config overrides introduce a new service and global defaults are re-applied
    Given settings with a non-default retry_max_attempts of 7
    And settings with retry_service_overrides introducing a new service "brand_new_svc"
    When I create a ServiceRetryWiring from those settings
    Then the policy for "brand_new_svc" should have max_attempts of 7

  # Lines 252-254: _apply_config_overrides inner TypeError fallback in except block
  Scenario: Invalid JSON in config overrides triggers inner TypeError fallback
    Given settings with invalid JSON in retry_service_overrides
    And a logger that raises TypeError on warning calls
    When I create a ServiceRetryWiring with the patched logger
    Then no exception should be raised during construction

  # Line 262: _build_cached_wait when backoff_strategy is a plain string
  Scenario: Build cached wait strategy with a string backoff strategy
    Given a ServiceRetryPolicy with a plain string backoff_strategy "exponential"
    When I call _build_cached_wait with the string-strategy policy
    Then a valid wait strategy should be returned

  # Line 303: _get_or_create_cb returns None when circuit breaker is disabled
  Scenario: Get or create circuit breaker returns None when CB is disabled
    Given a ServiceRetryWiring with a service that has circuit breaker disabled
    When I call _get_or_create_cb for the disabled-CB service
    Then srwcov the result should be None

  # Line 308: _get_or_create_cb double-check path after lock acquisition
  Scenario: Get or create circuit breaker double-check returns cached CB
    Given a ServiceRetryWiring with default settings
    When I concurrently request the circuit breaker for a new service with CB enabled
    Then the circuit breaker should be created once and cached

  # Lines 385-387: execute() with an async callable raises TypeError
  Scenario: Sync execute raises TypeError for async callables
    Given a ServiceRetryWiring with default settings
    And an async callable function
    When I call sync execute with the async callable
    Then a TypeError should be raised mentioning async_execute

  # Line 407: execute() nesting guard active with no circuit breaker
  Scenario: Execute with nesting guard active and no circuit breaker
    Given a ServiceRetryWiring with a service that has circuit breaker disabled
    And the retry nesting depth is at the maximum
    When I call execute for the disabled-CB service with a simple function
    Then the function should be called directly without retry wrapping

  # Line 441: execute() retry loop with no circuit breaker
  Scenario: Execute retry loop succeeds without circuit breaker
    Given a ServiceRetryWiring with a service that has circuit breaker disabled
    When I call execute for the disabled-CB service with a simple function normally
    Then the function result should be returned successfully

  # Line 521: async_execute() nesting guard active with no circuit breaker
  Scenario: Async execute with nesting guard active and no circuit breaker
    Given a ServiceRetryWiring with a service that has circuit breaker disabled
    And the retry nesting depth is at the maximum
    When I call async_execute for the disabled-CB service with an async function
    Then the async function should be called directly without retry wrapping

  # Line 553: async_execute() retry loop with no circuit breaker
  Scenario: Async execute retry loop succeeds without circuit breaker
    Given a ServiceRetryWiring with a service that has circuit breaker disabled
    When I call async_execute for the disabled-CB service with an async function normally
    Then the async function result should be returned successfully

  # Line 625: wrap_service_method when backoff_strategy is a plain string
  Scenario: Wrap service method with string backoff strategy
    Given a ServiceRetryWiring where a service has a plain string backoff_strategy
    When I call wrap_service_method for that service
    Then a callable decorator should be returned
