Files
cleveragents-core/features/service_retry_wiring_coverage.feature
freemo 051ee7c290
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 52s
CI / build (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 5m1s
CI / integration_tests (pull_request) Successful in 5m30s
CI / unit_tests (pull_request) Successful in 5m42s
CI / docker (pull_request) Successful in 58s
CI / coverage (pull_request) Successful in 7m35s
CI / build (push) Successful in 21s
CI / docker (push) Has been skipped
CI / benchmark-regression (pull_request) Failing after 49m24s
CI / lint (push) Successful in 22s
CI / quality (push) Successful in 39s
CI / security (push) Successful in 48s
CI / typecheck (push) Successful in 1m26s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 5m53s
CI / coverage (push) Successful in 9m4s
CI / benchmark-publish (push) Successful in 19m10s
CI / integration_tests (push) Failing after 19m18s
CI / unit_tests (push) Failing after 19m20s
test(coverage): add Behave BDD tests to improve coverage across 52 source files
Added 52 new .feature files and corresponding _steps.py files targeting
previously uncovered code paths in the following areas:

- TUI layer: app, commands, persona (state/schema/registry), widgets,
  input (shell_exec, reference_parser)
- Application services: plan lifecycle/service/executor, session,
  project, repo indexing, correction, checkpoint, actor, llm_actors,
  strategy coordinator, resource file watcher, service retry wiring
- CLI commands: session, resource, repl, plan, db, automation_profile
- Domain models: retry_policy, resource_type, cost_budget,
  docker_compose_analyzer, detail_level, _sql_string_aware,
  _postgresql_helpers
- Core: circuit_breaker, retry_service_patterns
- Infrastructure: repositories, transaction_sandbox, strategy_registry,
  plugins/loader, container
- Config: settings
- Agents: plan_generation, context_analysis, auto_debug
- A2A: facade

All new tests follow the Behave/Gherkin BDD standard. Resolved step
definition collisions with unique prefixes. Fixed Alembic fileConfig
logger disabling issue (disable_existing_loggers=False).

ISSUES CLOSED: #1068
2026-03-20 21:22:10 +00:00

79 lines
4.3 KiB
Gherkin

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