Files
cleveractors-core/features/dynamic_router_coverage.feature
CoreRasurae 3fc0a3fa57
CI / lint (pull_request) Successful in 35s
CI / quality (pull_request) Successful in 44s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 56s
CI / unit_tests (pull_request) Successful in 3m33s
CI / integration_tests (pull_request) Successful in 56s
CI / build (pull_request) Successful in 34s
CI / coverage (pull_request) Successful in 3m34s
CI / status-check (pull_request) Successful in 3s
CI / quality (push) Successful in 49s
CI / lint (push) Successful in 51s
CI / typecheck (push) Successful in 52s
CI / build (push) Successful in 41s
CI / security (push) Successful in 58s
CI / integration_tests (push) Successful in 1m0s
CI / unit_tests (push) Successful in 3m37s
CI / coverage (push) Successful in 3m34s
CI / status-check (push) Successful in 5s
test(coverage): add BDD unit tests to close coverage gap toward 97%
Add comprehensive BDD Behave unit tests across six modules to improve
line coverage. New feature files and step definitions for:

- validation/_actor: graph/llm/tool/multi_actor config validation
- runtime_tokens: token estimation with tiktoken and fallback heuristics
- dynamic_router: ContentBasedCondition, RouterNode, graph extension
- runtime: v2 route format, config blocks, conversation history, multi-actor
- progress: ProgressBarManager remaining count resolution
- route: MESSAGE_ROUTER rules to metadata in to_graph_config

Also fix credential executor and graph cleanup step mocks to return
proper tuple values matching updated runtime signatures.

Refs: #39
2026-06-09 16:06:32 +01:00

59 lines
2.7 KiB
Gherkin

Feature: Dynamic Router for LangGraph
As a developer
I want dynamic routers to handle content-based routing and condition evaluation
So that graph workflows can route messages based on content patterns
Background:
Given the dynamic router test context is initialized (drc)
Scenario: create_dynamic_router_config builds config from patterns dict
Given a patterns dict with routing patterns (drc)
When create_dynamic_router_config is called (drc)
Then a config with type dynamic_router and routes list should be returned (drc)
Scenario: ContentBasedCondition evaluates to true when pattern matches
Given a ContentBasedCondition with pattern "GOTO_TARGET" (drc)
And a graph state with last message containing "GOTO_TARGET" (drc)
When evaluate is called on the condition (drc)
Then the result should be True (drc)
Scenario: ContentBasedCondition evaluates to false when pattern does not match
Given a ContentBasedCondition with pattern "GOTO_TARGET" (drc)
And a graph state with last message not containing pattern (drc)
When evaluate is called on the condition (drc)
Then the result should be False (drc)
Scenario: ContentBasedCondition evaluates to false when messages list is empty
Given a ContentBasedCondition with pattern "GOTO_TARGET" (drc)
And a graph state with empty messages list (drc)
When evaluate is called on the condition (drc)
Then the result should be False (drc)
Scenario: ContentBasedCondition handles dict messages correctly
Given a ContentBasedCondition with pattern "MATCH_ME" (drc)
And a graph state with last message as dict containing "MATCH_ME" (drc)
When evaluate is called on the condition (drc)
Then the result should be True (drc)
Scenario: ContentBasedCondition handles raw string messages not in dict wrapper
Given a ContentBasedCondition with pattern "ABSENT" (drc)
And a graph state with raw non-dict string messages (drc)
When evaluate is called on the condition (drc)
Then the result should be False (drc)
Scenario: extend_graph_with_router does not redirect non-routing nodes
Given a graph config with non-routing edges (drc)
When extend_graph_with_router is called (drc)
Then non-routing edges should be preserved unchanged (drc)
Scenario: register_content_conditions can be called on a graph
Given a mock graph instance (drc)
When register_content_conditions is called (drc)
Then the function should complete without error (drc)
Scenario: DynamicRouterNode handles non-dict messages
Given a DynamicRouterNode with routing patterns (drc)
And a graph state with string messages (drc)
When execute is called on the router (drc)
Then routing should work with string message content (drc)