Files
placeholder/features/strategy_coordinator_coverage.feature
freemo 051ee7c290 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

83 lines
4.2 KiB
Gherkin

Feature: Strategy Coordinator Coverage
Additional scenarios that exercise previously uncovered code paths
in the strategy_coordinator module (lines 147, 152, 157, 162,
192, 198, 200, 291-294, 328, 331).
Background:
Given the strategy coordinator module is imported
# -----------------------------------------------------------------------
# Property accessors (lines 147, 152, 157, 162)
# -----------------------------------------------------------------------
Scenario: Accessing the config property returns the coordinator configuration
Given a strategy coordinator with default configuration
When I access the config property
Then the config property returns a CoordinatorConfig instance
Scenario: Accessing the selector property returns the strategy selector
Given a strategy coordinator with default configuration
When I access the selector property
Then the selector property returns a ConfidenceWeightedSelector instance
Scenario: Accessing the allocator property returns the budget allocator
Given a strategy coordinator with default configuration
When I access the allocator property
Then the allocator property returns a ProportionalBudgetAllocator instance
Scenario: Accessing the executor property returns the strategy executor
Given a strategy coordinator with default configuration
When I access the executor property
Then the executor property returns a ParallelStrategyExecutor instance
# -----------------------------------------------------------------------
# coordinate() with fragments=None default (line 192)
# -----------------------------------------------------------------------
Scenario: Coordinate with no fragments defaults to empty list
Given a strategy coordinator with mock pipeline components
And a mock strategy that returns fragments without strategy_source
When I call coordinate without passing fragments
Then the coordination should succeed
And the result should contain fragments from the mock strategy
# -----------------------------------------------------------------------
# coordinate() with backends parameter (line 198)
# -----------------------------------------------------------------------
Scenario: Coordinate enriches request with backends parameter
Given a strategy coordinator with a request-capturing selector
And a mock strategy that returns fragments without strategy_source
When I call coordinate with backends parameter
Then the enriched request should contain a backends key
# -----------------------------------------------------------------------
# coordinate() with plan_context parameter (line 200)
# -----------------------------------------------------------------------
Scenario: Coordinate enriches request with plan_context parameter
Given a strategy coordinator with a request-capturing selector
And a mock strategy that returns fragments without strategy_source
When I call coordinate with plan_context parameter
Then the enriched request should contain a plan_context key
# -----------------------------------------------------------------------
# _apply_max_caps zero-confidence redistribution (lines 291-294)
# -----------------------------------------------------------------------
Scenario: Max cap redistribution with zero-confidence uncapped strategies
Given a strategy coordinator with per_strategy_max_cap of 500
And allocations with one capped strategy and two zero-confidence uncapped strategies
When I apply max caps to the allocations
Then the excess tokens should be equally redistributed among uncapped strategies
# -----------------------------------------------------------------------
# _extract_strategies_used with strategy_source (lines 328, 331)
# -----------------------------------------------------------------------
Scenario: Strategies used extracted from fragment strategy_source metadata
Given a strategy coordinator with mock pipeline components
And a mock strategy that returns fragments with strategy_source set
When I call coordinate without passing fragments
Then the strategies_used should be derived from fragment strategy_source