Files
cleveragents-core/features/langgraph_graph_coverage.feature
T

66 lines
2.8 KiB
Gherkin

Feature: LangGraph uncovered branches
As a developer
I want Behave tests for langgraph graph orchestration
So that uncovered branches in graph.py gain coverage
Scenario: Scheduler falls back when no running loop exists
Given a langgraph config with only start and end nodes
And asyncio has no running loop
When I construct a LangGraph without providing a scheduler
Then it should create an AsyncIOScheduler and initialize streams
Scenario: Execute dispatches to start stream and returns state
Given a langgraph instance with a fresh state manager
When I execute the graph with input data
Then the start stream should receive the state and execution returns a GraphState
Scenario: Start raises when start stream is missing
Given a langgraph instance with a removed start stream
When I call start on the graph
Then a start stream error should be raised
Scenario: Parallel groups disabled and cycles detected
Given a langgraph config with parallel execution disabled and a cycle
When I construct the LangGraph
Then the graph should report cycles and empty parallel groups
Scenario: Node executor updates state and history
Given a langgraph instance with a patched state manager
When I invoke the builtin node executor
Then it should update state and record execution history
Scenario: Topological levels enumerate layered nodes
Given a langgraph config with layered nodes
When I compute the topological levels
Then the levels should list each layer
Scenario: Execution history getter returns copy
Given a langgraph instance with recorded history
When I request execution history
Then it should return a copy of the recorded history
Scenario: Initialization respects explicit guard nodes
Given a langgraph config with explicit start and end nodes
When I construct the LangGraph with that config
Then initialization should reuse the provided start and end nodes
Scenario: Node subscriptions invoke handlers on stream events
Given a langgraph instance prepared to observe node streams
When the node stream emits next error and completion events
Then the subscription handlers should be exercised
Scenario: Parallel groups computed for converging branches
Given a langgraph config with converging branches
When I construct the LangGraph for parallel groups
Then parallel groups should reflect staged execution order
Scenario: Validation fails when guard nodes missing
Given a langgraph instance missing required guard nodes
When I validate the graph explicitly
Then a guard validation error should be raised
Scenario: Start uses default state and stop resets running flag
Given a langgraph instance ready to start
When I start without input then stop and fetch state
Then it should use default state and update running flags