Files
cleveractors-core/features/config_core_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

107 lines
5.3 KiB
Gherkin

Feature: Configuration File Loading, Schema Validation, Environment Variable Interpolation
As a developer
I want configuration files to handle YAML errors, schema validation, environment variable interpolation, and deep merging correctly
So that configuration loading is resilient to malformed inputs and missing environment variables
Background:
Given the configuration system is initialized for core testing
Scenario: Configuration file loading with None content
Given I have a configuration file "empty.yaml" with None content
When I load the configuration files
Then the None content should be skipped
And the configuration should remain empty
Scenario: Configuration file loading with non-dict content
Given I have a configuration file "non_dict.yaml" with list content
When I attempt to load the configuration files
Then a ConfigurationError should be raised with message about YAML dictionary
Scenario: Configuration file loading with YAML parsing error
Given I have a configuration file "invalid_yaml.yaml" with malformed YAML
When I attempt to load the configuration files
Then a ConfigurationError should be raised with YAML parsing error
Scenario: Configuration file loading with file access error
Given I have a configuration file path that doesn't exist
When I attempt to load the configuration files
Then a ConfigurationError should be raised with file loading error
Scenario: Schema validation with general exception
Given I have a configuration manager with mocked schema validator
When the schema validator raises a general exception
Then a ConfigurationError should be raised with validation failed message
Scenario: Configuration setting with empty path
Given I have a configuration manager
When I attempt to set configuration with empty path
Then a ConfigurationError should be raised with empty path message
Scenario: Configuration setting with non-dict parent
Given I have a configuration manager with nested structure
When I attempt to set configuration where parent is not a dict
Then a ConfigurationError should be raised with parent not dictionary message
Scenario: Configuration setting with non-dict intermediate parent
Given I have a configuration manager with scalar values
When I attempt to set configuration with non-dict final parent
Then a ConfigurationError should be raised with final parent not dictionary message
Scenario: Environment variable interpolation with missing variable
Given I have configuration with missing environment variable
When I perform environment variable interpolation
Then a ConfigurationError should be raised with environment variable not set message
Scenario: Environment variable interpolation with default value type conversions
Given I have configuration with environment variables and default values
When I perform environment variable interpolation
Then boolean defaults should be converted to strings
And integer defaults should remain as strings
And float defaults should remain as strings
And string defaults should remain unchanged
Scenario: String to type conversion with boolean values
Given I have configuration with string boolean values
When I perform environment variable interpolation
Then true strings should be converted to boolean True
And false strings should be converted to boolean False
Scenario: String to type conversion with numeric values
Given I have configuration with string numeric values
When I perform environment variable interpolation
Then integer strings should be converted to integers
And float strings should be converted to floats
Scenario: Schema validation with agent config not dict
Given I have configuration with agent config not as dict
When I validate the configuration for core testing
Then a ConfigurationError should be raised with agent config must be dictionary message
Scenario: Schema validation with non-dict agent configuration
Given I have configuration with non-dict agent entry
When I validate the configuration for core testing
Then a ConfigurationError should be raised with agent configuration must be dictionary message
Scenario: Deep merge with nested dictionaries
Given I have two configurations with nested dictionary structures
When I perform deep merge
Then nested dictionaries should be properly merged
And values from second config should override first config
And new keys should be added
Scenario: Configuration get with various path scenarios
Given I have a configuration manager with test data
When I test get method with various paths
Then empty path should return entire config
And non-existent paths should return None or default
And nested paths should return correct values
And paths with non-dict intermediates should return default
Scenario: Configuration interpolation with complex nested structures
Given I have configuration with nested lists and dictionaries
And environment variables are set for interpolation
When I perform environment variable interpolation
Then variables in lists should be interpolated
And variables in nested dictionaries should be interpolated
And non-string values should remain unchanged