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.
165 lines
7.9 KiB
Gherkin
165 lines
7.9 KiB
Gherkin
Feature: Graph Template Node and Edge Processing
|
|
As a developer
|
|
I want graph templates to process nodes with agent references and component references, and process edges with conditions
|
|
So that graph template instantiation produces valid graph configurations with correct node and edge mappings
|
|
|
|
Background:
|
|
Given I have a clean test environment for graph templates
|
|
|
|
# GraphTemplate class instantiate method tests
|
|
Scenario: Test GraphTemplate instantiate - basic graph configuration
|
|
Given I have a graph template registry
|
|
And I have a basic graph template
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the graph configuration should be returned
|
|
And the parameters section should be removed from graph config
|
|
And template variables should be applied to the graph config
|
|
And the result should have correct graph structure
|
|
|
|
Scenario: Test GraphTemplate instantiate - parameter validation
|
|
Given I have a graph template registry
|
|
And I have a graph template with required parameters
|
|
And I have valid template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then parameter validation should be called for graph templates
|
|
And the filled parameters should be used for graph templates
|
|
|
|
Scenario: Test GraphTemplate instantiate - template variable application
|
|
Given I have a graph template registry
|
|
And I have a graph template with template variables
|
|
And I have template parameters with variable values for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then template variables should be replaced with parameter values in graph config
|
|
|
|
Scenario: Test GraphTemplate instantiate - deep copy behavior
|
|
Given I have a graph template registry
|
|
And I have a graph template for deep copy test
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the original definition should not be modified for graph templates
|
|
And the returned config should be a separate copy for graph templates
|
|
|
|
Scenario: Test GraphTemplate instantiate - name assignment
|
|
Given I have a graph template registry
|
|
And I have a graph template without name
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the graph name should be assigned from template name
|
|
|
|
# Node processing tests
|
|
Scenario: Test GraphTemplate _process_nodes - basic node processing
|
|
Given I have a graph template registry
|
|
And I have a graph template with nodes
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then nodes should be processed correctly
|
|
And non-agent nodes should pass through unchanged
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - None node filtering
|
|
Given I have a graph template registry
|
|
And I have a graph template with None nodes
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then None nodes should be filtered out
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - agent node parameter reference
|
|
Given I have a graph template registry
|
|
And I have a graph template with agent nodes using parameter references
|
|
And I have template parameters with agent references
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then agent parameter references should be resolved
|
|
And agent nodes should use resolved parameter values
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - agent node component reference
|
|
Given I have a graph template registry
|
|
And I have a graph template with agent nodes using component references
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context with registered agents for graph templates
|
|
When I instantiate the graph template
|
|
Then agent component references should be resolved
|
|
And agent_config should be stored for resolved agents
|
|
And debug logging should be called for resolved references
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - agent reference resolution failure
|
|
Given I have a graph template registry
|
|
And I have a graph template with agent nodes using invalid references
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then invalid agent references should be handled gracefully
|
|
And agent nodes should retain original reference
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - template variable agent references
|
|
Given I have a graph template registry
|
|
And I have a graph template with agent nodes using template variables
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then template variable agent references should be preserved
|
|
And template variables should not be resolved as components
|
|
|
|
# Edge processing tests
|
|
Scenario: Test GraphTemplate _process_edges - basic edge processing
|
|
Given I have a graph template registry
|
|
And I have a graph template with edges
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then edges should be processed correctly
|
|
And all valid edges should be included
|
|
|
|
Scenario: Test GraphTemplate _process_edges - None edge filtering
|
|
Given I have a graph template registry
|
|
And I have a graph template with None edges
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then None edges should be filtered out
|
|
|
|
Scenario: Test GraphTemplate _process_edges - edge condition processing
|
|
Given I have a graph template registry
|
|
And I have a graph template with edges containing conditions
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then edge conditions should be processed with template variables
|
|
And template variables in conditions should be replaced
|
|
|
|
Scenario: Test GraphTemplate _process_edges - edges without conditions
|
|
Given I have a graph template registry
|
|
And I have a graph template with edges without conditions
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then edges without conditions should pass through unchanged
|
|
|
|
# Integration tests
|
|
Scenario: Test GraphTemplate instantiate - complete graph with nodes and edges
|
|
Given I have a graph template registry
|
|
And I have a complete graph template with nodes and edges
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the complete graph should be properly instantiated
|
|
And all nodes should be processed
|
|
And all edges should be processed
|
|
And the graph should have proper structure
|
|
|
|
Scenario: Test GraphTemplate instantiate - empty graph
|
|
Given I have a graph template registry
|
|
And I have an empty graph template
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the empty graph should be handled correctly
|
|
And basic graph structure should be maintained
|