Files
cleveragents-core/features/reactive_application_coverage.feature

181 lines
8.6 KiB
Gherkin

Feature: Reactive application coverage
As a developer
I want targeted Behave coverage for the reactive application
So that uncovered logic paths are exercised
Scenario: Initialize app applies logging and temperature override
Given a temporary reactive config with a stream route
When I initialize the reactive app with verbose "3" and temperature override "0.4"
Then the reactive app should load the configuration
And the root logger level should be INFO
And the config should include the temperature override "0.4"
And the stream route should be registered
Scenario: Unsafe config requires unsafe flag
Given a temporary reactive config that requires unsafe mode
When I initialize the reactive app without the unsafe flag
Then an unsafe configuration error should be raised
Scenario: Logging levels cover verbosity branches
Given a reactive app instance
When I configure logging for all verbosity levels
Then each verbosity should map to the expected logging level
Scenario: Register agents and aliases from config
Given a reactive app with stream operators and varied agent types
When I register agents from the reactive config
Then the stream router should include tool and llm agent aliases
And the operator referenced actors should be registered
And the tool actor should be registered as a SimpleToolAgent
And the llm agent should be registered as a SimpleLLMAgent
Scenario: Load configuration wraps parser errors
Given a reactive app without configuration
When I load configuration from a missing file
Then a configuration load error should be raised
Scenario: Stream routes reject bridge configs
Given a reactive app with a stream route that has a bridge config
When I validate the reactive routes
Then route validation should fail for bridge config
Scenario: Build routes creates streams and merges
Given a reactive app with stream and graph routes and a merge
When I build the reactive routes
Then the stream route should be created
And a route bridge should be initialized for graph routes
And merge subscriptions should forward messages
And rxpy stream presence should be detected
And the first graph route should be returned
Scenario: Workflow controller rules short-circuit
Given a reactive app with a workflow controller graph route
When I execute the workflow controller route with prompt "ROUTE_ASK_TOPIC:Hello"
Then the workflow route should return the extracted message
And the graph context should include default writing metadata
Scenario: Chained graph route processes tool, callable, and process agents
Given a reactive app with a chained graph route
When I execute the chained graph route with prompt "TOOL:payload"
Then the chained graph route should return "payload_tool_callable_process"
Scenario: Graph route returns empty when router rules are missing
Given a reactive app with a graph route without router rules
When I execute the graph route with prompt "hello"
Then the graph route should return an empty string
Scenario: Graph route returns when agent is missing
Given a reactive app with a graph route targeting a missing agent
When I execute the missing agent route with prompt "MISSING input"
Then the graph route should return the original prompt
Scenario: Graph route ends on suffix match
Given a reactive app with a suffix matching graph route
When I execute the suffix route with prompt "done!"
Then the suffix route should return the original prompt
Scenario: Single shot rejects rxpy stream in run mode
Given a reactive app with a stream route configured
When I run a single shot without allowing rxpy
Then the single shot should fail with a reactive stream error
Scenario: Single shot cleans stream routing prefixes
Given a reactive app with a stream route configured
When I run a single shot allowing rxpy
Then the stream output should have routing prefixes removed
Scenario: Single shot cleans graph routing prefixes
Given a reactive app with a graph route configured
When I run a graph single shot with prompt "CMD:ignored"
Then the graph output should have routing prefixes removed
Scenario: Run with context records messages and global context
Given a reactive app with a graph route configured
And a context manager for run with context
When I run the reactive app with context and prompt "hello"
Then the context manager should have stored user and assistant messages
And the context manager should persist the global context
Scenario: No-config helpers short-circuit
Given a reactive app without configuration
When I call the reactive helper methods without configuration
Then the reactive helper methods should return defaults
Scenario: Register deferred route agents and operators
Given a reactive app with deferred route and operator agents
When I register deferred route agents from the reactive config
Then deferred route agents and operator aliases should be registered
Scenario: Build routes registers fallback agent and skips missing merge target
Given a reactive app with a stream route referencing an unknown actor and a missing merge target
When I build the reactive routes
Then a fallback stream agent should be registered
And the missing merge target should not be created
Scenario: Graph route follows non-dict edge condition
Given a reactive app with a graph route using a non-dict edge condition
When I execute the graph route with prompt "GO"
Then the graph route should return the prompt unchanged
Scenario: Graph route matches empty suffix rule
Given a reactive app with a graph route using an empty suffix rule
When I execute the graph route with prompt "tail"
Then the graph route should return the prompt unchanged
Scenario: Graph route extracts without separator
Given a reactive app with a graph route extracting without a separator
When I execute the graph route with prompt "PREFIXDATA"
Then the graph route should return the prompt unchanged
Scenario: Graph route uses process agent branch
Given a reactive app with a graph route using a process agent
When I execute the graph route with prompt "PROC:work"
Then the graph route should return "work_process"
Scenario: Graph route uses non-callable agent fallback
Given a reactive app with a graph route using a non-callable agent
When I execute the graph route with prompt "RAW"
Then the graph route should return the prompt unchanged
Scenario: Graph route returns empty on empty agent output
Given a reactive app with a graph route returning an empty response
When I execute the graph route with prompt "EMPTY"
Then the graph route should return an empty string
Scenario: Chained graph route breaks to router after tool and non-callable nodes
Given a reactive app with a chained graph route that breaks to the router
When I execute the chained break route with prompt "START"
Then the chained break route should return "DONE"
Scenario: Chained graph route breaks on missing chained targets
Given a reactive app with a chained graph route that has no chained targets
When I execute the chained empty route with prompt "BEGIN"
Then the chained empty route should return "DONE"
Scenario: Graph route loops until max iterations without edges
Given a reactive app with a graph route lacking edges
When I execute the looping graph route with prompt "LOOP"
Then the looping graph route should return "LOOP"
Scenario: Graph route uses end-like sentinel target
Given a reactive app with a graph route using an end-like sentinel target
When I execute the sentinel graph route with prompt "SENTINEL"
Then the sentinel graph route should return "value"
Scenario: Run single shot updates global context and strips prefixes
Given a reactive app with a graph route that emits a discovery prefix
And a context manager with global context
When I run a graph single shot with context and prompt "CMD:ignore"
Then the graph output should be "Hello"
And the reactive config should include the context global values
Scenario: Run single shot raises on error stream message
Given a reactive app with a stream route that emits an error
When I run a single shot that triggers a stream error
Then the single shot should raise a reactive stream error
Scenario: Run single shot returns empty without routes
Given a reactive app without configuration
When I run a single shot with no routes
Then the single shot should return an empty string