Files
cleveragents-core/features/langgraph_state_branch_coverage.feature
T

59 lines
2.5 KiB
Gherkin

Feature: LangGraph state branch coverage
As a developer
I want to exercise remaining uncovered branches
So that langgraph/state.py reaches higher coverage
Background:
Given the state management system is available
Scenario: Replace mode overwrites existing fields
Given I have a GraphState with metadata {"original": 1} and current node "old"
When I replace the state with updates containing metadata {"new": 2} and current node "new"
Then the state's metadata should equal {"new": 2}
And the state's current node should equal "new"
Scenario: Merge mode merges metadata dictionaries
Given I have a GraphState with metadata {"alpha": 1}
And I have merge metadata updates {"beta": 2}
When I merge metadata updates into the state
Then the state's metadata should contain keys "alpha" and "beta"
Scenario: Append mode appends a single message item
Given I have a GraphState with 1 message
When I append a single message with id 99 into the state
Then the state's messages should end with id 99
And the message list length should be 2
Scenario: Save checkpoint without directory is a no-op
Given I have a StateManager without checkpointing
When I invoke checkpoint saving manually
Then the update count should remain at 0
Scenario: Load checkpoint restores state and counters
Given I have a checkpoint file with execution count 7 and metadata {"restored": true}
When I load the checkpoint into a StateManager
Then the manager state should include metadata {"restored": true}
And the manager update count should be 7
Scenario: Latest checkpoint returns None when missing
Given I have a StateManager without checkpointing
When I request the latest checkpoint
Then no checkpoint path should be returned
Scenario: Latest checkpoint selects the most recent file
Given I have a StateManager with two checkpoints written at different times
When I request the latest checkpoint
Then the newest checkpoint path should be returned
Scenario: Time travel without history returns None
Given I have a StateManager with time travel disabled
When I request time travel
Then the returned time travel state should be None
Scenario: Clear history and reset restore initial state
Given I have a StateManager with time travel history entries
When I clear the history and then reset with metadata {"reset": true}
Then the history should be empty after reset
And the execution count should be zero after reset
And the state metadata should include {"reset": true}