Files
cleveragents-core/features/retry_service_patterns_coverage.feature
T
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

85 lines
4.2 KiB
Gherkin

Feature: Retry Service Patterns Coverage
Scenarios targeting specific uncovered lines in retry_service_patterns.py
to improve code coverage beyond the current 94.3%.
# --- _is_async_callable edge cases (lines 82, 85, 86, 90) ---
Scenario: _is_async_callable detects partial wrapping an async callable object
Given I have a functools.partial wrapping a callable object with async __call__
When I check if the partial wrapping async callable is async
Then the async callable partial result should be True
Scenario: _is_async_callable returns False for partial wrapping a class type
Given I have a functools.partial wrapping a class type
When I check if the partial-wrapped type is async callable
Then rspcov the result should be False for partial type detection
Scenario: _is_async_callable returns False for a non-callable non-partial value
Given I have a plain integer value
When I check if the integer is async callable
Then rspcov the result should be False for the non-callable value
# --- retry_service_operation async: CircuitBreakerOpen with no breaker (line 254) ---
Scenario: Async retry service operation logs circuit open with no circuit breaker
Given I have an async function decorated with retry_service_operation and no circuit breaker
And the async function raises CircuitBreakerOpen
When I call the decorated async service operation
Then CircuitBreakerOpen should propagate with failure count zero
# --- RetryContext.execute rejects async callables (lines 444-446) ---
Scenario: RetryContext.execute raises TypeError for async callables
Given I have a RetryContext for operation "async-reject-test"
And I have an async callable to pass to sync execute
When I call execute with the async callable
Then a TypeError should be raised indicating async_execute is needed
# --- RetryContext.execute nesting guard (lines 452-453) ---
Scenario: RetryContext.execute skips retry at max nesting depth
Given I have a RetryContext for operation "nesting-sync-test"
And the retry depth is already at maximum
When I call execute at max nesting depth with a sync function
Then the function should execute once without retry wrapping
And the attempt count should be 1
# --- RetryContext.async_execute nesting guard (lines 507-508) ---
Scenario: RetryContext.async_execute skips retry at max nesting depth
Given I have a RetryContext for operation "nesting-async-test"
And the retry depth is already at maximum for async
When I call async_execute at max nesting depth
Then the async function should execute once without retry wrapping
And the async attempt count should be 1
# --- RetryContext.execute RuntimeError safeguard (line 482) ---
Scenario: RetryContext.execute raises RuntimeError when Retrying yields no iterations
Given I have a RetryContext for operation "empty-retrying-test"
And Retrying is patched to yield zero iterations
When I call execute expecting a RuntimeError from empty retrying
Then a RuntimeError about Retrying executing at least once should be raised
# --- RetryContext.async_execute RuntimeError safeguard (line 537) ---
Scenario: RetryContext.async_execute raises RuntimeError when AsyncRetrying yields no iterations
Given I have a RetryContext for operation "empty-async-retrying-test"
And AsyncRetrying is patched to yield zero async iterations
When I call async_execute expecting a RuntimeError from empty async retrying
Then a RuntimeError about AsyncRetrying executing at least once should be raised
# --- retry_auto_debug rejects sync callables (lines 575-577) ---
Scenario: retry_auto_debug raises TypeError for sync callables
Given I have a synchronous function decorated with retry_auto_debug
When I invoke the retry_auto_debug wrapper for the sync function
Then a TypeError about async callables should be raised
# --- retry_auto_debug returns None with zero attempts (line 639) ---
Scenario: retry_auto_debug returns None when max_debug_attempts is zero
Given I have an async function decorated with retry_auto_debug with zero attempts
When I invoke the retry_auto_debug wrapper with zero attempts
Then rspcov the result should be None from exhausted attempts