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.
194 lines
9.0 KiB
Gherkin
194 lines
9.0 KiB
Gherkin
Feature: Stream Template Operator Processing
|
|
As a developer
|
|
I want stream templates to process operators with agent and graph references, handle parameterization, and log correctly
|
|
So that stream template instantiation produces valid stream configurations with resolved operator references
|
|
|
|
Background:
|
|
Given I have a clean test environment for stream templates
|
|
|
|
Scenario: Test StreamTemplate instantiate - basic functionality
|
|
Given I have a stream template with basic definition
|
|
And I have valid template parameters
|
|
And I have a template registry for stream templates
|
|
And I have an instantiation context
|
|
When I instantiate the stream template
|
|
Then the stream definition should be created correctly
|
|
And the parameters section should be removed
|
|
And template variables should be applied
|
|
|
|
Scenario: Test StreamTemplate instantiate - with parameters section
|
|
Given I have a stream template with parameters in definition
|
|
And I have valid template parameters
|
|
And I have a template registry for stream templates
|
|
And I have an instantiation context
|
|
When I instantiate the stream template
|
|
Then the stream definition should be created correctly
|
|
And the parameters section should be removed from definition
|
|
|
|
Scenario: Test StreamTemplate instantiate - with operators processing
|
|
Given I have a stream template with operators in definition
|
|
And I have valid template parameters
|
|
And I have a template registry for stream templates
|
|
And I have an instantiation context
|
|
When I instantiate the stream template
|
|
Then the stream definition should be created correctly
|
|
And operators should be processed for references
|
|
|
|
Scenario: Test StreamTemplate instantiate - adding name when not present
|
|
Given I have a stream template without name in definition
|
|
And I have valid template parameters
|
|
And I have a template registry for stream templates
|
|
And I have an instantiation context
|
|
When I instantiate the stream template
|
|
Then the stream definition should be created correctly
|
|
And the template name should be added to definition
|
|
|
|
Scenario: Test StreamTemplate instantiate - name already present
|
|
Given I have a stream template with name in definition
|
|
And I have valid template parameters
|
|
And I have a template registry for stream templates
|
|
And I have an instantiation context
|
|
When I instantiate the stream template
|
|
Then the stream definition should be created correctly
|
|
And the existing name should be preserved
|
|
|
|
Scenario: Test _process_operators - with None operator (conditionally excluded)
|
|
Given I have a stream template instance
|
|
And I have operators list with None operator
|
|
And I have template parameters
|
|
And I have an instantiation context
|
|
When I process the operators
|
|
Then the None operator should be skipped
|
|
And processed operators should not contain None
|
|
|
|
Scenario: Test _process_operators - with parameterized operator type
|
|
Given I have a stream template instance
|
|
And I have operators list with parameterized type
|
|
And I have template parameters with operator type
|
|
And I have an instantiation context
|
|
When I process the operators
|
|
Then the operator type should be replaced with parameter value
|
|
|
|
Scenario: Test _process_operators - processor with graph_execute type
|
|
Given I have a stream template instance
|
|
And I have operators list with processor graph_execute reference
|
|
And I have template parameters
|
|
And I have an instantiation context
|
|
When I process the operators
|
|
Then the operator should be converted to graph_execute type
|
|
And the processor params should be applied
|
|
|
|
Scenario: Test _process_operators - processor with agent type
|
|
Given I have a stream template instance
|
|
And I have operators list with processor agent reference
|
|
And I have template parameters
|
|
And I have an instantiation context
|
|
When I process the operators
|
|
Then the operator should be converted to map type
|
|
And the agent name should be applied
|
|
|
|
Scenario: Test _process_operators - map operator with agent parameter reference
|
|
Given I have a stream template instance
|
|
And I have operators list with map operator having agent parameter reference
|
|
And I have template parameters with agent name
|
|
And I have an instantiation context
|
|
When I process the operators
|
|
Then the agent reference should be replaced with parameter value
|
|
|
|
Scenario: Test _process_operators - map operator with agent component reference (successful)
|
|
Given I have a stream template instance
|
|
And I have operators list with map operator having agent component reference
|
|
And I have template parameters
|
|
And I have an instantiation context with resolvable agent reference
|
|
When I process the operators
|
|
Then the agent reference should be resolved successfully
|
|
And agent_config should be added to operator params
|
|
|
|
Scenario: Test _process_operators - map operator with agent component reference (failed)
|
|
Given I have a stream template instance
|
|
And I have operators list with map operator having agent component reference
|
|
And I have template parameters
|
|
And I have an instantiation context with unresolvable agent reference
|
|
When I process the operators
|
|
Then the agent reference resolution should fail silently
|
|
And the original agent reference should be preserved
|
|
|
|
Scenario: Test _process_operators - graph_execute operator with graph parameter reference
|
|
Given I have a stream template instance
|
|
And I have operators list with graph_execute operator having graph parameter reference
|
|
And I have template parameters with graph name
|
|
And I have an instantiation context
|
|
When I process the operators
|
|
Then the graph reference should be replaced with parameter value
|
|
|
|
Scenario: Test _process_operators - graph_execute operator with graph component reference (successful)
|
|
Given I have a stream template instance
|
|
And I have operators list with graph_execute operator having graph component reference
|
|
And I have template parameters
|
|
And I have an instantiation context with resolvable graph reference
|
|
When I process the operators
|
|
Then the graph reference should be resolved successfully
|
|
And graph_config should be added to operator params
|
|
|
|
Scenario: Test _process_operators - graph_execute operator with graph component reference (failed)
|
|
Given I have a stream template instance
|
|
And I have operators list with graph_execute operator having graph component reference
|
|
And I have template parameters
|
|
And I have an instantiation context with unresolvable graph reference
|
|
When I process the operators
|
|
Then the graph reference resolution should fail silently
|
|
And the original graph reference should be preserved
|
|
|
|
Scenario: Test _process_operators - mixed operators complex scenario
|
|
Given I have a stream template instance
|
|
And I have operators list with mixed operator types
|
|
And I have comprehensive template parameters
|
|
And I have an instantiation context with mixed references
|
|
When I process the operators
|
|
Then all operators should be processed correctly
|
|
And references should be resolved appropriately
|
|
And processed operators should be returned
|
|
|
|
Scenario: Test _process_operators - empty operators list
|
|
Given I have a stream template instance
|
|
And I have empty operators list
|
|
And I have template parameters
|
|
And I have an instantiation context
|
|
When I process the operators
|
|
Then an empty processed operators list should be returned
|
|
|
|
Scenario: Test StreamTemplate logging functionality
|
|
Given I have a stream template instance
|
|
And I have operators list with resolvable references
|
|
And I have template parameters
|
|
And I have an instantiation context with resolvable references
|
|
When I process the operators
|
|
Then debug logging should be triggered for successful resolutions
|
|
|
|
Scenario: Test parameter validation in instantiate
|
|
Given I have a stream template with parameter definitions
|
|
And I have template parameters requiring validation
|
|
And I have a template registry for stream templates
|
|
And I have an instantiation context
|
|
When I instantiate the stream template
|
|
Then parameters should be validated correctly
|
|
And the stream definition should use validated parameters
|
|
|
|
Scenario: Test deep copy behavior in instantiate
|
|
Given I have a stream template with mutable definition
|
|
And I have valid template parameters
|
|
And I have a template registry for stream templates
|
|
And I have an instantiation context
|
|
When I instantiate the stream template
|
|
Then the original definition should not be modified
|
|
And the returned definition should be a deep copy
|
|
|
|
Scenario: Test error handling in _process_operators - exception during resolution
|
|
Given I have a stream template instance
|
|
And I have operators list with agent component reference
|
|
And I have template parameters
|
|
And I have an instantiation context that throws exception during resolution
|
|
When I process the operators
|
|
Then the exception should be caught and handled silently
|
|
And processing should continue for remaining operators
|