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
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.
202 lines
9.1 KiB
Gherkin
202 lines
9.1 KiB
Gherkin
Feature: Template Registry Instantiation from Configuration
|
|
As a developer
|
|
I want the template registry to instantiate agent, graph, and stream templates from direct definitions and template-based configs
|
|
So that the registry serves as the central factory for creating template-backed components
|
|
|
|
Background:
|
|
Given I have a clean test environment for registry
|
|
|
|
Scenario: Test TemplateRegistry initialization
|
|
Given I create a new template registry
|
|
Then the registry should be initialized correctly
|
|
And all template type collections should be empty
|
|
|
|
Scenario: Test register_template - normal agent template
|
|
Given I have a template registry for registry testing
|
|
And I have a normal agent template definition
|
|
When I register the agent template
|
|
Then the agent template should be stored correctly
|
|
And logging should record the registration
|
|
|
|
Scenario: Test register_template - composite agent template
|
|
Given I have a template registry for registry testing
|
|
And I have a composite agent template definition
|
|
When I register the composite agent template
|
|
Then the composite agent template should be stored correctly
|
|
And logging should record the registration
|
|
|
|
Scenario: Test register_template - graph template
|
|
Given I have a template registry for registry testing
|
|
And I have a graph template definition
|
|
When I register the graph template
|
|
Then the graph template should be stored correctly
|
|
And logging should record the registration
|
|
|
|
Scenario: Test register_template - stream template
|
|
Given I have a template registry for registry testing
|
|
And I have a stream template definition
|
|
When I register the stream template
|
|
Then the stream template should be stored correctly
|
|
And logging should record the registration
|
|
|
|
Scenario: Test register_template - invalid template type
|
|
Given I have a template registry for registry testing
|
|
And I have an invalid template definition
|
|
When I try to register the invalid template
|
|
Then a ValueError should be raised for registry
|
|
And the error message should mention unknown template type
|
|
|
|
Scenario: Test get_template - successful retrieval
|
|
Given I have a template registry for registry testing
|
|
And I have registered templates of all types
|
|
When I retrieve a template by type and name
|
|
Then the correct template should be returned
|
|
|
|
Scenario: Test get_template - template not found
|
|
Given I have a template registry for registry testing
|
|
When I try to retrieve a non-existent template
|
|
Then a ValueError should be raised for registry
|
|
And the error message should mention template not found
|
|
|
|
Scenario: Test has_template - template exists
|
|
Given I have a template registry for registry testing
|
|
And I have registered a test template
|
|
When I check if the template exists
|
|
Then the result should be true for registry
|
|
|
|
Scenario: Test has_template - template does not exist
|
|
Given I have a template registry for registry testing
|
|
When I check if a non-existent template exists
|
|
Then the result should be false for registry
|
|
|
|
Scenario: Test instantiate - with context provided
|
|
Given I have a template registry for registry testing
|
|
And I have registered a template for instantiation
|
|
And I have an instantiation context for registry
|
|
When I instantiate the template with context
|
|
Then the template should be instantiated correctly
|
|
And the provided context should be used
|
|
|
|
Scenario: Test instantiate - without context provided
|
|
Given I have a template registry for registry testing
|
|
And I have registered a template for instantiation
|
|
When I instantiate the template without context
|
|
Then the template should be instantiated correctly
|
|
And a new context should be created automatically
|
|
|
|
Scenario: Test instantiate_from_config - None config
|
|
Given I have a template registry for registry testing
|
|
When I try to instantiate from None config
|
|
Then a ValueError should be raised for registry
|
|
And the error message should mention None configuration
|
|
|
|
Scenario: Test instantiate_from_config - template-based with found template
|
|
Given I have a template registry for registry testing
|
|
And I have registered templates for config instantiation
|
|
And I have a config with template reference
|
|
When I instantiate from the template config
|
|
Then the correct template should be instantiated
|
|
And the template parameters should be applied
|
|
|
|
Scenario: Test instantiate_from_config - template-based with template not found
|
|
Given I have a template registry for registry testing
|
|
And I have a config with non-existent template reference
|
|
When I try to instantiate from the invalid template config
|
|
Then a ValueError should be raised for registry
|
|
And the error message should mention template not found in config
|
|
|
|
Scenario: Test instantiate_from_config - agent_template specific
|
|
Given I have a template registry for registry testing
|
|
And I have registered an agent template
|
|
And I have a config with agent_template reference
|
|
When I instantiate from the agent template config
|
|
Then the agent template should be instantiated correctly
|
|
|
|
Scenario: Test instantiate_from_config - graph_template specific
|
|
Given I have a template registry for registry testing
|
|
And I have registered a graph template
|
|
And I have a config with graph_template reference
|
|
When I instantiate from the graph template config
|
|
Then the graph template should be instantiated correctly
|
|
|
|
Scenario: Test instantiate_from_config - stream_template specific
|
|
Given I have a template registry for registry testing
|
|
And I have registered a stream template
|
|
And I have a config with stream_template reference
|
|
When I instantiate from the stream template config
|
|
Then the stream template should be instantiated correctly
|
|
|
|
Scenario: Test instantiate_from_config - direct agent definition
|
|
Given I have a template registry for registry testing
|
|
And I have a config with direct agent definition
|
|
When I instantiate from the direct agent config
|
|
Then None should be returned for agent factory handling
|
|
|
|
Scenario: Test instantiate_from_config - direct graph definition
|
|
Given I have a template registry for registry testing
|
|
And I have a config with direct graph definition
|
|
When I instantiate from the direct graph config
|
|
Then a GraphConfig should be returned
|
|
|
|
Scenario: Test instantiate_from_config - direct stream definition
|
|
Given I have a template registry for registry testing
|
|
And I have a config with direct stream definition
|
|
When I instantiate from the direct stream config
|
|
Then a StreamConfig should be returned
|
|
|
|
Scenario: Test instantiate_from_config - unrecognized config
|
|
Given I have a template registry for registry testing
|
|
And I have an unrecognizable config
|
|
When I try to instantiate from the unrecognizable config
|
|
Then a ValueError should be raised for registry
|
|
And the error message should mention cannot determine instance type
|
|
|
|
Scenario: Test instantiate_from_config - without context provided
|
|
Given I have a template registry for registry testing
|
|
And I have registered templates for config instantiation
|
|
And I have a config with template reference
|
|
When I instantiate from config without context
|
|
Then the instantiation should succeed
|
|
And a new context should be created automatically
|
|
|
|
Scenario: Test register_all_templates - comprehensive registration
|
|
Given I have a template registry for registry testing
|
|
And I have a comprehensive templates configuration
|
|
When I register all templates from the configuration
|
|
Then all agent templates should be registered correctly
|
|
And all graph templates should be registered correctly
|
|
And all stream templates should be registered correctly
|
|
|
|
Scenario: Test register_all_templates - empty configuration sections
|
|
Given I have a template registry for registry testing
|
|
And I have an empty templates configuration
|
|
When I register all templates from the empty configuration
|
|
Then no templates should be registered
|
|
And the registry should remain empty
|
|
|
|
Scenario: Test list_templates - all template types
|
|
Given I have a template registry for registry testing
|
|
And I have registered templates of all types
|
|
When I list all templates
|
|
Then all template types should be included in the result
|
|
And each type should show its registered templates
|
|
|
|
Scenario: Test list_templates - specific template type filter
|
|
Given I have a template registry for registry testing
|
|
And I have registered templates of all types
|
|
When I list templates for a specific type
|
|
Then only that template type should be included in the result
|
|
And it should show the correct registered templates
|
|
|
|
Scenario: Test list_templates - empty registry
|
|
Given I have a template registry for registry testing
|
|
When I list all templates from empty registry
|
|
Then all template types should be present but empty
|
|
And no templates should be listed
|
|
|
|
@skip
|
|
Scenario: Template registry becomes None
|
|
Given a config that forces None registry
|
|
When attempting template registration with None registry
|
|
Then CleverAgentsException is raised about template registry
|