Files
cleveractors-core/features/config_module_coverage.feature
CoreRasurae 9753b31c7e
CI / quality (push) Successful in 36s
CI / lint (push) Successful in 38s
CI / typecheck (push) Successful in 49s
CI / security (push) Successful in 51s
CI / integration_tests (push) Successful in 55s
CI / unit_tests (push) Successful in 3m35s
CI / build (push) Successful in 33s
CI / coverage (push) Successful in 3m36s
CI / status-check (push) Successful in 3s
test: add coverage gap tests improving coverage from 81.4% to 96.90%
Add 13 BDD scenarios covering previously uncovered code paths:
- SAFE_BUILTINS validation (sandbox.py: 0% → 100%)
- ConfigurationError re-raise path (config.py: 99.3% → 100%)
- CLI hello/main functions (cli.py: 72.7% → 90.9%)
- GraphState message truncation (state.py: 98.7% → 100%)
- ProgressBarManager update/context rendering (progress.py: 0% → 87.7%)
- MessageRouter regex/exact/contains routing (message_router.py: 0% → 59.4%)
- RoutingAdapter parse_routing_command (routing_adapter.py)
- DynamicRouterNode pattern-based routing (dynamic_router.py)
- EnhancedTemplateRegistry unknown template type (enhanced_registry.py: 99.2%)
- CompositeAgent null-graph error path (composite.py: 97.8% → 98.6%)

Cover routing_adapter.py (17% → 100%): all GOTO/ROUTE patterns,
create_routing_node, create_conditional_router, dynamic config conversion.

Cover dynamic_router.py (21% → 87%): execute with empty/dict/string
messages, extract_message with colon parsing, config creation, graph
extension with edge generation.

Cover message_router.py (59% → 78%): regex, exact, contains, prefix,
suffix match types, invalid regex handling, non-string message, set_state.

Exercise Node._prepare_conversation_history with invalid configs,
_runtime error paths, _execute_message_router with rules,
_execute_agent with current_message and metadata propagation,
_execute_function with dynamic_router, and _execute_conditional
with content_contains/content_not_contains/content_starts_with
and custom condition types. Improves nodes.py from 71.3% to 72.5%.

Exercise PureGraphConfig, PureLangGraph init with dict/config,
RxPyLangGraphBridge registration/connection/lookup,
ReactiveStreamRouter operator creation and condition functions,
ReactiveConfigParser config/route/graph parsing,
ToolAgent tool execution with JSON, space-separated, single,
file_read, progress_bar invocations, and
ReactiveCleverAgentsApp init/dispose/visualization.
2026-06-02 20:02:01 +01:00

127 lines
4.0 KiB
Gherkin

Feature: Configuration Manager Loading, Merging, and Validation
As a developer
I want the configuration manager to load from files, merge multiple configs, interpolate environment variables, and validate schemas
So that the configuration system provides reliable, merged configurations with proper validation
Background:
Given the configuration system is initialized
And I have access to configuration files
Scenario: Configuration manager initialization
When I create a new ConfigurationManager
Then it should initialize with empty config
And the schema validator should be created
Scenario: Basic configuration file loading
Given I have a simple configuration file "basic_config.yaml":
"""
agents:
- name: test_agent
type: llm
config:
model: gpt-3.5-turbo
"""
When I load the configuration file
Then the config should contain agent definitions
And the configuration should be valid
Scenario: Multiple configuration file merging
Given I have configuration file "config1.yaml":
"""
agents:
- name: agent1
type: llm
"""
And I have configuration file "config2.yaml":
"""
agents:
- name: agent2
type: tool
"""
When I load both configuration files
Then both agents should be present in the merged config
And the configuration structure should be preserved
Scenario: Environment variable interpolation
Given I have a configuration file "env_config.yaml":
"""
agents:
- name: test_agent
config:
api_key: ${OPENAI_API_KEY}
model: ${LLM_MODEL:gpt-3.5-turbo}
"""
And environment variable "OPENAI_API_KEY" is set to "test-key"
When I load the configuration with interpolation
Then the api_key should be "test-key"
And the model should use the default value "gpt-3.5-turbo"
Scenario: Configuration validation errors
Given I have an invalid config file "invalid_config.yaml":
"""
invalid_structure: true
missing_required_fields: yes
"""
When I attempt to load the invalid configuration
Then a ConfigurationError should be raised
And the error should describe the validation issues
Scenario: Configuration path-based access
Given I have a nested configuration:
"""
agents:
llm_agent:
config:
model: gpt-4
temperature: 0.7
"""
When I access the configuration using path notation
Then I should be able to get "agents.llm_agent.config.model"
And it should return "gpt-4"
Scenario: Additional configuration methods testing
Given I have a nested configuration:
"""
agents:
test_agent:
type: llm
config:
model: gpt-4
temperature: 0.7
routes:
main_route:
type: stream
cleveragents:
default_router: main_route
"""
When I test additional configuration methods
Then all methods should work correctly
And exports should produce valid results
Scenario: Environment variable edge cases
Given I set environment variable "TEST_BOOL" to "false"
And I set environment variable "TEST_NUMBER" to "123.45"
And I have a configuration file "env_edge_cases.yaml":
"""
agents:
test_agent:
type: llm
config:
enabled: ${TEST_BOOL}
score: ${TEST_NUMBER}
fallback: ${MISSING_VAR:default123}
routes:
main_route:
type: stream
cleveragents:
default_router: main_route
"""
When I load the configuration from "env_edge_cases.yaml"
Then the configuration should be loaded successfully
And type conversions should work correctly
Scenario: Schema validation comprehensive
Given I have a comprehensive test configuration
When I perform comprehensive validation testing
Then all validation scenarios should be covered